Create an Invoice
In order to create an invoice, you need to send a POST request to the following endpoint:
POST https://www.mimbla.com/api/v1/merchant/invoice
The request body should contain the following parameters:
Parameter | Type | Description | Required | Default value |
---|---|---|---|---|
amount | number | The amount of the invoice | Yes | |
crypto | string | The currency of the invoice | No | ALL |
due_date | string | The due date of the invoice in the format MM/DD/YYYY | No | End of the current month |
close_url | string | The URL to redirect the user to after the invoice is paid | No | |
webhook_url | string | The URL to send a POST request to when the invoice is paid | No | |
automatic_redirect | boolean | Automatically redirect the user to the close_url after the invoice is paid | No | false |
Request Parameters
amount
- The amount to be paid in the invoice, in the currency specified bycrypto
, the amount should be at least 10 USD at the time of the creation of the invoicecrypto
- The currency of the invoice, can beBTC
,BCH
,LTC
,XMR
, orALL
, choosingALL
will allow the user to pay with any of the supported currencies or the enabled currencies in the business settings, in order to view available currencies you can use the Get Available Cryptos endpointdue_date
- The due date of the invoice in the formatMM/DD/YYYY
, if not provided the invoice will be due at the end of the month by defaultclose_url
- The URL to redirect the user to after the invoice is paidwebhook_url
- The URL to send a POST request to when the invoice is paid, the request won't include any data so you can use it as a notification programatically by creating a URL that triggers an action when accessed, keep in mind that the URL will be accessed by Mimbla's servers and once we get we will not retry, if you need to make sure the request is received you can use a service like requestbin to test the webhookautomatic_redirect
- Automatically redirect the user to theclose_url
after the invoice is paid
Note: The amount
should be at least 10 USD at the time of the creation of the invoice, if the amount is less than 10 USD the request will fail with an error message, the amount should be provided in the currency specified by crypto
, if the currency is ALL
the amount should be provided in USD.
It is important to note that you should try to specify the crypto
parameter to avoid any issues with the invoice, if you don't specify the crypto
parameter the invoice will be created with the default currency ALL
and the user will be able to pay with any of the supported currencies or the enabled currencies in the business settings. During the payment checkout the calculated price may not be accurate, so in order to avoid any future losses we recommnend you specify the cryptocurrency and the proper amount in that cryptocurrency
Example Request
POST https://www.mimbla.com/api/v1/merchant/invoice
Content-Type: application/json
{
"amount": 10,
"crypto": "ALL",
"due_date": "12/31/2022",
"close_url": "https://example.com/close",
"webhook_url": "https://example.com/webhook",
"automatic_redirect": true
}
Example Successful Response
If your request is successful, you will receive a response with the http status code 201 Created
and the following body:
{
"id": "MWtyHVSGIAer",
"success": true,
"invoice_url": "https://www.mimbla.com/pay/MWtyHVSGIAer",
"due_date": "2024-09-30T23:59:59.000000Z",
"amount": "10",
"crypto": "ALL",
"rates": null
}
Example Error Response
If your request is unsuccessful, you will receive a response with the http status code 422 Unprocessable Entity
with the error of the and the following body:
{
"message": "Invalid amount",
"errors": {
"amount": [
"The amount field is required."
]
}
}
Keep in mind that the error message will vary depending on the error that occurred, if two or more errors are present the response will contain the fields that failed and the error message for each of them and in the next request you should fix the errors and try again since we do not handle all the possible errors in the same request, as soon as we encounter an error we stop the validation and return the response with the error message.