# 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.

If you wish to create a custom interface, please head to API documentation sections: Customers and Charges.

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.
apiKey Required A unique key identifying a partner generated in dashboard
orders Optional A list of orders
paymentMethods Optional An object of payment methods
notifyPayload Optional String to be sent with order status changes to registered webhooks Note: we recommend encoding in base64
redirectUrl Optional Enables a button that takes the customer back to the specified url

# Example

Request example

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

Response example

{
    "checkoutLink": "https://checkout.xanpay.com/?apiKey=e17052ffdddeffeec80a0497158fc084&amount=35&currency=SGD&orders=W3siaWQiOiI1ODEwOWRzOWEwMSIsIm5hbWUiOiJJUGhvbmUgMTIiLCJxdWFudGl0eSI6MSwiYW1vdW50IjozNX1d&redirectUrl=https%3A%2F%2Fgoogle.com&notifyPayload=eyJvcmRlcklkIjogIjI1MSJ9&hash=XhBW4Tt1ZtMELBWTIQgF5vJqZuNcvpZ9Vnnc1Q98m0s="
}