Lite SDK (Enrollment)
Step 1: Include the library in your project
You can add the library using CocoaPods or Swift Package Manager.
CocoaPods
To add the Yuno SDK to your iOS project, you need to install the Yuno SDK. If you do not have a Podfile, follow the CocoaPods guide to create one. After creating the Podfile, you will integrate the Yuno SDK with Cocoapods by adding the line below to your Podfile.
pod 'YunoSDK', '~> 1.1.22'
After, you need to run the installation:
pod install
Swift Package Manager
To add the Yuno SDK to your iOS project, you need to install the Swift Package Manager. With the Swift package set up, add YunoSDK as a dependency, as presented in the following code block:
dependencies: [
.package(url: "https://github.com/yuno-payments/yuno-sdk-ios.git", .upToNextMajor(from: "1.1.17"))
]
Step 2: Enroll a new payment method
Yuno's iOS SDK provides an enrollment feature for payment methods integrated into Yuno. To display a view controller with the flow for integrating a new payment method, call the method presented in the following code snippet:
protocol YunoPaymentDelegate: AnyObject {
var customerSession: String { get }
// The complete list of country codes is available on https://docs.y.uno/docs/country-coverage-yuno-sdk
var countryCode: String { get }
var language: String? { get }
var viewController: UIViewController? { get }
func yunoEnrollmentResult(_ result: Yuno.Result)
}
class ViewController: YunoEnrollmentDelegate {
func startEnrollment() {
Yuno.enrollPayment(with: self, showPaymentStatus: Bool)
}
}
The following table presents all the protocol requirements you have to provide and their descriptions.
Parameter | Description |
---|---|
customerSession | Refers to the current payment's customer session. |
countryCode | This parameter determines the country for which the payment process is being configured. The complete list of supported countries and their country code is available on the Country coverage page. |
language | Defines the language to be used in the payment forms. You can set it to one of the available language options: es (Spanish), en (English), or pt (Portuguese). |
yunoEnrollmentResult(\_ result: Yuno.Result) | This method is called when the enrollment process is completed, providing the result of the enrollment as a parameter of type Yuno.Result . |
The showPaymentStatus
parameter is used to determine whether the payment status should be displayed. Passing true
as an argument will show the payment status while passing false
indicates that the payment status should not be displayed.
The ViewController
class is a subclass of UIViewController
and conforms to the YunoEnrollmentDelegate
protocol. It includes a function called enrollPayment(with delegate: YunoEnrollmentDelegate, showPaymentStatus: Bool)
, which parameters are described below:
delegate: YunoEnrollmentDelegate
: The delegate object that handles enrollment callbacks.showPaymentStatus: Bool
: A Boolean flag that determines whether to display status views during the payment enrollment process.
The enrollPayment
method initiates the payment enrollment process. You should call It in response to user interactions, such as pressing a button. The method utilizes the provided delegate
to manage enrollment events and, based on the showPaymentStatus
parameter decides whether to show visual feedback about the enrollment status.
Complementary Features
Yuno iOS SDK provides additional services and configurations you can use to improve customers' experience. Use the SDK Customizations to change the SDK appearance to match your brand or to configure the loader.
- Loader: Control the use of the loader.
- You also can choose one of the render options for the card form. Below, you find screenshots presenting the difference between the
cardFormType
ONE_STEP
andSTEP_BY_STEP
.
- SDK Customizations: Change the SDK appearance to match your brand.
Demo App
In addition to the code examples provided, you can access the Yuno repository for a complete implementation of Yuno iOS SDKs.
Updated 19 days ago