### Start the Yuno SDK Web Project Source: https://docs.y.uno/docs/how-yuno-works/step-2-your-first-payment Run the Yuno SDK web project locally. After installation, use this command to start the development server. ```shell npm start ``` -------------------------------- ### Full Web SDK Initialization with External Buttons Source: https://docs.y.uno/docs/sdks/resources/references/web Demonstrates initializing the Web SDK with various external payment options including Google Pay, Apple Pay, and PayPal. This example shows how to configure each button's appearance and behavior. ```javascript const yuno = await window.Yuno.initialize(publicApiKey) await yuno.startCheckout({ checkoutSession, elementSelector: '#root', countryCode: 'CO', language: 'es', externalButtons: { googlePay: { buttonColor: 'black', buttonType: 'pay', buttonRadius: 4, buttonSizeMode: 'fill', }, applePay: { buttonType: 'buy', buttonStyle: 'black', buttonBorderRadius: 4, }, paypal: { color: 'blue', shape: 'rect', label: 'pay', height: 45, borderRadius: 4, }, }, // ... rest of config }) ``` -------------------------------- ### Get Installments Plans by Account Source: https://docs.y.uno/reference/installments/get-installments-plan-by-account This example demonstrates how to retrieve installment plans using the `get-installments-plan-by-account` operation. ```APIDOC ## GET /installments-plans ### Description Retrieves a list of installment plans available for a specific account. This endpoint supports filtering by account ID, currency, IIN, amount, and payment method type. ### Method GET ### Endpoint /installments-plans ### Parameters #### Query Parameters - **account_id** (string) - Required - The unique identifier of the account. Find it on the [Yuno dashboard](https://dashboard.y.uno) (UUID; 36 chars). - **currency** (string) - Optional - Currency used for filtering plans ([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217); 3 chars). - **iin** (string) - Optional - The issuer identification number (IIN) refers to the first few digits of a payment card number issued by a financial institution (MAX 8; MIN 6). In case you defined an iin for the installments plan, you can use it to filter the response. - **amount** (string) - Optional - The amount that the installment plan is available for. In case you defined an amount range for the installments plan, you can use it to filter the response. - **payment_method_type** (string) - Optional - Filter by payment method type (CARD | NU_PAY_ENROLLMENT). ### Response #### Success Response (200) - **id** (string) - The unique identifier of the installment plan. - **name** (string) - The name of the installment plan. - **account_id** (array of strings) - The account IDs associated with the plan. - **merchant_reference** (string) - A reference identifier for the merchant. - **installments_plan** (array of objects) - Details about each installment option. - **installment** (integer) - The number of installments. - **rate** (integer) - The interest rate for the installment. - **provider_id** (string) - The provider's identifier for the installment plan. - **financial_costs** (array of objects) - Financial costs associated with the installment. - **type** (string) - The type of financial cost (e.g., CFT, TEA). - **rate** (number) - The rate of the financial cost. - **formatted_value** (string) - The formatted value of the financial cost. - **amount** (object) - The amount details for the installment. - **currency** (string) - The currency of the amount. - **value** (string) - The base value of the installment. - **total_value** (string) - The total value including interest. - **iin** (string or null) - The IIN associated with the plan, or null if not applicable. - **country_code** (string) - The country code where the plan is applicable. - **first_installment_deferral** (integer) - The number of days before the first installment is due. - **amount** (object) - The overall amount range for which the installment plan is available. - **Currency** (string) - The currency of the amount range. - **min_value** (integer) - The minimum transaction amount. - **max_value** (integer) - The maximum transaction amount. - **availability** (object) - The availability period for the installment plan. - **start_at** (string) - The start date of availability (ISO 8601 format). - **finish_at** (string) - The end date of availability (ISO 8601 format). - **created_at** (string) - The timestamp when the plan was created (ISO 8601 format). - **updated_at** (string) - The timestamp when the plan was last updated (ISO 8601 format). - **payment_method_type** (string) - The type of payment method associated with the plan. #### Response Example ```json [ { "id": "4d573425-33f9-4c46-b009-2c7e749b0ec7", "name": "plan_007", "account_id": [ "f7c5fe77-721b-49c2-84d3-957748df3c2c" ], "merchant_reference": "Test", "installments_plan": [ { "installment": 1, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 3, "rate": 1, "provider_id": "", "financial_costs": [ { "type": "CFT", "rate": 45.25, "formatted_value": "45,25%" }, { "type": "TEA", "rate": 38.5, "formatted_value": "38,50%" } ], "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 6, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 9, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 12, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } } ], "iin": null, "country_code": "US", "first_installment_deferral": 0, "amount": { "Currency": "USD", "min_value": 0, "max_value": 100000000 }, "availability": { "start_at": "2023-09-12T00:00:00Z", "finish_at": "2030-09-20T00:00:00Z" }, "created_at": "2023-10-11T17:52:31.886178Z", "updated_at": "2023-10-11T17:52:31.886178Z", "payment_method_type": "NU_PAY_ENROLLMENT" } ] ``` ``` -------------------------------- ### Create Customer (Full Data) Source: https://docs.y.uno/reference/customers/create-customer Use this example to create a customer with all available fields. Ensure all required fields are populated correctly. ```json { "merchant_customer_id": "4321", "merchant_customer_created_at": "2022-05-09T20:46:54.786342Z", "first_name": "John", "last_name": "Doe", "email": "john.doe@email.com", "gender": "M", "date_of_birth": "1990-02-28", "nationality": "US", "country": "US", "document": { "document_type": "SSN", "document_number": "123-45-6789" }, "phone": { "number": "5551234567", "country_code": "1" }, "billing_address": { "address_line_1": "123 Main St", "address_line_2": "Apt 4B", "country": "US", "state": "NY", "city": "New York", "zip_code": "10001", "neighborhood": "Manhattan" }, "shipping_address": { "address_line_1": "123 Main St", "address_line_2": "Apt 4B", "country": "US", "state": "NY", "city": "New York", "zip_code": "10001", "neighborhood": "Manhattan" }, "metadata": [ { "key": "ID", "value": "123456" } ] } ``` -------------------------------- ### Update Plan Example Source: https://docs.y.uno/reference/installments/update-plan This example demonstrates how to update an installment plan with various configurations including installment details, financial costs, and availability. ```APIDOC ## Update Plan ### Description Updates an existing installment plan with new configurations. ### Method PUT ### Endpoint /plans/{plan_id} ### Request Body - **name** (string) - Required - The name of the installment plan. - **account_id** (array of strings) - Required - The account IDs associated with the plan. - **merchant_reference** (string) - Required - A unique reference for the merchant. - **installments_plan** (array of objects) - Required - Details of the installment options. - **installment** (integer) - Required - The number of installments. - **rate** (number) - Required - The interest rate for the installment. - **financial_costs** (array of objects) - Optional - Financial costs associated with the installment. - **type** (string) - Required - The type of financial cost (e.g., CFT, TEA). - **rate** (number) - Required - The rate of the financial cost. - **formatted_value** (string) - Optional - The formatted value of the financial cost. - **provider_id** (string) - Optional - The ID of the provider. - **type** (string) - Optional - The type of the plan. - **source** (string) - Optional - The source of the plan. - **provider_id** (string) - Optional - The ID of the provider. - **scheme** (string) - Optional - The payment scheme (e.g., VISA). - **brand** (array of strings) - Optional - The brands accepted (e.g., VISA, MASTERCARD). - **issuer** (string) - Optional - The issuer of the card. - **iin** (array of strings) - Optional - The Issuer Identification Numbers. - **first_installment_deferral** (integer) - Optional - The number of months to defer the first installment. - **amount** (object) - Optional - The available amounts for the installment plan. - **currency** (string) - Required - The currency used (ISO 4217). - **min_value** (number) - Optional - The minimum amount for the installment plan. - **max_value** (number) - Optional - The maximum amount for the installment plan. - **availability** (object) - Optional - The availability dates for the installment plan. - **start_at** (string) - Required - The start date for availability (ISO 8601 format). - **finish_at** (string) - Required - The end date for availability (ISO 8601 format). - **country_code** (string) - Optional - The country code. ### Request Example ```json { "name": "Plan Update", "account_id": [ "{{account_id}}" ], "merchant_reference": "REF01", "installments_plan": [ { "installment": 3, "rate": 1.05, "financial_costs": [ { "type": "CFT", "rate": 15.5 } ], "type": "MERCHANT_INSTALLMENTS" }, { "installment": 6, "rate": 1.1 }, { "installment": 12, "rate": 1.2 } ], "country_code": "US", "scheme": "VISA", "brand": [ "VISA", "MASTERCARD" ], "issuer": "JPMORGAN CHASE BANK", "iin": [ "411111", "542418" ], "first_installment_deferral": 1, "amount": { "currency": "USD", "min_value": 50, "max_value": 10000 }, "availability": { "start_at": "2024-01-01T00:00:00.000Z", "finish_at": "2024-12-31T23:59:59.999Z" } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the updated installment plan. - **name** (string) - The name of the installment plan. - **account_id** (array of strings) - The account IDs associated with the plan. - **merchant_reference** (string) - A unique reference for the merchant. - **installments_plan** (array of objects) - Details of the installment options. - **installment** (integer) - The number of installments. - **rate** (number) - The interest rate for the installment. - **provider_id** (string) - The ID of the provider. - **financial_costs** (array of objects) - Financial costs associated with the installment. - **type** (string) - The type of financial cost. - **rate** (number) - The rate of the financial cost. - **formatted_value** (string) - The formatted value of the financial cost. - **type** (string) - The type of the plan. - **source** (string) - The source of the plan. - **provider_id** (string) - The ID of the provider. - **scheme** (string) - The payment scheme. - **brand** (array of strings) - The brands accepted. #### Response Example ```json { "id": "4d573425-33f9-4c46-b009-2c7e749b0ec7", "name": "plan_007", "account_id": [ "f7c5fe77-721b-49c2-84d3-957748df3c2c" ], "merchant_reference": "Test", "installments_plan": [ { "installment": 1, "rate": 1, "provider_id": "" }, { "installment": 3, "rate": 1, "provider_id": "", "financial_costs": [ { "type": "CFT", "rate": 45.25, "formatted_value": "45,25%" }, { "type": "TEA", "rate": 38.5, "formatted_value": "38,50%" } ] }, { "installment": 6, "rate": 1, "provider_id": "" }, { "installment": 9, "rate": 1, "provider_id": "" }, { "installment": 12, "rate": 1, "provider_id": "" } ], "type": "", "source": "", "provider_id": "", "scheme": "", "brand": [ "VISA" ] } ``` ``` -------------------------------- ### Get Installments Plan Source: https://docs.y.uno/llms.txt Retrieve details of an installments plan. ```APIDOC ## Get Installments Plan ### Description Fetches the details of a specific installments plan. ### Method GET ### Endpoint /installments/plan/{plan_id} ### Parameters #### Path Parameters - **plan_id** (string) - Required - The ID of the installments plan to retrieve. ### Response (Schema defined in OpenAPI spec) ``` -------------------------------- ### Async Initialization and Checkout Source: https://docs.y.uno/changelog/web Use `await` with `Yuno.initialize()` and `yuno.startCheckout()` as these methods now return Promises. Synchronous usage is deprecated. ```js const yuno = await Yuno.initialize(PUBLIC_API_KEY); await yuno.startCheckout(config); ``` -------------------------------- ### Get Installments Plan by Account Source: https://docs.y.uno/reference/installments/get-installments-plan-by-account Fetches the installments plan for a specified account. ```APIDOC ## GET /installments/plan ### Description Retrieves the installments plan details for a given account. ### Method GET ### Endpoint /installments/plan ### Query Parameters - **account_id** (array[string]) - Required - The ID of the account for which to retrieve the installments plan. - **merchant_reference** (string) - Optional - A reference identifier for the merchant. - **country_code** (string) - Optional - The country code for filtering installment plans. - **first_installment_deferral** (integer) - Optional - Specifies the deferral period for the first installment. ### Response #### Success Response (200) - **installments_plan** (array[object]) - A list of available installment plans. - **installment** (integer) - The number of installments. - **rate** (integer) - The interest rate for the installment plan. - **provider_id** (string) - The ID of the installment provider. - **financial_costs** (array[object]) - A list of financial costs associated with the installment plan. - **type** (string) - The type of financial cost (e.g., CFT, TEA, CET, CAT). - **rate** (number) - The rate of the financial cost. - **formatted_value** (string) - The formatted value of the financial cost. - **amount** (object) - The amount details for the installment. - **currency** (string) - The currency of the amount. - **value** (string) - The value of the amount. - **total_value** (string) - The total value of the amount. - **iin** (object) - Information related to Issuer Identification Number (IIN). - **country_code** (string) - The country code associated with the installment plan. - **first_installment_deferral** (integer) - The deferral period for the first installment. - **amount** (object) - General amount details for the transaction. - **Currency** (string) - The currency of the amount. - **min_value** (integer) - The minimum transaction value. - **max_value** (integer) - The maximum transaction value. - **availability** (object) - The availability period for the installment plan. - **start_at** (string) - The start date of availability. - **finish_at** (string) - The end date of availability. - **created_at** (string) - The timestamp when the installment plan was created. - **updated_at** (string) - The timestamp when the installment plan was last updated. - **payment_method_type** (string) - The type of payment method. #### Error Response (400) - **code** (string) - Error code (e.g., INVALID_REQUEST). - **messages** (array[string]) - A list of error messages. ``` -------------------------------- ### Update Installment Plan Example Source: https://docs.y.uno/reference/installments/update-plan Use this example to update an existing installment plan. It includes details for name, account ID, merchant reference, installment options with rates and financial costs, country code, scheme, brand, issuer, IIN, first installment deferral, amount limits, and availability dates. ```json { "name": "Plan Update", "account_id": [ "{{account_id}}" ], "merchant_reference": "REF01", "installments_plan": [ { "installment": 3, "rate": 1.05, "financial_costs": [ { "type": "CFT", "rate": 15.5 } ], "type": "MERCHANT_INSTALLMENTS" }, { "installment": 6, "rate": 1.1 }, { "installment": 12, "rate": 1.2 } ], "country_code": "US", "scheme": "VISA", "brand": [ "VISA", "MASTERCARD" ], "issuer": "JPMORGAN CHASE BANK", "iin": [ "411111", "542418" ], "first_installment_deferral": 1, "amount": { "currency": "USD", "min_value": 50, "max_value": 10000 }, "availability": { "start_at": "2024-01-01T00:00:00.000Z", "finish_at": "2024-12-31T23:59:59.999Z" } } ``` -------------------------------- ### Install Yuno Web SDK via NPM Source: https://docs.y.uno/docs/sdks/full-checkout/web-payments Install the SDK package using npm. This is the recommended method for integration. ```bash npm install @yuno-payments/sdk-web ``` -------------------------------- ### Before: Synchronous SDK Calls Source: https://docs.y.uno/changelog/migration-guides/web/v1-0-to-v1-1 Illustrates the older, synchronous way of initializing and mounting/starting checkout in v1.0. ```javascript const yuno = Yuno.initialize(publicApiKey, config) yuno.mountCheckout({ checkoutSession, elementSelector: '#root', countryCode: 'US' }) yuno.startCheckout({ checkoutSession, countryCode: 'US' }) ``` -------------------------------- ### Get Installments Plan by Account Source: https://docs.y.uno/llms.txt Retrieve installments plans associated with a specific account. ```APIDOC ## Get Installments Plan by Account ### Description Lists all installments plans linked to a particular account. ### Method GET ### Endpoint /installments/account/{account_id} ### Parameters #### Path Parameters - **account_id** (string) - Required - The ID of the account to retrieve plans for. ### Response (Schema defined in OpenAPI spec) ``` -------------------------------- ### Create Payment Link Example Source: https://docs.y.uno/reference/payment-links/create-payment-link This example demonstrates how to construct a payment link request. Ensure all required fields are populated correctly. ```json { "account_id": "493e9374-510a-4201-9e09-de669d75f256", "description": "Test", "country": "AR", "merchant_order_id": "AA01", "amount": { "value": 5000, "currency": "ARS" }, "payment_method_types": [ "CARD" ], "availability": { "start_at": "2023-01-15T14:00:12Z", "finish_at": "2023-12-29T14:00:12Z" } } ``` -------------------------------- ### Get Installments Plans by Account Source: https://docs.y.uno/llms.txt Retrieves a list of installments plans associated with a specific account. ```APIDOC ## Get Installments Plans by Account ### Description Retrieves installments plans for a given account. ### Method GET ### Endpoint /installments/plans/account/{account_id} ``` -------------------------------- ### Get Installments Plan by Account Source: https://docs.y.uno/reference/installments/get-installments-plan-by-account Fetches all installment plans available under a particular account ID. ```APIDOC ## Get Installments Plan by Account ### Description Retrieves a list of installment plans associated with a specific account. ### Method GET ### Endpoint `/accounts/{accountId}/installments/plans` ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account for which to retrieve installment plans. ### Response #### Success Response (200) - **plans** (array) - A list of installment plans. - **planId** (string) - The unique identifier for the installment plan. - **name** (string) - The name of the installment plan. - **installments** (integer) - The number of installments available. - **interestRate** (number) - The interest rate for the plan. - **minAmount** (number) - The minimum purchase amount for this plan. - **maxAmount** (number) - The maximum purchase amount for this plan. - **startDate** (string) - The start date when the plan is available. - **endDate** (string) - The end date when the plan is available. #### Response Example ```json { "plans": [ { "planId": "plan_123", "name": "3 Installments", "installments": 3, "interestRate": 0.0, "minAmount": 100.0, "maxAmount": 1000.0, "startDate": "2023-01-01", "endDate": "2023-12-31" } ] } ``` ``` -------------------------------- ### Initialize Yuno with Optional Options Source: https://docs.y.uno/changelog/migration-guides/web/v1-1-to-v1-2 Demonstrates the `Yuno.initialize()` method. The first example shows the v1.1 syntax, which remains valid in v1.2. The second example illustrates the v1.2 syntax, including the new optional `options` parameter. ```javascript // v1.1 — still valid in v1.2 const yuno = await Yuno.initialize(publicApiKey) ``` ```javascript // v1.2 — optional options parameter const yuno = await Yuno.initialize(publicApiKey, { // additional options here }) ``` -------------------------------- ### Install Yuno Web SDK Source: https://docs.y.uno/docs/sdks/overview/quickstart Install the Yuno Web SDK using npm or include it via CDN. ```bash npm install @yuno-payments/sdk-web ``` ```html ``` -------------------------------- ### Get Installments Plan by ID Source: https://docs.y.uno/reference/installments/get-installments-plan Fetches detailed information about a specific installment plan using its ID. ```APIDOC ## Get Installments Plan by ID ### Description Retrieves detailed information about an existing installment plan, including its installment options, billing frequency, amount limits, and other relevant details. ### Method GET ### Endpoint `/installments/plans/{planId}` ### Parameters #### Path Parameters - **planId** (string) - Required - The unique identifier of the installment plan. ``` -------------------------------- ### Start Enrollment Process Source: https://docs.y.uno/docs/sdks/card-enrollment/ios-enrollment Call this method to initiate the card enrollment flow. The SDK will present a full-screen UI modally. ```APIDOC ## Start Enrollment Process ### Description Initiates the Yuno card enrollment flow. This method presents a full-screen UI modally using the provided delegate. ### Method Signature `Yuno.enrollPayment(with delegate: YunoEnrollmentDelegate, showPaymentStatus: Bool)` ### Parameters - **delegate** (YunoEnrollmentDelegate) - Required - The delegate object that handles enrollment callbacks. - **showPaymentStatus** (Bool) - Required - Whether to display status views during the enrollment process. If `true`, the SDK displays default status screens. If `false`, you handle status display through callbacks. ``` -------------------------------- ### Get Installments Plan by ID Source: https://docs.y.uno/reference/installments/get-installments-plan Fetches a specific installments plan using its code. This operation is useful for retrieving detailed information about available payment plans for a given installment code. ```APIDOC ## GET /installments-plans/{installment_code} ### Description Retrieves the details of an installments plan using its unique identifier. ### Method GET ### Endpoint /installments-plans/{installment_code} ### Parameters #### Path Parameters - **installment_code** (string) - Required - Identifier of the installment plan. #### Response #### Success Response (200) - **id** (string) - The unique identifier of the installment plan. - **name** (string) - The name of the installment plan. - **account_id** (array of strings) - A list of account identifiers associated with the plan. - **merchant_reference** (string) - A reference identifier for the merchant. - **installments_plan** (array of objects) - A list of available installment options. - **installment** (integer) - The number of installments. - **rate** (integer) - The interest rate for the installment. - **provider_id** (string) - The identifier of the provider, if applicable. - **financial_costs** (array of objects) - Financial costs associated with the installment. - **type** (string) - The type of financial cost (e.g., CFT, TEA). - **rate** (number) - The rate of the financial cost. - **formatted_value** (string) - The formatted value of the financial cost. - **amount** (object) - The amount details for the installment. - **currency** (string) - The currency of the amount. - **value** (string) - The value of the installment amount. - **total_value** (string) - The total value for the installment. - **iin** (any) - Information related to the Issuer Identification Number, can be null. - **country_code** (string) - The country code associated with the plan. - **first_installment_deferral** (integer) - The deferral period for the first installment. - **amount** (object) - General amount information for the plan. - **Currency** (string) - The currency of the plan amount. - **min_value** (integer) - The minimum value for the plan. - **max_value** (integer) - The maximum value for the plan. - **availability** (object) - Availability details for the installment plan. - **start_at** (string) - The start date of availability in ISO 8601 format. - **finish_at** (string) - The end date of availability in ISO 8601 format. - **created_at** (string) - The timestamp when the plan was created in ISO 8601 format. - **updated_at** (string) - The timestamp when the plan was last updated in ISO 8601 format. - **payment_method_type** (string) - The type of payment method. #### Response Example ```json [ { "id": "4d573425-33f9-4c46-b009-2c7e749b0ec7", "name": "plan_007", "account_id": [ "f7c5fe77-721b-49c2-84d3-957748df3c2c" ], "merchant_reference": "Test", "installments_plan": [ { "installment": 1, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 3, "rate": 1, "provider_id": "", "financial_costs": [ { "type": "CFT", "rate": 45.25, "formatted_value": "45,25%" }, { "type": "TEA", "rate": 38.5, "formatted_value": "38,50%" } ], "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 6, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 9, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } }, { "installment": 12, "rate": 1, "provider_id": "", "amount": { "currency": "USD", "value": "0", "total_value": "0" } } ], "iin": null, "country_code": "US", "first_installment_deferral": 0, "amount": { "Currency": "USD", "min_value": 0, "max_value": 100000000 }, "availability": { "start_at": "2023-09-12T00:00:00Z", "finish_at": "2030-09-20T00:00:00Z" }, "created_at": "2023-10-11T17:52:31.886178Z", "updated_at": "2023-10-11T17:52:31.886178Z", "payment_method_type": "NU_PAY_ENROLLMENT" } ] ``` -------------------------------- ### Get NuPay Enrollment Installment Conditions Source: https://docs.y.uno/docs/wallets/nupay Request available installment options for NuPay enrollment payments. Ensure you have the customer ID and vaulted token. ```bash curl --location 'https://api-sandbox.y.uno/v1/apm-installments' \ --header 'public-api-key: {{your_public_api_key}}' \ --header 'private-secret-key: {{your_secret_api_key}}' \ --header 'X-account-code: {{your_account_code}}' \ --header 'Content-Type: application/json' \ --data '{ \ "country": "BR", \ "amount": { \ "currency": "BRL", \ "value": "250" \ }, \ "customer": { \ "id": "{{customer_id}}" \ }, \ "payment_method": "NU_PAY_ENROLLMENT", \ "vaulted_token": "{{vaulted_token}}" \ }' ``` -------------------------------- ### Launch Enrollment UI Source: https://docs.y.uno/docs/sdks/lite-android/enrollment Start the enrollment process by calling startEnrollment with the customer session, country code, and other configuration parameters to display the enrollment form. ```kotlin startEnrollment( customerSession = "CUSTOMER_SESSION", countryCode = "US", showEnrollmentStatus = true, requestCode = 100 // Optional: defaults to 0 ) ``` -------------------------------- ### Create Subscription - Card Payment Example Source: https://docs.y.uno/reference/subscriptions/create-subscription This example demonstrates how to create a subscription using a card payment method, including the required `store_credentials.usage` field for subsequent rebills. ```APIDOC ## POST /subscriptions ### Description Creates a new subscription for a customer. ### Method POST ### Endpoint /subscriptions ### Request Body - **payment_method** (object) - Required - Details of the payment method. - **type** (string) - Required - The type of payment method (e.g., "CARD"). - **vaulted_token** (string) - Required - The token representing the vaulted payment method. - **card** (object) - Optional - Card-specific details. - **store_credentials** (object) - Required if `vaulted_token` is used and subsequent rebills are expected. - **usage** (string) - Required - Indicates the usage of stored credentials ('USED' for subsequent uses). ### Request Example ```json { "payment_method": { "type": "CARD", "vaulted_token": "{{vaulted_token}}", "card": { "store_credentials": { "usage": "USED" } } } } ``` ### Response #### Success Response (200) - **subscription_id** (string) - The unique identifier for the created subscription. - **status** (string) - The current status of the subscription (e.g., "ACTIVE", "PENDING"). #### Response Example ```json { "subscription_id": "sub_12345abcde", "status": "ACTIVE" } ``` ```