Payment UI
Integrate the Payment UI wrapper to add a built-in interface for accepting card payments using the VP3300 reader.
Prerequisites
To integrate and launch the payment UI flow, ensure you have following:
✅ An API access key issued to you by Xplor Pay.
✅ A public key issued to you by Xplor Pay.
✅ A sandbox URL for testing the integration.
Add Podfile to the project
To add and configure a Podfile in your project:
Create or open your Xcode project.
Navigate to the project root directory.
Open Terminal and run:
cd <project-root-path>Initialize CocoaPods.
Run:
pod initIf CocoaPods is not installed, install it by running.
sudo gem install cocoapodsOpen and edit the Podfile.
Replace the contents with the following:
source 'https://github.com/xplor-pay/CocoaPods.git'
source 'https://github.com/CocoaPods/Specs.git'
# Uncomment the next line to define a global platform for your project
# platform :ios, '13.0'
target 'PROJECTNAME' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'ClearentIdtechIOSFrameworkPod', '4.0.158'
# Pods for ExampleSwift
endUpdate the target name and pod version.
Replace
PROJECTNAMEwith your Xcode target name.Verify that you are using the latest pod version.
Install the dependencies.
Run:
pod installOpen the
.xcworkspacefile generated by CocoaPods.
The Podfile is added and configured. CocoaPods installs the dependencies and updates your project with the required settings and build configurations.
Initialize the SDK
Before presenting the payment UI, initialize the SDK with your API credentials:
ClearentUIManager.shared.initialize(
with: ClearentUIManagerConfiguration(
baseURL: "<YOUR_BASE_URL>",
apiKey: "<YOUR_API_KEY>",
publicKey: "<YOUR_PUBLIC_KEY>",
softwareType: "<YOUR_APP_NAME>",
softwareTypeVersion: "<YOUR_APP_VERSION>"
)
)Configuration values
Use the following values when configuring the SDK:
baseURL
String
Required
The API endpoint for the selected environment.
Use the sandbox URL (https://gateway-int.clearent.net) for testing.
Use the production URL (https://gateway.clearent.net) for live transactions.
apiKey
String
Required
The API key associated with your account and environment. Provided to you during onboarding with Xplor Pay.
publicKey
String
Required
The public key associated with your account and environment. Provided to you during onboarding with Xplor Pay.
softwareType
String
Required
The name of your application used for support purposes. Maximum length is 255 characters.
softwareTypeVersion
String
Required
The version of your application used for support purposes. Maximum length is 255 characters.
The SDK is initialized with your credentials and environment. Your app is ready to present the payment UI.
Launch the payment UI
From your view controller, create a PaymentInfo object and present the payment UI:
let paymentInfo = PaymentInfo(
amount: 20.00,
customerID: "<YOUR_CUSTOMER_ID>",
invoice: "<YOUR_INVOICE_NUMBER>",
orderID: "<YOUR_ORDER_ID>",
billing: ClearentIdtechIOSFramework.ClientInformation,
shipping: ClearentIdtechIOSFramework.ClientInformation,
softwareType: "<YOUR_APP_NAME>"
)
ClearentUIManager.shared.paymentViewController(
paymentInfo: paymentInfo,
completion: completion
)This call presents the full payment flow, including card reader pairing, transaction input, and receipt handling. No additional configuration is required for a basic integration.
Select the payment method
Use the
cardReaderPaymentIsPreferredproperty to control which payment method is shown:true→ Uses the card reader flow.false→ Displays the manual card entry form.
Set this property before presenting the payment UI. The
PaymentViewControllerreads this value to determine which flow to display.
func updatePaymentMethod(useCardReader: Bool) {
ClearentUIManager.shared.cardReaderPaymentIsPreferred = useCardReader
}The payment UI is displayed, allowing users to complete transactions using either a card reader or manual entry.
Last updated
Was this helpful?

