# Checkout link

Returns generated checkout link customized based on parameters. You can use this link to direct customers to XanPay's interface for making the payment.

Endpoint POST /checkout-link

Response { "checkoutLink": URL }

Payload attributes

Parameter Required Description
amount Required Amount to be charged
currency Required Currency in which you set the amount.
orders Optional A list of orders
paymentMethods Optional An object of payment methods
notifyPayload Optional Custom string to be saved as a part of the charge object Note: we recommend encoding in base64
redirectUrl Optional Enables a button that takes the customer back to the specified url
customer Optional Can be used to autofill customer details

# Example

Request example

curl 
  -X POST https://api.xanpay.com/checkout-link
  -u {API_KEY}:{API_SECRET}
  -d '{
    "amount": "35",
	"currency": "SGD",
	"paymentMethods": {
		"SG": ["paynow"]
	},
	"redirectUrl": "https://google.com",
	"notifyPayload": "eyJvcmRlcklkIjogIjI1MSJ9",
	"orders": [{
		"id": "58109ds9a01",
		"name": "IPhone 12",
		"quantity": 1,
		"amount": 35
	}],
    "customer": {
        "email": "customer@gmail.com",
        "phone": {
            "code": "+65",
            "phone": "12345678901"
        }
    }
}'

Response example

{
    "checkoutLink": "https://checkout.xanpay.com/?apiKey=49566f24338bcfe6609b687b07939db9&currency=SGD&amount=41"
}