omise / omise-ios

Omise iOS SDK
https://www.opn.ooo
MIT License
74 stars 36 forks source link

Issues with Setting Up Promptpay #140

Closed thocosals2233 closed 3 years ago

thocosals2233 commented 3 years ago
Screen Shot 2021-06-25 at 10 15 16 AM

I followed the integration process and received the following error. Although it is not related specifically to PromptPay, it is an issue that arises when utilizing the Request tied to payment Source.

I am using Omise 4.3.0 and Xcode 12.5

Ashraf-alkibsi commented 3 years ago

Hi @thocosals2233 thanks for raising. We will have a look at this and come back to you as soon as possible.

thocosals2233 commented 3 years ago

Ok, thank you. Also, will PromptPay be added to the built-in payment UI?

nuxzero commented 3 years ago

@thocosals2233 Your code looks correct to me. Please ensure you don’t have redundant Request class uses in your code. If you have, you can use OmiseSDK.Request instead of Request.

For PromptPay build-in payment UI, Omise iOS supports creating a source object with PromptPay payment type. You can check out this section to see how to use the PaymentCreatorController.

thocosals2233 commented 3 years ago

Thank you for getting back to me.

Could you kindly share how to adjust this to OmiseSDk.Request: let sourceParameter = Source.CreateParameter.init(paymentInformation: PaymentInformation.promptpay, amount: Int64(amount), currency: Currency(code: "THB"))

    let request = Request<Source>(parameter: sourceParameter)

Also, which is there any other option with PromptPay aside from below: PaymentCreatorController.thailandDefaultAvailableSourceMethods

It has too many payment options and we would only like to pick mobile banking and prompt pay

tobias90 commented 3 years ago

@thocosals2233 You can specify which payment methods you want to use with the PaymentCreatorController:

paymentCreatorController.allowedPaymentMethods = [.promptPay, .mobileBankingSCB]

However, the usage is optional and it should also work to create the request manually.

Please try the following to avoid conflicts with your own classes:

let sourceParameter = CreateSourceParameter(
   paymentInformation: .promptpay, 
   amount: Int64(amount), 
   currency: .thb
)

let request = OmiseSDK.Request<Source>(parameter: sourceParameter)

let client = OmiseSDK.Client(publicKey: publicKey)
client.send(request) { [weak self] result in

}
thocosals2233 commented 3 years ago

Hi, thanks for the help!

Also, how is prompt pay integrated if it's a mobile-only app? Are there are protocols within the SDK to help with the process?

thocosals2233 commented 3 years ago

Hello, has anyone at Omise actually looked at the prompt pay? There is 0 update to the docs, so it is unclear how Omise handles this. Any effort would be greatly appreciated. Thanks!

nuxzero commented 3 years ago

The Omise SDK proposes to create sources and tokens. So for making a payment with Prompt Pay, I assumed that you already integrate Omise iOS to create the source on your app. Next step, you can use the source object to create a charge on your server. Your server needs to call the Charge API to create a charge. After that you should receive a charge response with QR code. You can use that QR code to authorize this charge.

You can check out full documentation how to integrate Omise SDK for Prompt Pay to make a payment from the link https://www.omise.co/promptpay#implementation.