Skip to main content

Pay Invoice

Initiate payment for an invoice. Creates a payment intent that the customer can use to complete the payment.

note

This is a public endpoint — no authentication headers are required.

POSThttps://api.zenpayz.com/merchant/api/v1/invoices/:invoiceId/pay
Bearer · API key

Request

Path Parameters

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

Response

Success (200 OK)

{
"success": true,
"data": {
"invoiceId": "inv_a1b2c3d4e5f6g7h8",
"paymentIntentId": "pi_x1y2z3w4v5u6t7s8",
"amount": 275.00,
"currency": "USD",
"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": 120,
"api_version": "v1",
"endpoint": "POST /invoices/:invoiceId/pay",
"user_type": "merchant"
}
}

Error Responses

CodeHTTPMessage
INVOICE_NOT_FOUND404Invoice does not exist
INVOICE_ALREADY_PAID409Invoice has already been fully paid
INVOICE_CANCELLED409Cannot pay a cancelled invoice

Examples

curl -X POST https://api.zenpayz.com/merchant/api/v1/invoices/inv_a1b2c3d4e5f6g7h8/pay \
-H "Content-Type: application/json"