API Integration

Learn how to use payment links with Xendit in 3 simple steps

Step 1 : Generate API Key

  1. In your Xendit dashboard, go to Settings > API Key
  2. Click "Create New Secret Key"
  3. Enter API Key name for your reference
  4. Set WRITE permission for Money In
  5. Click generate API Key

For more information about API Key, you can refer to our documentation here

Step 2 : Create Payment Links

Required parameterTypeDescriptions
External IDStringID of your choice (typically the unique identifier of a payment link in your system). Min : 1 character Max : 255 characters.
AmountIntAmount on the payment link. Min and max amounts are stated here.
Items*ArrayArray of items. JSON objects describing the item(s) purchased. Max array size: 75. *This is only mandatory for PayLater payment option in payment links.

Refer to this document for other parameters that you can use.

Create your payment link. Send a POST request to Create Invoice with the required parameters.

POST https://api.xendit.co/v2/invoices 
{
  "external_id": "payment-link-example",
  "amount": 100000,
  "items": [
    {
      "name": "Air Conditioner",
      "quantity": 1,
      "price": 100000,
      "category": "Electronic",
      "url": "https://yourcompany.com/example_item"
    }
  ]
}

Step 3 : Pay the Payment Links

After requesting to create a payment link, you will get a response payload, which will include the payment link URL

Your customer can pay the payment links using the checkout URL provided in the response payload.

  • Refer to this document to learn the payment flow in live mode.
  • Refer to this document to learn more about payment flow in test mode.

Last Updated on 2023-05-17