Additional resources
- See Choose the right integration for you if you’re unsure which flow to follow.
- Access the Release notes or the Yuno iOS SDK repository to verify the latest SDK version available.
- full-checkout Enrollment (iOS): Automatic enrollment with pre-built UI components
Requirements
- CocoaPods or Swift Package Manager
- iOS 14.0 or later
- Active Yuno account; API credentials (obtain from the Yuno Dashboard → Developers > Credentials)
- Create a customer using the Create customer endpoint before enrolling
Parameters
For the full list of parameters, see the iOS SDK Common Reference.| Parameter | Description |
|---|---|
customerSession | Customer session ID from Create customer session API. Required. |
countryCode | ISO country code (e.g. BR). Required. |
language | Language code for the UI. Optional. |
viewController | UIViewController that presents the enrollment flow. Required for delegate. |
yunoEnrollmentResult(_:) | Delegate: enrollment finished with result. |
YunoConfig (initialize) | Optional: appearance, saveCardEnabled, keepLoader. See Common Reference. |
full-checkout Enrollment (iOS)
The Yuno full-checkout iOS SDK provides enrollment with pre-built UI, card enrollment, status handling, and basic error management. See Requirements above.Step 1: Create a customer and customer session
Create a customer in Yuno’s system using the Create customer endpoint before enrolling payment methods. This endpoint will return acustomer_id that you’ll use to associate enrolled payment methods with the specific customer.
Then create a customer session using the Create Customer Session endpoint. The session information will be used when calling the enrollment methods.
customer_session ID that you’ll use in the next step.
Step 2: Include the library in your project
Including the library in your project is done in the same way as in payment flows. Follow the steps in Include the library in your project there.CocoaPods
Swift Package Manager
Step 3: Initialize SDK with the public key
Initialize the SDK:- Get your Public API Key from the Yuno Dashboard
- Initialize the SDK by calling
Yuno.initialize()with your API key:
YunoConfig data class to customize the SDK’s behavior. Include this configuration when calling Yuno.initialize(). For example:
Step 4: Implement the enrollment delegate
Create a class that adopts theYunoEnrollmentDelegate protocol:
Options
| Parameter | Description |
|---|---|
customerSession | The unique identifier for the customer session. |
countryCode | Country code where the enrollment is performed. See Country Coverage for supported countries. |
language | Language code for the enrollment forms (e.g., "en", "es", "pt"). See Supported languages. |
viewController | The UIViewController used to present the enrollment flow. Required for proper UI presentation. |
yunoEnrollmentResult(_:) | Called when the enrollment process completes with the final result. |
Step 5: Start the enrollment process
Call theenrollPayment() method to display the enrollment flow:
UIViewController modally using the viewController provided in your delegate. In SwiftUI, wrap a UIViewController and return it via the viewController property.
Options
| Parameter | Type | Description |
|---|---|---|
delegate | YunoEnrollmentDelegate | The delegate object that handles enrollment callbacks. |
showPaymentStatus | Bool | Whether to display status views during the enrollment process. When true, the SDK displays default status screens. When false, you handle status display through callbacks. |
UIViewController and return it from the viewController property so the SDK can present the UI.
Step 6: Handle deep link return (Optional)
Only needed when the enrollment flow uses deep links. If your payment method does not use deep links, skip this step. Otherwise, handle the return in yourAppDelegate:
url.scheme matches the callback_url used when creating the customer_session.
Step 7: Handle enrollment result
The SDK calls youryunoEnrollmentResult(_:) delegate method with the final status:
Enrollment Result States
| State | Description | Action Required |
|---|---|---|
succeeded | Enrollment completed successfully | No |
fail | Enrollment failed due to validation or technical issues | Yes - Investigate and retry |
processing | Enrollment in progress, awaiting approval | No |
reject | Enrollment rejected (invalid data, fraud detection, etc.) | Yes - Inform user and suggest actions |
internalError | Unexpected internal error occurred | Yes - Technical intervention required |
userCancelled | User canceled the enrollment | No |
Yuno.Result does not include tokens or error messages; it only returns a high-level status.