Lite SDK (Enrollment Flutter)

This page provides a step-by-step guide to integrating the Lite Flutter SDK for enrollment functionalities into your application.

Ensure all required Flutter SDK dependencies are included in your project before proceeding with the setup.

Step 1: Add the SDK Dependency

To add the Yuno SDK to your Flutter project, run the following command:

dart pub add yuno

Step 2: Initialize the SDK with the Public Key

Create an instance of Yuno.init by providing a valid PUBLIC_API_KEY. Refer to the Yuno documentation for details on obtaining API credentials.

await Yuno.init(
  apiKey: 'your_api_key_here',
  countryCode: 'your_country_code', // The complete list of country codes is available at: 
                                    // https://docs.y.uno/docs/country-coverage-yuno-sdk
  yunoConfig: YunoConfig(
    lang: YunoLanguage.en, // Supported languages: ENGLISH, SPANISH, PORTUGUESE, MALAY, INDONESIAN, THAI
    cardflow: CardFlow.multiStep, // Default card flow
    saveCardEnable: true, // Default: true
    keepLoader: true, // Default: true
  ),
  iosConfig: IosConfig(), // Optional, can use default value
);

Below is a table describing the parameters required for initializing the Yuno SDK in your Flutter application. These settings allow you to customize the SDK behavior to align with your application needs:

ParameterDescription
apiKeyYour unique public API key for authentication.
countryCodeThe user’s country code. Refer to the Country Coverage page for a complete list of supported country codes.
yunoConfigConfigures various SDK settings. Contains additional parameters listed below.
langThe language for SDK content. Supported options include:
en - English
es - Spanish
pt - Portuguese
ms - Malay
id - Indonesian
th - Thai
cardflowDefines the card flow type for the payment process. The default is CardFlow.multiStep.
saveCardEnableSpecifies whether to enable the "Save Card" option. Defaults to true.
keepLoaderControls whether to keep the loader visible. Defaults to true.
iosConfigOptional iOS-specific configurations. If omitted, the default configuration is used.

Step 3: Add the SDK Widget Handler

Integrate YunoEnrollmentListener to track and manage enrollment state changes in your application.

YunoEnrollmentListener(
  listener: (state) {
    // Handle [state] it is YunoEnrollmentState
    // - [enrollmentStatus]:  [reject,succeded,fail,processing,internalError,cancelByUser]
  },
  child: SomeWidget(),
)

Step 4: Enroll a New Payment Method

To enroll a new payment method, use the enrollmentPayment method:

await Yuno.enrollmentPayment(
  arguments: EnrollmentArguments(
    customerSession: 'YOUR_CUSTOMER_SESSION',
    showPaymentStatus: true, // Optional by default is true,
    countryCode: 'your_country_code', // Optional by default the value setted in the initialize,
  ),
);

The following table presents all the protocol requirements you have to provide and their descriptions.

ParameterDescription
customerSessionRefers to the current payment's customer session.
countryCodeDetermines the country for the payment process. The complete list of supported countries is available on the Country coverage page. By default, it uses the same value you set during initialization.
showPaymentStatusA Boolean flag that determines whether to display status views during the payment enrollment process. Defaults to true.

Step 5: Enrollment Status

The possible enrollment states are listed below:

StatusDescription
succeededThe enrollment was completed successfully.
failThe enrollment process failed due to an error during the payment process, preventing completion.
processingThe enrollment is in progress, possibly awaiting approval from a third-party service or financial institution.
rejectThe enrollment was rejected, possibly due to insufficient funds, suspected fraud, or policy violations.
internalErrorAn unexpected system error occurred during the enrollment process.
cancelByUserThe user voluntarily canceled the enrollment before completion.

Complementary Features

The Yuno Flutter SDK offers additional features to enhance the customer experience. You can check the current enrollment configurations and use SDK Customizations to modify the appearance, match your brand, or adjust the loader settings.