Create Normal Invoice
This action allows you to create a new invoice.
Create Invoice API call
Authentication information:
All requests to the Payunit REST API must be authenticated. Payunit supports two forms of authentication, both using HTTP basic authentication, which uses the following username/password schemes:
- API USER et 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 | supported content type is application/json |
Authorization | Http basic Auth is Base 64 encoded and formatted as follows: Basic Base64(api_user:api_password) |
x-api-key | Your application token |
mode | Live or test. Your application's current mode |
Request to create normal invoice on Payunit
curl --location --request POST '{{base_url}}/api/gateway/invoice/create' \
--header 'x-api-key: live_xxxxxxxxxxxxxxx' \
--header 'mode: live' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic xxxxxxxxxx' \
--data-raw '{
"client_name": "Brooklyn Perry",
"client_email": "[email protected]",
"client_phone_number": "(924) 913-0817",
"due_date": "2024-05-14T13:53:22.060Z",
"partial_payment":false,
"is_custom_company": true,
"type":"NORMAL",
"currency": "XAF",
"callback_url": "https://webhook.site/697a81e2-6b63-4be1-928f-63b0100ea6bd",
"custom_billing_company": {
"name": "Alpha Company",
"logo": "https://static.vecteezy.com/system/resources/thumbnails/047/656/219/small_2x/abstract-logo-design-for-any-corporate-brand-business-company-vector.jpg",
"email": "[email protected]",
"phone_number": "+237678095634"
},
"items": [
{
"name":"recovery partial",
"amount": 30000,
"quantity": 4
}
]
}
'
End point: {BASE_URL}/api/gateway/invoice/create
Request method: POST
⚠️
All URLs must utilize HTTPS protocol { callback_url, logo }; otherwise, the requests will not be successful.
Request body :
Paramètre | Mandatory | Description |
---|---|---|
client_name | Yes | The name of the client. |
client_email | Yes | The email address of the client. |
client_phone_number | Yes | The phone number of the client. |
due_date | Yes | The deadline for the payment. Format: ISO 8601 with timezone. |
partial_payment | Yes | Boolean indicating whether the invoice can be paid partially. |
is_custom_company | No | Boolean indicating whether the invoice is created by a custom company. |
type | Yes | The type of invoice. Can be either "NORMAL" or "INSTALLMENT". |
currency | Yes | The currency of the invoice. ISO 4217 currency code. |
callback_url | Yes | The URL where the customer will be redirected after the payment. |
custom_billing_company | No | The custom billing company information. |
items | Yes | The list of items being invoiced. |
Response body:
{
"status": "SUCCESS",
"statusCode": 200,
"message": "Invoice created",
"data": {
"link": "https://d1im41dw2xzw4q.cloudfront.net/invoice/d65cc82a-795d-437c-ab0c-05b1aca8d385",
"invoice": {
"ref": "INV-1739883653174",
"amount_paid": 0,
"remaining_amount": 120000,
"status": "UNPAID",
"client": {
"uuid": "d2614f47-0fab-4c2d-9a62-eecd59553e54",
"created_at": "2024-06-06T12:00:16.677Z",
"lastChangedDateTime": "2024-06-06T12:00:16.677Z",
"isDeleted": null,
"name": "Brooklyn Perry",
"email": "[email protected]",
"phone_number": "(924) 913-0817"
},
"total_amount": 120000,
"due_date": "2024-05-14T13:53:22.060Z",
"sub_total": 120000,
"company": {
"uuid": "5aae9972-d428-4c65-ab5a-662b6dc39b61",
"created_at": "2024-06-06T11:44:01.765Z",
"lastChangedDateTime": "2024-06-06T11:44:01.765Z",
"isDeleted": null,
"name": "Edi Fashoion",
"slug": null,
"email": "[email protected]",
"phone_number": "23456734567",
"logo": "https://payunit-public-assets-staging.s3.us-east-2.amazonaws.com/payunit-invoice/4ffbcc14-fedc-4437-8be6-d7975fbd056a/1717674241164.image/png",
"user_id": "4ffbcc14-fedc-4437-8be6-d7975fbd056a",
"application_id": "40dc357d-8f04-4bcf-a511-9207e7cd3156"
},
"is_custom_company": true,
"custom_billing_company": {
"name": "Alpha Company",
"logo": "https://static.vecteezy.com/system/resources/thumbnails/047/656/219/small_2x/abstract-logo-design-for-any-corporate-brand-business-company-vector.jpg",
"email": "[email protected]",
"phone_number": "+237678095634"
},
"callback_url": "https://webhook.site/697a81e2-6b63-4be1-928f-63b0100ea6bd",
"type": "NORMAL",
"partial_payment": false,
"currency": "XAF",
"items": [
{
"name": "recovery partial",
"amount": "30000",
"quantity": "4",
"ref": "ITEM1739883653224",
"uuid": "b2128f9e-9869-4fc8-b39f-ad9241027873",
"created_at": "2025-02-18T13:00:53.224Z",
"lastChangedDateTime": "2025-02-18T13:00:53.224Z",
"isDeleted": null
}
],
"fees": null,
"uuid": "d65cc82a-795d-437c-ab0c-05b1aca8d385",
"created_at": "2025-02-18T13:00:53.174Z",
"lastChangedDateTime": "2025-02-18T13:00:53.174Z",
"isDeleted": null
}
}
}
Parameter | Description |
---|---|
status | The transaction status. |
statusCode | The Transaction status code |
message | The API return message. |
data | Data returned by the API |
link | The invoice link |
The invoice payment link generated is valid untill the invoice is paid.
Last updated on February 25, 2025