Pay Payment Link
Initiate payment for a payment link. Creates a payment intent that the customer can use to complete the payment.
note
This is a public endpoint — no authentication headers are required.
POST
https://api.zenpayz.com/merchant/api/v1/payment-links/:linkId/payBearer · API key
Request
Path Parameters
| Parameter | Type | Description |
|---|---|---|
linkId REQUIRED | string | The payment link ID (e.g. pl_a1b2c3d4e5f6g7h8) |
Body Parameters
| Parameter | Type | Description |
|---|---|---|
customerEmail OPTIONAL | string | Customer email address |
Response
Success (200 OK)
{
"success": true,
"data": {
"linkId": "pl_a1b2c3d4e5f6g7h8",
"paymentIntentId": "pi_x1y2z3w4v5u6t7s8",
"amount": 4999,
"currency": "INR",
"checkoutUrl": "https://checkout.zenpayz.com/pay/pi_x1y2z3w4v5u6t7s8"
},
"message": "Payment initiated successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 130,
"api_version": "v1",
"endpoint": "POST /payment-links/:linkId/pay",
"user_type": "merchant"
}
}
Error Responses
| Code | HTTP | Message |
|---|---|---|
| PAYMENT_LINK_NOT_FOUND | 404 | Payment link does not exist |
| PAYMENT_LINK_EXPIRED | 410 | Payment link has expired |
| PAYMENT_LINK_INACTIVE | 410 | Payment link is inactive |
| PAYMENT_LINK_MAX_USES_REACHED | 409 | Payment link has reached its maximum number of uses |
Examples
- cURL
- JavaScript
- SDK
curl -X POST https://api.zenpayz.com/merchant/api/v1/payment-links/pl_a1b2c3d4e5f6g7h8/pay \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "john@example.com"
}'
const response = await fetch('https://api.zenpayz.com/merchant/api/v1/payment-links/pl_a1b2c3d4e5f6g7h8/pay', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
customerEmail: 'john@example.com',
}),
});
const result = await response.json();
console.log(result.data.checkoutUrl); // Redirect customer to this URL
const payment = await zenpays.paymentLinks.pay('pl_a1b2c3d4e5f6g7h8', {
customerEmail: 'john@example.com',
});
console.log(payment.checkoutUrl); // Redirect customer to this URL