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 |
currency | string | The fiat currency to calculate your invoice amount | No | USD |
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 paidcurrency
- The fiat currency to calculate your invoice amount, by default it is set toUSD
, if you want to use another currency you can specify it here, check out our supported fiat currencies for displaying the exchange rates.
Check out our page for supported currencies to see the list of available cryptocurrencies and fiat currencies that we support: https://developer.mimbla.com/supported-currencies
Note: The amount
should be at least 10 USD at the time of the creation of the invoice, if you use another currency the amount will be converted to USD and the minimum amount will be calculated based on the current exchange rate, so if you use a currency that is not USD, make sure that the amount is at least 10 USD in that currency, otherwise the request will fail with an error message. This also applies in case you choose a cryptocurrency as the crypto
parameter, the amount will be converted to USD and the minimum amount will be calculated based on the current exchange rate, so if you choose BTC and set the amount to something like 0.0000001 BTC and if that is less than 10 USD at the time of the creation of the invoice, the request will fail with an error message.
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.