iOS Native SDK - Embed(V3)
#
1. OverviewIntegrate PortOne iOS Native SDK to enable secure and efficient payment processing in your iOS application. This guide will help you set up the SDK and start accepting payments seamlessly.
#
2. Video TutorialFor a comprehensive guide on integrating the PortOne iOS SDK and using the payment method flow, refer to the following video tutorials:
- iOS Integration: Watch Tutorial
- Accessing PortOne Checkout: Watch Tutorial
#
3. Sample AppExplore the sample application for integration examples on GitHub.
#
4. PrerequisitesBefore starting the integration, ensure you have:
- PortOne Account: Create an account on PortOne to access their services.
- API Keys: Obtain your API keys (client key and secret key) from the PortOne portal under Settings -> API tab.
- Enable Payment Channels: Customize and enable the payment channels and methods according to your business requirements.
- iOS Application: Prepare an iOS application where you will integrate the PortOne SDK.
- Download the Framework: Get the latest framework from here.
#
5. Integration Steps#
5.1. Embed the Framework in ProjectAdd Framework:
- Download the
.xcframework
from the version folder. - Drag and drop it into your Xcode project.
- Go to
General
->Frameworks, Libraries, and Embedded Content
. - Set the framework to
Embed & Sign
.
- Download the
#
5.2. Enable Deep Linking in iOSConfigure URL Schemes:
Open your project settings and navigate to
Info
.Add URL schemes and identifiers under
URL Types
ininfo.plist
:
Add URL Schemes for Other Apps:
Support HTTP Connections:
Add the following to
info.plist
:
#
5.3. Obtain JWT TokenGenerate JWT Token:
- Implement server-side logic to generate a JWT token using the
portoneKey
. - Retrieve the JWT token in your iOS app and store it securely.
- Implement server-side logic to generate a JWT token using the
#
5.4. Generate Signature HashCreate Signature Hash:
- Use HmacSHA256 to generate a signature hash for the payload.
#
5.5. Initialize and Authorize SDKImport SDK:
Initialize Checkout:
Implement Delegate Methods:
#
6. Checkout Using Web (v3)PortOne's Checkout offers a streamlined process by handling the payment UI within the SDK.
Initiate Checkout:
Prepare Payload:
}
Sample Response:
Success:
Failed:
#
7. Error HandlingINVALID_UNAUTHORIZED_JWT_TOKEN_ERROR
: Ensure the PortOne key and secret key are correct, and that the JWT token is properly formatted with theBearer
prefix.INVALID_UNAUTHORISED_TRANSACTION_SIGNATURE_ERROR
: Verify that all parameters match the payload and the PortOne key is correct.INVALID_PAYMENT_CHANNEL
: Confirm that the payment channels and methods are enabled in the PortOne portal.INVALID_ENVIRONMENT
: Ensure the environment is set to eithersandbox
orlive
.- Summation of Order Values: Check that the order value, taxes, duties, shipping, and discounts match the specified amount.
#
8. JWT Token GenerationAlgorithm: HS256
Generate JWT Token:
- iss: Issuer (Default: "PORTONE")
- sub: Portone Key
- iat: Issued At (Current timestamp)
- exp: Expiration Time (Timestamp + 100 seconds)
For more details, refer to the Native iOS - Payment SDK: v2 documentation