Skip to main content

Generate Payment Link

Generate a payment link for an invoice that can be shared with the customer.

POSThttps://api.zenpayz.com/merchant/api/v1/invoices/:invoiceId/generate-link
Bearer · API key

Request

Headers

HeaderDescription
Authorization
REQUIRED
Bearer {api_key}
X-Signature
REQUIRED
HMAC-SHA256 signature
X-Timestamp
REQUIRED
ISO 8601 timestamp
X-Secret-Salt
REQUIRED
Secret salt for HMAC validation
Content-Type
REQUIRED
application/json

Path Parameters

ParameterTypeDescription
invoiceId
REQUIRED
stringThe invoice ID (e.g. inv_a1b2c3d4e5f6g7h8)

Response

Success (200 OK)

{
"success": true,
"data": {
"invoiceId": "inv_a1b2c3d4e5f6g7h8",
"paymentLinkId": "pl_b2c3d4e5f6g7h8i9",
"paymentUrl": "https://pay.zenpayz.com/pl_b2c3d4e5f6g7h8i9",
"shortCode": "ZP-ABC123",
"shortUrl": "https://pay.zenpayz.com/s/ZP-ABC123"
},
"message": "Payment link generated successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 55,
"api_version": "v1",
"endpoint": "POST /invoices/:invoiceId/generate-link",
"user_type": "merchant"
}
}

Error Responses

CodeHTTPMessage
UNAUTHORIZED401Invalid API key
INVOICE_NOT_FOUND404Invoice does not exist
INVOICE_ALREADY_PAID409Invoice has already been fully paid
INVOICE_CANCELLED409Cannot generate link for a cancelled invoice

Examples

curl -X POST https://api.zenpayz.com/merchant/api/v1/invoices/inv_a1b2c3d4e5f6g7h8/generate-link \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt" \
-H "Content-Type: application/json"