Using Xendit Linking UI

We recommend you to use this flow. The Xendit Linking UI is a web page that allows you to collect payment method information from your customers to be used for auto-debit payments through e-wallets, credit cards, and direct debit.


Using Xendit's Linking UI gives you the following benefits:

  • Easy integration
  • Under PCI DSS Scope
  • Single integration for all payment methods
  • Pre-built UI/UX for your customer

Below is the demo video of our Xendit Linking UI :

High-level flow

The subsequent payments will be managed by Xendit, and we will automatically deduct from your customers periodically based on the settings that you provide.

Creating a Customer

Before creating a subscription plan, you must create a Customer Object using the Create Customer API. The customer object will be used by Xendit to send notifications, and to validate the end user’s credentials depending on the payment method they are using. Make sure you input the correct mobile number, especially if your customer wants to use Ewallet.

In the API response, you will receive a customer_id which will be used for the Plan Creation API in the next step.

POST https://api.xendit.co/customers
{
     "reference_id": "demo_1475801962607",
     "type": "INDIVIDUAL",
     "individual_detail": {
       "given_names": "John",
       "surname": "Doe"
     },
     "email": "customer@website.com",
     "mobile_number": "+628121234567890"
}

Creating a Plan

Once you receive the customer_id, you can continue to create a Plan by using the endpoint below. You will receive the URL of the Linking UI in the API response under the actions object. Your website or app should redirect your customers to this URL for them to link and authenticate their payment methods.

Note: If you plan to use the Xendit Linking UI, the payment_methods field MUST be an empty array ([]) in order to generate a linking URL in the response.

POST https://api.xendit.co/recurring/plans
{
  "reference_id": "test_reference_id",
  "customer_id": "cust-239c16f4-866d-43e8-9341-7badafbc019f",
  "recurring_action": "PAYMENT",
  "currency": "IDR",
  "amount": 13579,
  "payment_methods": [],
  "schedule": {
    "reference_id": "test_reference_id",
    "interval": "MONTH",
    "interval_count": 1,
    "total_recurrence": 12,
    "anchor_date": "2022-02-15T16:23:52Z",
    "retry_interval": "DAY",
    "retry_interval_count": 3,
    "total_retry": 2,
    "failed_attempt_notifications": [1,2]
  },
  "immediate_action_type": "FULL_AMOUNT",
  "notification_config": {
    "recurring_created": ["WHATSAPP","EMAIL"],
    "recurring_succeeded": ["WHATSAPP","EMAIL"],
    "recurring_failed": ["WHATSAPP","EMAIL"],
    "locale": "en"},
  "failed_cycle_action": "STOP",
  "payment_link_for_failed_attempt" : true,
  "metadata": null,
  "description": "Video Game Subscription",
  "items": [
        {
            "type": "DIGITAL_PRODUCT",
            "name": "Cine Mraft",
            "net_unit_amount": 13579,
            "quantity": 1,
            "url": "https://www.xendit.co/",
            "category": "Gaming",
            "subcategory": "Open World"
        }
    ],
  "success_return_url": "https://www.xendit.co/successisthesumoffailures",
  "failure_return_url": "https://www.xendit.co/failureisthemotherofsuccess"
}

Last Updated on 2024-05-14