Initializing the iOS Paysafe SDK
Please Note: As an ISV / Paysafe Partner, you will need to complete all of the below "merchant" steps on behalf of the Parent Merchant Legal Entity (PMLE) that your merchants will be operating under.
If the card issuer requires that the user completes a 3DS challenge before confirming the authentication, you can just pass the challenge payload to the SDK and it will handle it using a native and intuitive UI. The Paysafe SDK currently supports both 3DS version 1.0.2 (via webview only) and version 2.1.0. You can find more information about the 3D Secure transaction flow here: Introduction to 3D Secure 2
In order to process 3DS card payments in your application, you need two components:
- The Paysafe API Client
- The ThreeDSecureService
Initializing the Paysafe API Client
The Paysafe API Client is the component that handles the HTTP communication with the Paysafe REST APIs. Pass the following parameters during its initialization from the application:
- Merchant User ID (registered Paysafe API Key username)
- Merchant Paysafe Password (registered Paysafe API Key password)
- Merchant Account Number (registered Paysafe Account Number)
- Environment (TEST/ LIVE)
These parameters are stored in a single .plist file and are required only when the application begins or when dynamically need to set multiple providers. There are two ways for initialization:
- By setting Merchant User ID and Merchant Paysafe Password
- By providing "apiKey" directly
Here is an example of initializing the Paysafe API Client:
PaysafeSDKMerchantConfiguration *merchantConfiguration = [[PaysafeSDKMerchantConfiguration alloc] initWithUsername: <Your Merchant User ID> password: <Your Merchant Paysafe Password> accountId: <Your Merchant Account Number>];
PaysafeSDK.currentEnvironment = .test PaysafeSDK.merchantConfiguration = PaysafeSDK.MerchantConfiguration(username: <Your Merchant User ID>, password: <Your Merchant Paysafe Password>, accountId: <Your Merchant Account Number>)
By default currentEnvironment is set to production in the SDK if nothing is specified.
Here is an example of initializing the Paysafe API Client using apikey:
let merchantConfiguration = PaysafeSDK.MerchantConfiguration(apiKey: <Your Merchant API Key>, accountId: <Your Merchant Account Number>)
Initializing the ThreeDSecureService
The ThreeDSecureService provides the logic for generating a device fingerprint and handling an incoming 3DS challenge.
Here is an example of creating an instance of the ThreeDSecureService:
ThreeDSecureService *service = [[ThreeDSecureService alloc] init];
// config is merchant's configuration that would be used. If you don't need different merchantConfiguration for every call, // you can set a static one via PaysafeSDK.merchantConfiguration. let service = ThreeDSecureService(merchantConfiguration: config) // otherwise only calling the service this way is enough let service = ThreeDSecureService()
Optionally, you can provide customization options for the 3DS challenge screens when initializing the ThreeDSecureService.