Checkout-link API Introduction

Our checkout-link API returns a generated checkout-link customised based on parameters. You can use this link to direct customers to XanPay's interface for making the payment. 

Required Fields

To successfully generate a checkout-link, only the "amount" and "currency" parameters are required. All other attributes are optional, and can be used for additional customisation. 

Geo-Detection

Our checkout widget automatically detects a customer's geo-location, and presents the relevant country's payment methods to them. E.g. When a customer from Singapore is redirected to the XanPay checkout page, they will see Singapore in the "country" field, and see a list of payment options that includes PayNow and/or other methods available to Singapore. 

Currency Conversion

Our widget automatically converts currencies for your customers. E.g. If your store lists item prices in AUD, but your customer is from Singapore, Malaysia etc., the original AUD amount of your item will be listed at the top, but the converted amount will be at the bottom of the widget, on the Pay button. 

To learn more about the fees charged for currency conversions, please refer to this link.

 

Screenshot_2023-01-31_at_11.24.21_AM.png

 

Default Methods vs. Selected Methods

We have varied default payment methods available for every country. To check what payment methods are available for your account, please use the GET /methods endpoint

How do I show all payment methods?

To show all payment methods by default, you only need to pass the "amount" and "currency" parameters in your checkout-link request body. Do not specify the "paymentMethods" attribute. 

In this example below, as the customer is located in Singapore, the payment options presented are Singapore's local APM solution, PayNow, and all other default payment methods like Xan Wallet, Stellar USDC and USDT. 

 

Screenshot_2023-01-31_at_2.25.18_PM.png

 

How do I show fiat-only payment methods? 

To show only a selected set of payment methods, or in this case - fiat-only payment methods, you may specify the "paymentMethods" attribute with only each countries' local payment methods. 

Here is an example of how you can specify the checkout-link's request body:

{
"amount":"50",
"currency":"SGD",
"paymentMethods":{
"HK":["fps","hk-bank-transfer"],
"SG":["paynow"],
"VN":["viettel-pay"],
"MY":["duit-now"],
"PH":["instapay"],
"TH":["prompt-pay"],
"IN":["in-bank-transfer"],
"ID":["id-bank-transfer"],
"AU":["pay-id"],
"NZ":["nz-bank-transfer"]
}}
 

After the checkout-link has been generated successfully, you should see that your checkout page's payment options display only the local payment methods of the specified countries.

 

Screenshot_2023-01-31_at_2.50.21_PM.png          Screenshot_2023-01-31_at_2.50.01_PM.png

 

I only want to show 1 payment method at checkout, how can I do that?

You may do so by specifying the selected currency and the relevant country's local payment method in the "paymentMethods" attribute.

Here is an example of how the checkout-link request body can look like: 

{
"amount":"50",
"currency":"AUD",
"paymentMethods":{
"AU":["pay-id"]
}}
 
After the checkout-link has been generated successfully, you should see that your checkout page's payment options display only the stated payment method of your selected country. 
 
Screenshot_2023-01-31_at_3.09.38_PM.png
 
In the country dropdown list, you will also notice that all other countries' payment methods have been disabled, and only your specified country is available. 
 
Screenshot_2023-01-31_at_3.09.56_PM.png
 
To conclude the above 3 examples shown, we highly encourage to experiment with the "paymentMethods" attribute if you are looking for payment-options customisation. 
 

Autofill Customer Details

To improve your customers' checkout experience, you may choose to pass their email, phone country code, and mobile number into the "customer" parameter. After doing so, all they have to do at the checkout page is to verify their phone number by keying in the OTP sent to them. This significantly increases conversion for most of our merchants. 

Here is an example of how the checkout-link request body can look like: 

{
"amount":"50",
"currency":"AUD",
"paymentMethods":{
"AU":["pay-id"]
},
"customer":{
"email":"customer@gmail.com",
"phone":{
"code":"+65",
"phone":"12345678901" }}}
 

Screenshot_2023-01-31_at_3.34.03_PM.png

 

RedirectUrl

How do I redirect a customer back to my page after they have paid? 

You may specify the "redirectUrl" parameter in the request body. It enables a button that takes the customer back to specified URL. 

Here is an example of how the checkout-link request body can look like: 

{
"amount":"50",
"currency":"SGD",
"paymentMethods":{
"SG":["paynow"]
},
"customer":{
"email":"customer@gmail.com",
"phone":{
"code":"+65"}
},
"redirectUrl":"https://google.com"}
 
After the checkout-link has been generated successfully, and the customer has keyed in their details and verified their phone number, they will be brought to a payment instruction page like below. They should be able to notice that there is a "I have made my payment" button below. 
 

Screenshot_2023-01-31_at_3.56.12_PM.png

 

After clicking on "I have made my payment", the customer should be redirected to the specified URL. In that URL, the chargeID associated with the created charge will be displayed as well. 

 

Screenshot_2023-01-31_at_3.56.42_PM.png

 

"orders" and "notifyPayload" Parameters 

The "orders" parameter can be specified with the following attributes. Using the Order object, you can provide a list of orders for each charge. These orders will be displayed in the invoice sent to the customer.

The "notifyPayload" parameter is a custom string that can be saved as part of the charge object. If you want your endpoint to receive additional data, such as the your internal order identifier, you can set this parameter. Example: You wish to send an object e.g {"orderId": "251"}, you can convert it into a string by encoding into base64, e.g. "eyJvcmRlcklkIjogIjI1MSJ9". To learn more about how to use the "notifyPayload" parameter, please refer to this link