The Create Invoice API allows you to generate an invoice for a specific merchant. This API handles parameters like the merchant's information, reference ID, currency, and amount to create an invoice for a given transaction.
Ensure that you pass a valid merchant_id, reference_id, and amount when making a request. If the merchant or reference is not found, or the amount is invalid, an error will be returned.
| Parameter | Type | Required | Description |
|---|---|---|---|
| merchant_id | string | ✔️ | Unique identifier for the merchant. This is required for creating an invoice. |
| reference_id | string | ✔️ | The `reference_id` is a unique string used to track the user's order in the issuer's database. It can be the order ID from the issuer's database table. |
| symbol | string | ✔️ | The currency symbol (e.g., USD, EUR). |
| protocol | string | ✔️ | The protocol for the currency (e.g., ERC20, Bitcoin). |
| amount | string | ✔️ | The transaction amount. Must be a valid string representation of the amount (e.g., "10.50"). |
| description | string | ❌ | Optional description for the invoice (e.g., for the purpose of the transaction). |
POST /createInvoice
Headers:
Authorization: Bearer <your_api_key>
Body:
{
"merchant_id": "<merchant_id>",
"reference_id": "<reference_id>",
"symbol": "<currency_symbol>",
"protocol": "<currency_protocol>",
"amount": "<amount>",
"description": "<description>"
}
{
"status": true,
"statusCode": 200,
"invoice_id": "<invoice_id>"
}
The API provides the following error responses:
{
"status": false,
"statusCode": 400,
"message": "Amount must be a valid decimal number."
}
400 Bad Request: The amount parameter is invalid. Ensure the amount is a valid decimal number and greater than 1.
{
"status": false,
"statusCode": 404,
"message": "Merchant or reference not found"
}
404 Not Found: The merchant or reference ID provided does not exist in the system. Double-check the merchant ID and reference.
{
"status": false,
"statusCode": 500,
"message": "Internal server error"
}
500 Internal Server Error: An unexpected error occurred on the server. Try again later or contact support.