Pay an invoice
This action allows you to pay an invoice.
API call to pay an invoice.
Authentication Information:
All requests sent to the Payunit REST API must be authenticated. Payunit supports two forms of authentication, both using HTTP Basic Authentication, which uses the following authentication schemes:
- API USER and API PASSWORD
- Application token
BASE_URL: https://gateway.payunit.net (opens in a new tab)
HTTP Headers: HTTP header specifications for all API calls.
HTTP Header | Description |
---|---|
Content-Type | The supported content type is application/json |
Authorization | Basic HTTP authentication is Base64 encoded and formatted as follows: Basic Base64(api_user:api_password) |
x-api-key | Your application token |
mode | Live or test mode. Your application's current mode |
Request to create a standard invoice on Payunit
curl --location '{{base_url}}/api/gateway/invoice/payment' \
--header 'x-api-key: live_xxxxxxxxxxxxxxx' \
--header 'mode: live' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic xxxxxxxx' \
--data '{
"amount": 120000,
"invoice_id": "25983991-ec59-4f2f-98fc-d67d8f1b783b",
"installment_id": "257a5cfb-ac75-4494-bfdd-ad00a811eceb"
}'
'
End point: {BASE_URL}/api/gateway/invoice/create
Request body: POST
Request body:
Parameter | Required | Description |
---|---|---|
amount | Yes | The amount to pay |
invoice_id | Yes | The invoice ID |
installment_id | No | The installment ID, required if the invoice type is INSTALLMENT |
Response body:
{
"status": "SUCCESS",
"statusCode": 200,
"message": "Payment Initiated",
"data": {
"transaction_url": "https://pu.payunit.net/#/hostedPayment/payment?t_id=YTYyNTNlYmNmZWQ0M2VkNmFkY2E3Zjg2ZTg5NWQyMjY3NTMwZjE=&t_sum=YzM1NDU3YzU4MA==&t_url=OWUxMDEzODVjM2I4MjBjZWZkODcyYWQ3YjI5OGQwNjAyNjcwYTRiMWRiODlkNDVmZjFkZWI0MjU5NTlmZTE5ZTk5M2JjNzUxMWM1ODYwYTZlZWNjMGE1YmQ4NjU3NTUyYzZiMmM5ZjRlY2EwNzZmNjE2OTdjZGRiZDM=",
"transaction_id": "PAYINV1749136xxxx",
"reference_id": "INSTALLMENT170307562xxx"
}
}
Parameter | Description |
---|---|
status | The transaction status. |
statusCode | The transaction status code. |
message | The API return message. |
data | The data returned by the API |
transaction_url | The payment link |
Last updated on June 6, 2025