Payment Link via API

1. Create a Payment Link

To start accepting payments on your website, app or platform, you will need to create a Payment Link object that will help capture the payments made by your customers.

When creating a Payment Link object , make sure you bind it to one of your customers. This will ensure that you know who has made a payment when we notify you of a successful payment.

We will provide all available payment methods for your customer on the payment page. Below, you'll be able to see an example of API request for a Payment Link.

# /api/v4/payment_links
{
   "data": {
     "attributes": {
       "amount": 10000,
       "referenceId": "Payment_link_reference_id",
       "description": "Order Number 0001",
       "customerName": "John Doe",
       "expiredAt": "2021-12-06T16:00:00+07:00",
       "customerEmail": "[email protected]",
       "customerPhoneNumber": "080000000000",
       "paymentMethodOptions": {
         "displayName": "Nama Tampilan"
       }
     }
   }
}

2. Show payment instructions to your customer

You will receive a link showing all available payment methods and payment instructions for your customer. We will also send the link to your customer via email. This is a sample response you will get.

{
    "data": {
        "id": "paymentlink_fd65953f01a9de1364fe899d2722f255",
        "type": "payment_links",
        "attributes": {
            "status": "pending",
            "amount": "10000.0",
            "referenceId": "Payment_link_reference_id",
            "createdAt": "2021-12-05 22:05:26 +0700",
            "description": "Order Number 0001",
            "expiredAt": "2021-12-06 16:00:00 +0700",
            "paymentLinkUrl": "https://id-payment-link.xfers.com/paymentlink_fd65953f01a9de1364fe899d2722f255",
            "customerName": "John Doe",
            "customerEmail": "[email protected]",
            "customerPhoneNumber": "080000000000",
            "paymentMethodOptions": {
              "displayName": "Nama Tampilan"
            }
        }
    }
}

3. Get notified when payment has been made successfully

Some payment methods will require additional actions to be performed by your end-customers. Once a payment has been made successfully, we will notify you with a callback. The payment link's status will now be paid. Present the payment results to your customer, and you may now fulfil the order.

# Sample Callback
{
    "data": {
        "id": "paymentlink_fd65953f01a9de1364fe899d2722f255",
        "type": "payment_links",
        "attributes": {
            "status": "paid",
            "amount": "10000.0",
            "referenceId": "Payment_link_test_05122021_1",
            "createdAt": "2021-12-05 22:05:26 +0700",
            "description": "Order Number 0001",
            "expiredAt": "2021-12-06 16:00:00 +0700",
            "paymentLinkUrl": "https://id-payment-link.xfers.com/paymentlink_fd65953f01a9de1364fe899d2722f255",
            "customerName": "John Doe",
            "customerEmail": "[email protected]",
            "customerPhoneNumber": "080000000000",
            "paymentMethodOptions": {
              "displayName": "Nama Tampilan"
            }
        }
    }
}

4. Get notified when funds are available for withdrawal or transfer

In most cases, funds may not be immediately available for withdrawal or transfer. We will notify you with a callback when funds have been made available. The payment link's status will then be set to completed.

# Sample Callback
{
    "data": {
        "id": "paymentlink_fd65953f01a9de1364fe899d2722f255",
        "type": "payment_links",
        "attributes": {
            "status": "completed",
            "amount": "10000.0",
            "referenceId": "Payment_link_test_05122021_1",
            "createdAt": "2021-12-05 22:05:26 +0700",
            "description": "Order Number 0001",
            "expiredAt": "2021-12-06 16:00:00 +0700",
            "paymentLinkUrl": "https://id-payment-link.xfers.com/paymentlink_fd65953f01a9de1364fe899d2722f255",
            "customerName": "John Doe",
            "customerEmail": "[email protected]",
            "customerPhoneNumber": "080000000000",
            "paymentMethodOptions": {
              "displayName": "Nama Tampilan"
            }
        }
    }
}