Skip to main content

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:

ParameterTypeDescriptionRequiredDefault value
amountnumberThe amount of the invoiceYes
cryptostringThe currency of the invoiceNoALL
due_datestringThe due date of the invoice in the format MM/DD/YYYYNoEnd of the current month
close_urlstringThe URL to redirect the user to after the invoice is paidNo
webhook_urlstringThe URL to send a POST request to when the invoice is paidNo
automatic_redirectbooleanAutomatically redirect the user to the close_url after the invoice is paidNofalse
currencystringThe fiat currency to calculate your invoice amountNoUSD

Request Parameters

  • amount - The amount to be paid in the invoice, in the currency specified by crypto, the amount should be at least 10 USD at the time of the creation of the invoice
  • crypto - The currency of the invoice, can be BTC, BCH, LTC, XMR, or ALL, choosing ALL 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 endpoint
  • due_date - The due date of the invoice in the format MM/DD/YYYY, if not provided the invoice will be due at the end of the month by default
  • close_url - The URL to redirect the user to after the invoice is paid
  • webhook_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 webhook
  • automatic_redirect - Automatically redirect the user to the close_url after the invoice is paid
  • currency - The fiat currency to calculate your invoice amount, by default it is set to USD, 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.