Step 1: Include the library in your project
Before proceeding with the Lite SDK implementation, see the SDK Integration Overview for detailed instructions on how to properly integrate the SDK into your project using CocoaPods or Swift Package Manager. Choose the integration method that best suits your development workflow and technical requirements. After completing the SDK integration, you can proceed with the following steps to implement the lite enrollment functionality.Step 2: Initialize SDK
Initialize the Yuno SDK in yourAppDelegate (or App struct for SwiftUI) by providing a valid PUBLIC_API_KEY:
CredentialsSee the credentials page for more information: /reference/getting-started/authentication
Step 3: Create a customer session
To start the enrollment process, you need to provide thecustomer_session. First, you need to create a customer. Use the Create Customer endpoint to create new customers. In the response, you will receive the customer id, which you use to create the customer session.
After creating the customer, you can create the customer session. Use the customer id and the Create Customer Session endpoint. The customer_session will be provided in the response. You need a new customer_session every time you enroll in a new payment method.
Step 4: Adopt YunoEnrollmentDelegate
To handle the enrollment process, your class (typically aUIViewController) must adopt the YunoEnrollmentDelegate protocol.
Swift 6 Concurrency RequirementsIf you’re using Swift 6, you’ll need to implement the
YunoEnrollmentDelegate protocol with specific concurrency considerations. See the Swift 6 Concurrency guide for detailed implementation options and best practices.Delegate Properties
| Property | Description |
|---|---|
customerSession | Refers to the current enrollment’s customer session. |
countryCode | This parameter specifies the country code for which the enrollment is being set up. |
viewController | The view controller from which the enrollment UI will be presented. |
Step 5: Start the enrollment flow
Once you have implemented the delegate, callenrollPayment to launch the enrollment UI:
Parameters
| Parameter | Description |
|---|---|
with | The object that implements the YunoEnrollmentDelegate. |
showPaymentStatus | Controls whether the SDK shows its own status screens after the enrollment process. |
Demo AppIn addition to the code examples provided, you can access the Yuno iOS SDK repository for a complete implementation of Yuno SDKs.