The Checkout Payment Link API allows you to create a hosted checkout page where customers can securely complete their payments.

Request Payload

To generate a checkout link, the following parameters must be passed:

curl --location -g --request POST '<https://xstak-pay-stg.xstak.com/public/v1/payment/checkout>' \\
--header 'x-api-key: {{x-api-key-sk}}' \\
--header 'x-account-id: {{x-account-id}}' \\
--header 'x-signature: {{x-signature}}' \\
--header 'Content-Type: application/json' \\
--data-raw '{
    "amount": 5,
    "currency": "PKR",
    "customer": {
        "email": "[email protected]",
        "name": "user",
        "phone": "03415682456",

    },
    "shipping": {
        "address1": "Gulberg",
        "city": "Lahore",
        "country": "Pakistan",
        "zip": "65191",
        "shipping_method": "Standard",
        "province": "Punjab"
    },
    "metadata": {
        "order_reference": "checkout-pl-02"
    },
    "success_url": "<https://webhook.site/abd82b58-bf61-4d68-b4b3-7688f01b4e92>",
    "failure_url": "<https://www.google.com/>",
    "payment_methods": ["card", "jazzcash"]
}'

API Response

{
    "success": true,
    "responseStatus": "OK",
    "message": "Request processed successfully.",
    "data": {
        "_id": "xpay_pi_60be1502705b8505d99529b5cdef5333efda24fb544b43e75c2494ebffbb3533",
        "pi_client_secret": "xpay_pi_60be1502705b8505d99529b5cdef5333efda24fb544b43e75c2494ebffbb3533_cs_9e04a0a842e5eae8eb85a3696c768586bf6451f935c7bab8e6275969d8dca3e1",
        "created_at": "2025-09-16T13:00:11.045Z",
        "amount": 5,
        "currency": "PKR",
        "refund": {
            "refunded_amount": 0,
            "refund_object_id": null
        },
        "object_name": "payment_intent",
        "customer": {
            "name": "user",
            "email": "[email protected]",
            "phone": "03415682456",
            "vip_customer": "Yes",
            "previous_customer": "Yes"
        },
        "description": "",
        "pi_status": "requires_payment_method",
        "pm_token": "",
        "shipping": {
            "address1": "Gulberg",
            "address2": "",
            "city": "Lahore",
            "country": "Pakistan",
            "firstName": "",
            "lastName": "",
            "phone": "",
            "province": "Punjab",
            "zip": "65191",
            "shipping_method": "Standard"
        },
        "metadata": {
            "order_reference": "checkout-pl-03"
        },
        "token": null,
        "capture_method": "automatic",
        "html_response": {},
        "bank_response": {},
        "last_payment_response": {
            "token": null
        },
        "encryptionKey": null,
        "billingAddress": {},
        "routing_rules_history": [],
        "subscription": {},
        "checkout_page_url": "<https://xpay-checkout-stage.xstak.com/?source=headless&order_id=checkout-pl-03&id=670cc16ca4f54be748916396>"
    }
}

Signature Generation

For each API request, a signature must be generated to ensure the integrity and authenticity of the payload.

Data Preparation

let data = JSON.stringify(req.body);
 

Key Source