iOS Native SDK(v2) - Merchant's Checkout
Please follow steps below to setup iOS Native SDK and start accepting payment via PortOne.
#
Steps to integrate iOS SDK:Download the framework from here
After downloading the .xcframework, drag and drop it in the project
Go to General → Frameworks, Library and Embedded Content and then drop the framework and change the Embed to Embed & sign.
Import the PortOnePaymentSDK as below at the required places.
Initialise the checkout instance to get the available methods in SDK as below
Set the environment as .dev to test in the dev environment. While moving to the Production, set the environment to .prod(default to .prod).
Should implement the delegate methods as below to get the response of failure and success callbacks from the webView.
In the info.plist add the new Array type node LSApplicationQueriesSchemes as below:
Include the URLType in info.plist to redirect to your app(deep linking) as below
#
Fetch the saved cards for a particular number- Capture the mobile number and OTP to fetch the saved credit cards for a particular user.
- To generate the OTP, call the method as below:
data - Contains data, status.
Status code :
200 - Success
400 - Failed due to incorrect OTP or wrong params passed
- After successfully entered the OTP, the captured mobile number and OTP should pass to the fetchSavedCards as below to fetch the saved credit cards for the particular number.
formattedText - Contains mobile number with Country code. (eg: +16625655248 , +918341234123)
OTP - OTP that received to the particular number given.
response:
Success case
Failure case:
#
Initiate payments in following ways- Initiate with wallet payment
- Initiate with new credit card Payment
- Initiate from saved credit card payment
Initiate the wallet Payment
Initialise the wallet payment with transactionRequest as below:
Pass the TransactionRequest to initiateWalletPayments as below:
Handle the success and failure cases from the delegate method as below:
Sample Payload request:
#
Sample responseSuccess callback :
Failure Callback:
Steps for Signature Hash GenerationPayment Request
Initiate with new credit card Payment
Initialise the new card payment with transactionRequest as below:
cardDetails:
Pass the TransactionRequest and cardDetails to initiateNewCardPayment as below:
Handle the success and failure cases from the delegate method as below:
Sample Payload request:
#
Sample response*Sample Success callback :*
*Sample Failure Callback*:
Steps for Signature Hash GenerationPayment Request
#
Initiate with Saved credit card PaymentInitialise the saved card payment with transactionRequest as below:
cardDetails:
Pass the TransactionRequest and cardDetails to initiateNewCardPayment as below:
Handle the success and failure cases from the delegate method as below:
Sample Payload request:
#
Sample response*Sample Success callback :*
*Sample Failure Callback*:
Steps for Signature Hash GenerationPayment Request
#
V3 functionalityTo create the payment link, generate the JWT token
Generate the JWT token:
create the JWT token using the payload and portone secretKey
payload:
Algorithm to use for generating token - “HS256”
To get the payment link to use the SDK checkout UI, call the checkOutUI method from SDK as below:
Sample Payload:
JWT token generation
Should implement the delegate methods as below to get the response of failure and success callbacks from the webView.