Create a shortened XPay payment link that you can share with a customer through WhatsApp, SMS, email, or another messaging channel. The customer opens the link and completes the payment on the secure XPay payment page.
Before you begin
Configure XPay API authentication. Create payment links from the merchant backend so XPay API credentials and the API signature secret remain private.
Create the payment link
Send an authenticated request to:
POST {{base_url}}/public/v1/payment/linkThe order object identifies the payment and amount. The customer object requires name and at least one of email or phone. metadata and description are optional.
Use the response
A successful response includes the shortened link:
{
"status": "success",
"message": "Payment link created successfully",
"payment_link": "https://{{short_link_host}}/{{link_id}}",
"order": {
"id": "order-1001",
"currency": "PKR",
"order_amount": 500
},
"customer": {
"name": "Ayesha Khan",
"email": "ayesha@example.com",
"phone": "{{customer_phone}}"
},
"metadata": {
"campaign": "renewal-reminder"
},
"description": "Payment for order order-1001"
}Store the order ID with the merchant's order record, then send payment_link to the intended customer. Treat the link as customer-specific and do not expose it in public pages or logs.
Payment links compared with the B2B Payments API
Use a payment link when the merchant creates a shortened URL to share with a customer for later payment. Use the B2B Payments API when the merchant application creates a payment session and immediately redirects the customer to the returned XPay-hosted page.
Confirm the payment result
Do not treat opening the link or returning to the merchant site as proof of payment. Reconcile the result through payment webhook events and the current XPay payment record before fulfilling the order.
API details
See Custom Payment Link in the XPay API reference for the complete request and response schemas.