Skip to main content
Orientation: Choosing Your Integration Flow, before you begin, please review the Official Integration Flow.
  • Standard Flow (Full Checkout): Recommended for most merchants. Yuno handles the UI, security, and automatic updates for payment methods.
  • Custom Flow (This SDK): Use this only if you require full control over the UX. Note: You will be responsible for manually handling payment statuses, 3DS transitions, and fraud routing data collection.
Follow this step-by-step guide to implement and enable Yuno’s Lite Web SDK payment functionality in your application.

Step 1: Include the library in your project

The integration guide provides three flexible methods:
  1. Direct HTML script inclusion
  2. Dynamic JavaScript injection
  3. NPM module installation
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 functionality.
TypeScript LibraryIf you are using TypeScript, Yuno offers a library that provides access to all available methods in the Yuno Web SDK.

Step 2: Initialize SDK with the public key

Initialize the Yuno SDK in your JavaScript application by providing a valid PUBLIC_API_KEY:
CredentialsSee the credentials page for more information: /reference/getting-started/authentication

Step 3: Create a checkout session

To initialize the payment flow, create a new checkout_session using the Create checkout session endpoint.
  • First, create a customer or retrieve an existing customer ID
  • Include it when creating the checkout_session
Control Authorization and CaptureTo control authorization and capture with cards, include payment_method.detail.card.capture in the checkout session: set false to authorize only, true to capture immediately.

Key parameters

onPaymentMethodSelect EventFor all APMs, including Google Pay, Apple Pay, and PayPal, onPaymentMethodSelected is triggered as soon as the customer chooses the payment method (before the payment flow begins). Define onPaymentMethodSelected in await yuno.startCheckout() before await yuno.mountCheckoutLite().

Step 4: Start the checkout process

Use the configuration below to provide a lite and user-friendly payment experience for your customers:
When using startCheckout, specify the callbacks to handle payments. You can also customize the checkout interface using the texts objects.

Parameters

Configure the lite checkout with the following options:
Customer and Merchant-Initiated TransactionsPayments can be initiated by the customer (CIT) or by the merchant (MIT). You find more information about their characteristics in Stored credentials.

Step 5: Mount the SDK

To present the checkout process based on the selected payment method, use the await yuno.mountCheckoutLite() function. This step ensures the SDK is properly mounted on your chosen HTML element.
See the Payment type page to view the complete list of payment method types you can use when mounting the SDK. The vaultedToken is optional. It represents a previously enrolled payment method. If you provide the vaultedToken, the user will not be required to provide the payment information again since it was provided in a previous transaction. After mounting, you must start the checkout flow by calling yuno.startPayment(). If you skip this call, the payment form will not open. Note that yuno.startPayment() also returns a promise and should be awaited.

Step 6: Start the payment flow (Required)

Call await yuno.startPayment() immediately after await yuno.mountCheckoutLite() to open the selected payment method UI:
Alternatively, you can trigger the start from a user action such as a button click:
Demo AppIn addition to the code examples provided, you can access the Demo App for a complete implementation of Yuno SDKs (clone from the repository).

Mount external buttons

You can use the mountExternalButtons method to render Google Pay and Apple Pay buttons in custom locations within your UI. This gives you control over where these buttons are displayed.

Parameters

Unmounting buttons

You can unmount a single external button by payment method type:
Or unmount all external buttons at once:

Unmounting the SDK

For explicit cleanup of the Yuno SDK (e.g., when a user cancels the flow or you need to remove the SDK from the DOM), use the unmountSdk() method:

PayPal REDIRECT Workflow

The Yuno SDK supports a REDIRECT workflow for PayPal. This workflow is useful when PayPal was not initialized at the start of the SDK or when using a pre-existing PayPal orderId.
  • PaypalButtonModal: If PayPal is not initialized, the SDK can render the PayPal button inside a modal.
  • Workflow: The REDIRECT workflow skips fraud detection and OTT creation, utilizing the provided orderId.

Enrolling payment methods in lite flow

You can enroll payment methods (store cards for future use) directly during the lite payment flow by setting payment_method.vault_on_success = true in the checkout session creation. When vault_on_success is set to true:
  • The payment method will be automatically enrolled if the payment status is SUCCEEDED
  • If the payment does not succeed, no vaulting will occur
  • The payment response will include a vaulted_token that you can use for future transactions
Example:
Vaulting RequirementsTo generate and receive a vaulted_token when vault_on_success = true, the payment must reference an existing Yuno customer through customer_payer.id in the checkout session. Creating or sending the customer data inline inside the payment request does not create the customer on our side, so no vaulting will occur.
For more information about enrolling payment methods, see Enroll Payment Methods.

Error handling

Handle errors returned by the SDK in your app (e.g. failed payments, validation errors). For HTTP status and response codes, see Status and response codes in the API reference.

Stay updated

Visit the changelog for the latest SDK updates and version history.