Seamless (Flutter)

This page provides step-by-step instructions for integrating the Seamless Flutter SDK payment functionalities into your application.

{`

Ensure all required Flutter SDK dependencies are included in your project before following the setup example.

`}

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 on 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 cardflow
    saveCardEnable: true,  // default saveCardEnable
    keepLoader: true,  // default saveCardEnable
  ),
  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:

Parameter Description
`apiKey` Your unique public API key for authentication.
`countryCode` The user’s country code. Refer to the [Country Coverage](https://docs.y.uno/docs/country-coverage-yuno-sdk) page for a complete list of supported country codes.
`yunoConfig` Configures various SDK settings. Contains additional parameters listed below.
`lang` The language for SDK content. Supported options include:
`en` - English
`es` - Spanish
`pt` - Portuguese
`ms` - Malay
`id` - Indonesian
`th` - Thai
`cardflow` Defines the card flow type for the payment process. The default is `CardFlow.multiStep`.
`saveCardEnable` Specifies whether to enable the "Save Card" option. Defaults to `true`.
`keepLoader` Controls whether to keep the loader visible. Defaults to `true`.
`iosConfig` Optional iOS-specific configurations. If omitted, the default configuration is used.

Step 3: Initialize Seamless SDK

The seamless checkout and payment process is initiated with a single method Yuno.startPaymentSeamlessLite. Use it with async/await:

Future<YunoStatus> startPaymentSeamlessLite(
  arguments: SeamlessArguments(
    showPaymentStatus: true, // optional parameter by default is true
    checkoutSession: 'YOUR_CHECKOUT_SESSION',
    methodSelected: MethodSelected(
      vaultedToken: 'YOUR_VAULTED_TOKEN',
      paymentMethodType: 'YOUR_PAYMENT_METHOD_TYPE',
    ),
  )
);

// use
final yunoStatus = await Yuno.startPaymentSeamlessLite(arguments: ...);

Seamless Arguments

ParameterDescription
showPaymentStatusOptional. When true, displays the SDK’s default result screen. Default: true.
checkoutSessionRefers to the current payment's checkout session.
methodSelectedAccepts vaultedToken and paymentMethodType parameters.

Transaction States

After the payment is completed, the SDK returns different transaction states:

Transaction StateDescription
succeededTransaction completed successfully.
failPayment process failed due to an error.
processingPayment is being processed, awaiting approval.
rejectTransaction was rejected due to various reasons (e.g., insufficient funds, fraud detection).
internalErrorUnexpected error occurred on the backend.
userCancellUser voluntarily canceled the payment.

Additional Features

  • Continue Payment: Use continuePayment to handle asynchronous payment steps if required.
  • Customizations: Configure SDK appearance, update payment status, or integrate 3DS into your flow.

For a full implementation example, refer to the Demo App on GitHub.