Full SDK (Web)
Welcome to the Yuno Full SDK (Web) guide. This guide will help you get started with Yuno's payment solutions. Whether you're looking to implement your first payment integration or enhance your existing setup, this guide provides all the information you need to create a seamless payment experience for your users.
Web SDK v1.1 release
v1.1 introduces enhancements to 3DS, performance, security, and user experience. To learn more, visit the Web SDK v1.1 page.
Choose your integration method
Let's help you choose the integration method that best fits your needs. Each approach has specific advantages, and selecting the right one depends on your development environment, technical requirements, and preferences.
- Method 1 (HTML): Add a single script tag to your HTML file. This is the simplest method, ideal for basic implementations and quick prototypes
- Method 2 (Dynamic JavaScript): Load the SDK programmatically with custom error handling and loading states. Best for applications needing more control over the integration
- Method 3 (NPM): Use our NPM package in modern JavaScript applications. This is our recommended approach, with dependency management, tree-shaking, and TypeScript support
1. Add the SDK script directly in HTML
The simplest way to integrate the Yuno SDK is by adding a <script>
tag to your HTML file. This method provides a quick implementation while maintaining proper asynchronous loading. The SDK exposes an event that notifies when it's fully loaded, ensuring you can safely initialize and use its features at the right time.
Important
While the defer
attribute ensures the script is executed after the HTML is parsed, it doesn't guarantee that the SDK script will always load last. In some cases, if the SDK loads faster than expected and the event listener is declared afterward, the yuno-sdk-ready
event may have already fired — and your listener won't catch it. To prevent this, always define the listener before loading the SDK script.
<!-- First, set up the event listener -->
<script>
window.addEventListener('yuno-sdk-ready', () => {
console.log('SDK loaded'); // The SDK is ready to use
await yuno.initialize('publicKey');
});
</script>
<!-- Then load the SDK -->
<script defer src="https://sdk-web.y.uno/v1.1/main.js"></script>
2. Inject the SDK dynamically using JavaScript
The dynamic JavaScript injection method provides enhanced control over SDK loading and initialization. This approach enables you to:
- Load the SDK programmatically when needed
- Implement custom loading states and error handling
- Precisely control when the SDK becomes available
- Synchronize SDK initialization with your application logic
- Create tailored error handling for your use case
This method is ideal when you need granular control over the SDK's loading process and want to handle various scenarios with precision.
file.js
// Function to inject the SDK dynamically
export const injectScript = async (): Promise<boolean> => {
const head = document.getElementsByTagName('head')[0];
const js = document.createElement('script');
js.src = "https://sdk-web.y.uno/v1.1/main.js";
js.defer = true;
// Return a promise that resolves when the SDK is ready
return new Promise((resolve, reject) => {
window.addEventListener('yuno-sdk-ready', () => {
resolve(true); // SDK loaded successfully
});
js.onerror = (error) => {
// Create a custom event in case of loading error
const event = new CustomEvent('yuno-sdk-error', { detail: error });
window.dispatchEvent(event);
reject(new Error(`Failed to load script: ${js.src} - ${error.message}`));
};
head.appendChild(js); // Add the script to the document
});
};
// Using the function to inject the SDK
await injectScript();
// SDK is ready to use
await yuno.initialize('publicKey');
3. Use the NPM module
For projects using NPM package management, you can install the SDK as a module through NPM. This approach provides better dependency management, version control, and seamless integration with modern JavaScript build tools and frameworks. It's particularly beneficial for applications using bundlers like webpack, Rollup, or Vite.
npm install @yuno-payments/sdk-web
Then, load and initialize the SDK as follows:
// Import the SDK module from npm
import { loadScript } from '@yuno-payments/sdk-web';
// Load and initialize the SDK
const yuno = await loadScript();
// Initialize the SDK with the public key
await yuno.initialize('publicKey');
Improve performance using preconnect
preconnect
To optimize performance and reduce latency, we recommend adding preconnect
links as early as possible within the <head>
tag of your HTML document. These links allow browsers to quickly connect to our servers before resources are actually requested. This proactive approach can significantly improve loading times, especially for the initial SDK setup and subsequent API calls.
<!-- Improve performance with preconnect -->
<link rel="preconnect" href="https://sdk-web.y.uno" />
<link rel="preconnect" href="https://api.y.uno" />
<link rel="preconnect" href="https://sdk-web-card.prod.y.uno" />
Full SDK implementation
After integrating the SDK using one of the methods described above, follow these steps to implement the full checkout functionality:
Follow this step-by-step guide to implement and enable Yuno's Full Web SDK functionality in your application.
Step 1: Include the library in your project
After completing the SDK integration, you can proceed with the following steps to implement the full checkout functionality.
TypeScript library
If you are using TypeScript, Yuno provides a library to see all methods available in the Yuno Web SDK.
Step 2: Initialize SDK with the public key
In your JavaScript application, create an instance of the Yuno
class by providing a valid PUBLIC_API_KEY. Check the Get your API credentials guide.
Like the example below, use the initialized class that is attributed to the yuno
constant.
const yuno = await Yuno.initialize(PUBLIC_API_KEY)
Step 3: Start the checkout process
To start the checkout, you'll use the function yuno.startCheckout
, providing the necessary parameters.
The following table lists all required parameters and their descriptions. For optional parameters, go to Complementary Features.
Parameter | Description |
---|---|
checkoutSession | Refers to the current payment's checkout session.Example: '438413b7-4921-41e4-b8f3-28a5a0141638' |
countryCode | This parameter specifies the country for which the payment process is being set up. Use an ENUM value representing the desired country code. You can find the full list of supported countries and their corresponding codes 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), pt (Portuguese), fil (Filipino), id (Indonesian), ms (Malay), or th (Thai). |
onLoading | Required to receive notifications about server calls or loading events during the payment process. |
showLoading | Control the visibility of the Yuno loading/spinner page during the payment process. By default, it's true . |
issuersFormEnable | Enables the issuer's form. By default, it's true . |
showPaymentStatus | Shows the Yuno Payment Status page. You can use this option when continuing a payment as well. By default, it's true . |
card.isCreditCardProcessingOnly | Enables you to ensure that all card transactions are processed as credit only. This option is helpful in markets where cards can act as both credit and debit. To enable, set the isCreditCardProcessingOnly to true to ensure that all card transactions are processed as credit.This parameter is not required. |
yuno.startCheckout({
checkoutSession: '438413b7-4921-41e4-b8f3-28a5a0141638',
/**
* The complete list of country codes is available on https://docs.y.uno/docs/country-coverage-yuno-sdk
*/
country_code: "FR",
language: 'fr',
showLoading: true,
issuersFormEnable: true,
showPaymentStatus: true,
/**
* Set isCreditCardProcessingOnly as true to process all card transactions are credit
* isCreditCardProcessingOnly: true | false | undefined
*/
card: {
isCreditCardProcessingOnly: true,
},
onLoading: (args) => {
console.log(args);
},
/**
* Notifies when a payment method is selected
*/
yunoPaymentMethodSelected: () => {
console.log('Payment method selected');
},
/**
* Returns the payment result after continuePayment
* @param {string} status - The payment status
*/
yunoPaymentResult: (status) => {
console.log('Payment result:', status);
},
/**
* Executes when there are errors
* @param {string} message - Error message
* @param {any} data - Additional error data
*/
yunoError: (message, data) => {
console.error('Payment error:', message, data);
},
async yunoCreatePayment(oneTimeToken) {
/**
* The createPayment function calls the backend to create a payment in Yuno.
* It uses the following endpoint https://docs.y.uno/reference/create-payment
*/
await createPayment({ oneTimeToken, checkoutSession })
yuno.continuePayment({ showPaymentStatus: true })
},
})
Rendering mode
By default, Yuno SDK renders as a modal. However, you can specify the element where the SDK will render. For additional information, access the Render mode under the complementary complementary features page.
Step 4: Mount the SDK
Display the payment methods by using the function yuno.mountCheckout()
by selecting an HTML element and using a valid CSS selector (#
, .
, [data-*]
)
/**
* Mount checkout in browser DOM
*/
yuno.mountCheckout()
If you want to set a default payment method, use the following code to mount it:
/**
* Mount checkout in browser DOM with a payment method selected by default
* @optional
*/
yuno.mountCheckout({
/**
* Optional, only needed if you would like this method type selected by default
* Can be one of 'PAYPAL' | 'PIX' | 'APPLE_PAY' | 'GOOGLE_PAY' | CARD
*/
paymentMethodType: PAYMENT_METHOD_TYPE,
/**
* Optional
* Vaulted token related to payment method type
*/
vaultedToken: VAULTED_TOKEN,
})
Step 5: Initiate the payment process
After the user has selected a payment method remember to call yuno.startPayment()
to initiate the payment flow. Below you will find an example where yuno.startPayment()
is called when the user clicks on button-pay
:
const PayButton = document.querySelector('#button-pay')
PayButton.addEventListener('click', () => {
yuno.startPayment()
})
Step 6: Get the OTT (one-time token)
Once the customer fills out the requested data in Yuno's payment forms, the SDK provides the one-time token. The configuration function yuno.CreatePayment(oneTimeToken)
is then triggered with the one-time token.
yunoCreatePayment(oneTimeToken)
You can also use tokenWithInformation to receive any additional info given by the customer in the checkout such as installments or document type/number.
yunoCreatePayment(oneTimeToken, tokenWithInformation)
Important
The merchant is responsible for managing the loader. Yuno provides a default loader option, but merchants may implement their own loader if preferred. In that case, they are responsible for making the necessary configurations.
Step 7: Create the Payment
Once the previous steps are complete, you can proceed to create a payment. Back-to-back payment creation must be performed using the Create Payment endpoint. The merchant's backend should call this endpoint to create the payment in Yuno using the one-time token and checkout session.
Complete the integration
After Step 7, you can complete the end-to-end integration by accessing Step by Step integration of the Full SDK.
Continue method
After creating a payment, Yuno requires you to integrate the continuePayment
method from the SDK. This is necessary because some asynchronous payment methods require additional customer actions to complete the process. The API response will indicate this scenario by setting the sdk_action_required
field to true. When this occurs, you must call yuno.continuePayment()
, which will automatically present the necessary screens to the customer, allowing them to complete the payment flow without requiring you to handle each case manually.
continuePayment
return value or null
continuePayment
return value or nullFor payment methods that require merchant-side action (e.g., when the payment provider requires a redirect URL in a webview), the await yuno.continuePayment()
method will return either an object with the following structure or null:
{
action: 'REDIRECT_URL'
type: string
redirect: {
init_url: string
success_url: string
error_url: string
}
} | null
When the method returns an object, it allows you to handle your application's payment flows that require custom redirect handling. When it returns null, no additional merchant-side action is needed.
Step 8: Get payment status
Call the yunoPaymentResult()
function to obtain the payment status
. Based on the status, you can show your customer the corresponding screen depending on the final result of the payment.
Step 9: Receive payment result through webhook
Yuno also recommends configuring Webhooks in your dashboard. Webhooks are the best way to ensure your system is up-to-date with payment progress and status. Since the event notifications trigger automatically, your system won't need to perform recurrent requests to Yuno.
Demo App
In addition to the code examples provided, you can access the Demo App for a complete implementation of Yuno SDKs or go directly to the HTML and JavaScript checkout demos available on GitHub.
Complementary features
Yuno Web SDK provides additional services and configurations you can use to improve customers' experience:
Form loader
Control the use of the loader.
Parameter | Description |
---|---|
showLoading | You can hide or show the Yuno loading/spinner page. Enabling this option ensures that the loading component remains displayed until either the hideLoader() or continuePayment() function is called.The default value is true. |
yuno.startCheckout({
showLoading: true,
})
Form of the issuer
Parameter | Description |
---|---|
issuersFormEnable | Through this parameter, you can configure the SDK to enable the issuer's form (bank list). |
yuno.startCheckout({
issuersFormEnable: true,
})
Mode of form rendering
Parameter | Description |
---|---|
renderMode | This parameter is optional. It determines the mode in which the payment forms will be displayed. - type : can be one of modal or element .- elementSelector : Element where the form will be rendered. Only required if type is element . |
elementSelector | Required only if the type is element . Specifies the HTML elements where you want to mount the Yuno SDK. You can specify the elements using one of the following options:- String (Deprecated): Provide the ID or selector of the element where the SDK should be mounted. - Object: Specify the elements for mounting the APM and action forms. You need to provide the element for the apmForm , which is where the APM is displayed, and the element for the actionForm , where the Continue Payment button appears. This button triggers a modal that shows the steps to complete a payment with a provider. For example, with PIX, it displays a QR code. |
yuno.startCheckout({
renderMode: {
/**
* Type can be one of `modal` or `element`
* By default the system uses 'modal'
* It is optional
*/
type: 'modal',
/**
* Element where the form will be rendered.
* It is optional
* Can be a string (deprecated) or an object with the following structure:
* {
* apmForm: "#form-element",
* actionForm: "#action-form-element"
* }
*/
elementSelector: {
apmForm: "#form-element",
actionForm: "#action-form-element"
}
},
})
Card form configurations
Parameter | Description |
---|---|
card | Define specific settings for the credit card form: - type : step or extends - styles : You can edit card form styles. Only you should write css, then it will be injected into the iframe.- cardSaveEnable : Show checkbox for save/enroll card. The default value is false.- texts : Custom texts in the Card forms buttons. |
yuno.startCheckout({
card: {
type: "extends",
styles: '',
cardSaveEnable: false,
texts: {}
},
})
Save card for future payments
In addition, you can display a checkbox for saving or enrolling cards using the cardSaveEnable: true
. Below are examples of the checkbox for both card form renders.

Rendering modes
Below you find screenshots presenting the difference between the following:
- Render modes
modal
andelements
for the payment method list - Render modes
step
andextends
for the credit card form

You also can choose one of the render options for the card form, step
and extends
:

Text payment form buttons
Parameter | Description |
---|---|
texts | Provide custom text for payment form buttons to match your application's language or branding. |
yuno.startCheckout({
texts: {
customerForm?: {
submitButton?: string;
}
paymentOtp?: {
sendOtpButton?: string;
}
}
})
Persist credit card form to retry payments
If a transaction is rejected, you can use the credit card form to retry a payment after the customer has entered the credit card details. To do that, you will need to:
- Add the following parameter while initializing the SDK to persist the credit card form after the one-time use token is created:
yuno.startCheckout({ automaticallyUnmount: false, })
- In case the transaction is rejected, you will need to:
- Execute the method
yuno.notifyError()
to delete the previously entered CVV for the first transaction - Create a new checkout session and update the SDK with the new one by executing
yuno.updateCheckoutSession(checkoutsession)
- Execute the method
- Continue with the new checkout and one-time use token with the regular payment flow.
Hide Pay button
You can hide the Pay button when presenting the card or customer data form. To control this feature, you'll set showPayButton
to false
when starting the checkout with the startCheckout
function. The code block below presents an example of how to hide the payment button:
yuno.startCheckout({
/**
* Hide (false) or show (true) the customer or card form pay button
* @default true
* @optional
*/
showPayButton: false,
})
The following images present examples of the Customer Data Form with and without the Pay button:

The following images present examples of the Card Form with and without the Pay button:

If you hide the Pay button, you will need to start the one-time token creation through your code. To create the one-time token and continue the payment in your backend, call the submitOneTimeTokenForm
function. The code block below presents how to use the submitOneTimeTokenForm
function.
/**
* This function triggers the same functionality that is called when the customer clicks on the pay form button. This doesn't work on the step Card form
*/
yuno.submitOneTimeTokenForm()
What's next?
Learn about the additional configurations from the Full SDK accessing Complementary Features. You can also access other functions available on the Yuno Web SDK:
- SDK Customizations: Change the SDK appearance to match your brand
- Payment Status: Update the user about the payment process
- 3DS Setup SDK: Integrate 3DS into your payment flow
Below, we outline the step-by-step process to enable the full Web SDK functionalities in your system:
Step 1: Include the library in your project
Ensure the Yuno SDK file is included in your webpage before closing the <body>
tag. Refer to the example below:
<script src="https://sdk-web.y.uno/v1/static/js/main.min.js"></script>
TypeScript library
If you are using TypeScript, Yuno provides a library to see all methods available in the Yuno Web SDK.
Step 2: Initialize SDK with the public key
In your JavaScript application, create an instance of the Yuno
class by providing a valid PUBLIC_API_KEY. Check the Get your API credentials guide.
Like the example below, use the initialized class that is attributed to the yuno
constant.
const yuno = Yuno.initialize(PUBLIC_API_KEY)
Step 3: Start the checkout process
To start the checkout, you'll use the function yuno.startCheckout
, providing the necessary parameters.
The following table lists all required parameters and their descriptions. For optional parameters, go to Complementary Features.
Parameter | Description |
---|---|
checkoutSession | Refers to the current payment's checkout session.Example: '438413b7-4921-41e4-b8f3-28a5a0141638' |
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), pt (Portuguese), fil (Filipino), id (Indonesian), ms (Malay), or th (Thai). |
onLoading | Required to receive notifications about server calls or loading events during the payment process. |
showLoading | Control the visibility of the Yuno loading/spinner page during the payment process. By default, it's true . |
issuersFormEnable | Enables the issuer's form. By default, it's true . |
showPaymentStatus | Shows the Yuno Payment Status page. You can use this option when continuing a payment as well. By default, it's true . |
card.isCreditCardProcessingOnly | Enables you to ensure that all card transactions are processed as credit only. This option is helpful in markets where cards can act as both credit and debit. To enable, set the isCreditCardProcessingOnly to true to ensure that all card transactions are processed as credit.This parameter is not required. |
yuno.startCheckout({
checkoutSession: '438413b7-4921-41e4-b8f3-28a5a0141638',
/**
* The complete list of country codes is available on https://docs.y.uno/docs/country-coverage-yuno-sdk
*/
country_code: "FR",
language: 'fr',
showLoading: true,
issuersFormEnable: true,
showPaymentStatus: true,
/**
* Set isCreditCardProcessingOnly as true to process all card transactions are credit
* isCreditCardProcessingOnly: true | false | undefined
*/
card: {
isCreditCardProcessingOnly: true,
},
onLoading: (args) => {
console.log(args);
},
/**
* Notifies when a payment method is selected
*/
yunoPaymentMethodSelected: () => {
console.log('Payment method selected');
},
/**
* Returns the payment result after continuePayment
* @param {string} status - The payment status
*/
yunoPaymentResult: (status) => {
console.log('Payment result:', status);
},
/**
* Executes when there are errors
* @param {string} message - Error message
* @param {any} data - Additional error data
*/
yunoError: (message, data) => {
console.error('Payment error:', message, data);
},
async yunoCreatePayment(oneTimeToken) {
/**
* The createPayment function calls the backend to create a payment in Yuno.
* It uses the following endpoint https://docs.y.uno/reference/create-payment
*/
await createPayment({ oneTimeToken, checkoutSession })
yuno.continuePayment({ showPaymentStatus: true })
},
})
Rendering mode
By default, Yuno SDK renders as a modal. However, you can specify the element where the SDK will render. For additional information, access the Render mode under the complementary complementary features page.
Step 4: Mount the SDK
Display the payment methods by using the function yuno.mountCheckout()
by selecting an HTML element and using a valid CSS selector (#
, .
, [data-*]
)
/**
* Mount checkout in browser DOM
*/
yuno.mountCheckout()
If you want to set a default payment method, use the following code to mount it:
/**
* Mount checkout in browser DOM with a payment method selected by default
* @optional
*/
yuno.mountCheckout({
/**
* Optional, only needed if you would like this method type selected by default
* Can be one of 'PAYPAL' | 'PIX' | 'APPLE_PAY' | 'GOOGLE_PAY' | CARD
*/
paymentMethodType: PAYMENT_METHOD_TYPE,
/**
* Optional
* Vaulted token related to payment method type
*/
vaultedToken: VAULTED_TOKEN,
})
Step 5: Initiate the payment process
After the user has selected a payment method remember to call yuno.startPayment()
to initiate the payment flow. Below you will find an example where yuno.startPayment()
is called when the user clicks on button-pay
:
const PayButton = document.querySelector('#button-pay')
PayButton.addEventListener('click', () => {
yuno.startPayment()
})
Step 6: Get the OTT (One Time Token)
Once the customer fills out the requested data in Yuno's payment forms, the SDK provides the OTT. The configuration function yuno.CreatePayment(oneTimeToken)
is then triggered with the OTT (One Time Token).
yunoCreatePayment(oneTimeToken)
You can also use tokenWithInformation to receive any additional info given by the customer in the checkout such as installments or document type/number.
yunoCreatePayment(oneTimeToken, tokenWithInformation)
Important
The merchant is responsible for handling the loader. Yuno offers an option to use our loader; however, the merchant can use their own loader and must make the corresponding configurations.
Step 7: Create the Payment
Once you have completed the steps described before, you can create a payment. The back-to-back payment creation must be carried out using the Create Payment endpoint. The merchant should call their backend to create the payment within Yuno, using the OTT (One Time Token) and the checkout session.
Complete the integration
After Step 7, you can complete the end-to-end integration by accessing Step by Step integration of the Full SDK.
Continue method
Yuno recommends you integrate the continuePayment
method of the SDK after the payment is created because certain asynchronous payment methods require additional action from the customer to complete it. The API will inform you of this scenario via the sdk_action_required
field of the response, which will be returned as true. The yuno.continuePayment()
function will display the additional screens to the customers, where they can carry out the necessary actions to complete the payment. Otherwise, this step is not necessary.
Demo App
In addition to the code examples provided, you can access the Demo App for a complete implementation of Yuno SDKs or go directly to the HTML and JavaScript checkout demos available on GitHub.
What's next?
Learn about the additional configurations from the Full SDK accessing Complementary Features. You can also access other functions available on the Yuno Web SDK:
- SDK Customizations: Change the SDK appearance to match your brand.
- Payment Status: Update the user about the payment process.
- 3DS Setup SDK: Integrate 3DS into your payment flow.
Updated 3 days ago