Project Requirements
To integrate the Spotflow iOS SDK into your project, ensure the following prerequisites are met:- Xcode 13.0 or later
- iOS 11.0 or higher
- Swift 5.3 or later
- Swift Package Manager (SPM) for dependency management
Installation
Using Swift Package Manager (SPM)
To addSpotFlow - iOS SDK to your project using Xcode or by updating your Package.swift file:
Parameters Required by the SDK
planId | The plan ID (optional). |
|---|---|
currency | Currency for the payment (e.g., “NGN”). |
amount | Amount to be paid (nullable). |
key | The API key for authenticating the transaction. |
encryptionKey | This key is used to encrypt the card for secure transactions. |
customerEmail | The email address of the customer. |
customerName | The name of the customer (optional). |
customerPhoneNumber | The phone number of the customer (optional). |
customerId | The unique identifier for the customer (optional). |
paymentDescription | Description of the payment (optional). |
appLogo | App logo widget (optional). |
appName | The name of the app (optional). |
debugMode | Enable or disable debug mode. |
Navigating to the Payment Screen
To navigate to the payment screen and initiate a payment process, create an instance ofSpotFlowPaymentManager with the required parameters and pass it to SpotFlowPaymentUI.
Example Usage
SpotFlowPaymentUI Parameters
manager: An instance ofSpotFlowPaymentManager containing payment and customer information.
onPaymentSuccess: A closure that gets called when the payment is successful.
onPaymentFailure: A closure that gets called when the payment fails, with an error as a parameter
SpotFlowPaymentManager
SpotFlowPaymentManager is a struct that holds all necessary information for a payment transaction.
Properties/Parameters
Handling Error Messages
This SDK provides comprehensive error handling mechanisms to assist in troubleshooting and providing informative feedback to users. Upon encountering an error, detailed error codes and descriptions are returned. By extracting error messages from the response, you can effectively communicate the issue to the user and take appropriate actions. Ensure you implement appropriate error handling mechanisms to provide informative feedback to the user.Testing
Thoroughly test the integration with different payment scenarios including successful payments, failures, and edge cases to ensure a smooth user experience. Spotflow provides testing helpers that allows you to simulate different payment scenarios For your convenience, here are the testing helpers available:- Card Testing: Test cards can be found here
- Bank Transfer Testing: Test bank transfer scenarios with the testing account details provided during your integration.

