Create an invoice

Let's create an invoice and then pay for it:

curl -X POST \
https://minfeesandbox.com/api/invoices \
-H 'Authorization: HMAC ***' \
-H 'Content-Type: application/json' \
-H 'Date: Tue, 19 Mar 2019 10:11:40 GMT' \
-d '{"price_amount": "20", "price_currency": "EUR", "custom_id": "12398123981722", "pay_currency": "USDC", "network": "bnb_smart_chain"
}'

Let us go through the parameters we used in our request above:

  • price_amount - the payment amount

  • price_currency - the currency of payment, i.e. the currency into which the cryptocurrency received at the address of the invoice will be converted and in which the merchant will be credited to the balance, in our case it is EUR

  • pay_currency - the cryptocurrency in which the payment is to be made, in our case it is BTC

  • network - the blockchain in which the address is going to be created. The list of available networks can be found here.

  • custom_id - we recommend you to specify a certain reference by which you associate your customer with the payment, e.g. 12398123981722

You will receive the invoice address, the amount of cryptocurrency to be sent to the invoice address and a link to the invoice's hosted page, which can be built into your website and other details:

{
    "data": {
        "id": "dad9c70c-959b-45b8-abe8-f56d7f9b7ceb",
        "custom_id": "12398123981722",
        "customer_id": null,
        "subscription_id": null,
        "status": "new",
        "status_context": null,
        "address": "0x492cBb7092f178fcC6973BBf2396F7436e5cfF25",
        "network": "bnb_smart_chain",
        "uri": "0x492cBb7092f178fcC6973BBf2396F7436e5cfF25",
        "price_amount": "20.0",
        "price_currency": "EUR",
        "pay_amount": "22.207418",
        "pay_currency": "USDC",
        "fee": "0.2",
        "fee_currency": "EUR",
        "paid_amount": "0.0",
        "exchange": {
            "pair": "USDCEUR",
            "rate": "0.9006",
            "fee": "0.0",
            "fee_currency": "EUR"
        },
        "transactions": [],
        "name": null,
        "description": null,
        "metadata": null,
        "success_redirect_url": null,
        "unsuccess_redirect_url": null,
        "hosted_page_url": "https://hosted-page.minfeesandbox.com/invoices/dad9c70c-959b-45b8-abe8-f56d7f9b7ceb",
        "created_at": "2025-04-23T08:23:56+00:00",
        "expires_at": "2025-04-23T08:33:56+00:00"
    }

Tips for Making Invoice Payments

To pay for the invoice, it’s required to send a cryptocurrency transaction to the invoice cryptocurrency address - in this tutorial it is 0x492cBb7092f178fcC6973BBf2396F7436e5cfF25. To do so, log in to your sandbox account, locate the coin that should be used for the payment (USDC in this example) and press the "Send" button, which is located on your cryptocurrency wallet balance:

In the pop-up window, enter the address (address from the received response) and the transaction amount (pay_amount from the received response), and complete the process. You can also automate the process of sending transactions using this endpoint so that you do not have to create payments manually.

Once the payment is made, we will send the callbacks to the Callback URL.

We recommend that you check invoice statuses via GET /api/invoices/{invoice_id}using this endpoint as the delivery of the callbacks is not guaranteed.

Below is an example of a callback for the final status completed of the payment:

{
  "data": {
    "id": "dad9c70c-959b-45b8-abe8-f56d7f9b7ceb",
    "fee": "0.2",
    "uri": "0x492cBb7092f178fcC6973BBf2396F7436e5cfF25",
    "name": null,
    "status": "completed",
    "address": "0x492cBb7092f178fcC6973BBf2396F7436e5cfF25",
    "network": "bnb_smart_chain",
    "exchange": {
      "fee": "0.0",
      "pair": "USDCEUR",
      "rate": "0.9006",
      "fee_currency": "EUR"
    },
    "metadata": null,
    "custom_id": "12398123981722",
    "created_at": "2025-04-23T08:23:56+00:00",
    "expires_at": "2025-04-23T08:33:56+00:00",
    "pay_amount": "22.207418",
    "customer_id": null,
    "description": null,
    "paid_amount": "22.207418",
    "fee_currency": "EUR",
    "pay_currency": "USDC",
    "price_amount": "20.0",
    "transactions": [
      {
        "risk": {
          "level": "low",
          "score": 0,
          "resource_name": "default",
          "resource_category": "unknown"
        },
        "txid": "0x3486cb116db6e6b3e9d4f7550fd018f9709cb1295bd247641618ffa9991d4ff0"
      }
    ],
    "price_currency": "EUR",
    "status_context": null,
    "hosted_page_url": "https://hosted-page.minfeesandbox.com/invoices/dad9c70c-959b-45b8-abe8-f56d7f9b7ceb",
    "subscription_id": null,
    "success_redirect_url": null,
    "unsuccess_redirect_url": null
  },
  "type": "Invoice",
  "event": "status_changed"
}

It is important to note that cash from the payment is only credited to the merchant balance when the payment status is updated to completed. The price_amount field for a payment with the status completed indicates the full amount of this processed payment.

Last updated