Create an invoice for payment

The method allows you to create an invoice for payment without a strict indication of the coin and network, you can specify a payment of 30 USD and a list of coins/networks available for payment, the user himself will choose what is more convenient for him to pay. The amount will be automatically converted to the selected coin for payment

Create an invoice for payment

post
Header parameters
x-api-public-keystringOptional

Public API-key

x-api-signaturestringOptional

Signing the request body with a private API-key

Content-typestringOptional

Request content type

Example: application/json
Body

Request body for creating an invoice

externalIdstringOptional

A unique identifier in the merchant's system to prevent duplication of invoices

Example: merchantExternalId123
orderstringOptional

Order ID in the merchant system

Example: Order #123456
descriptionstringOptional

Order Description

Example: Payment by order #123456
externalUserIdstringOptional

The external user ID in your system. When specifying the identifier, the functionality of the "Personal addresses" section will be used - a static address will be reserved for this user, but the webhook will be sent to the URL specified in this request

Example: 10099
payerEmailstringOptional

Payer's email address. If it is specified alongside with the 'externalUserId' parameter, a user with such an email will be created in the "Personal addresses" section

Example: [email protected]
currencystringRequired

Coins for payment. You can specify any available coin, including fiat. On the invoice page, the amount in the specified coin will be recalculated to the coins available for payment

Example: USD
amountstringRequired

Amount payable in the specified coin. On the invoice page, the amount will be recalculated at the rate of coins available for payment

Example: 20
includeFeebooleanOptional

The flag allows you to include the commission of the blockchain network selected for payment in the amount payable. It will be useful to lay down your costs for the withdrawal of coins after payment.

additionalFeesstring[]Optional

Array with the tariff names, which allows you to include commission in final amount for the specified tariffs

Example: SEPA_WITHDRAWAL
insurancePercentstringOptional

Allows you to add the specified percentage to the payment amount'

Example: 1
slippagePercentstringOptional

When opening the invoice page, the user can spend so much time on it that the exchange rate changes. If after the transition to payment the amount changes more than the specified percentage, then the amount payable will be recalculated at the current rate

Example: 2
paymentTolerancePercentstringOptional

Acceptable underpayment percentage of an ORDER. For example, after selecting the invoice coin, an order for 100 USDT was created. If the parameter is set to 1.5%, the order will be completed successfully after payment of 98.5 USDT

Example: 1.5
webhookURLstringOptional

URL for notifications when the status of an invoice or amount received changes

Example: https://merchant.domain/webhooks/invoice
returnURLstringOptional

URL to specify as "Return to Store" on the checkout page

Example: https://merchant.domain/
lifetimeintegerOptional

Invoice lifetime in minutes

Responses
200Success
application/json
post
POST /api-gateway/make-invoice HTTP/1.1
Host: ocp.onchainpay.io
Content-Type: application/json
Accept: */*
Content-Length: 448

{
  "externalId": "merchantExternalId123",
  "order": "Order #123456",
  "description": "Payment by order #123456",
  "externalUserId": "10099",
  "payerEmail": "[email protected]",
  "currency": "USD",
  "amount": "20",
  "includeFee": true,
  "additionalFees": [
    "SEPA_WITHDRAWAL"
  ],
  "insurancePercent": "1",
  "slippagePercent": "2",
  "paymentTolerancePercent": "1.5",
  "webhookURL": "https://merchant.domain/webhooks/invoice",
  "returnURL": "https://merchant.domain/",
  "lifetime": 1,
  "currencies": [
    []
  ]
}
200Success
{
  "success": true,
  "response": {
    "id": "c02b226c-07f9-4a1a-bedb-1087fab230a6",
    "externalId": "merchantExternalId123",
    "externalUserId": "10099",
    "payerEmail": "[email protected]",
    "orderId": "4b3399ee-3690-4984-8c39-a911c8b0aad4",
    "orderLink": "https://payment.domain/4b3399ee-3690-4984-8c39-a911c8b0aad4",
    "invoiceLink": "https://invoices.domain/c02b226c-07f9-4a1a-bedb-1087fab230a6",
    "status": "INIT",
    "order": "Order #123456",
    "description": "Payment by order #123456",
    "currency": "USD",
    "amount": "20",
    "receivedNetwork": "USDT",
    "receivedCurrency": "USDT",
    "receivedAmount": "100.32",
    "receivedAmountInInvoiceCurrency": "100.94",
    "rate": "100.32",
    "includeFee": true,
    "additionalFees": [
      "SEPA_WITHDRAWAL"
    ],
    "insurancePercent": "1",
    "slippagePercent": "2",
    "paymentTolerancePercent": "1.5",
    "webhookURL": "https://merchant.domain/webhooks/invoice",
    "returnUrl": "https://merchant.domain/",
    "expiresAt": "2025-06-09T13:18:41.525Z",
    "createdAt": "2025-06-09T13:18:11.525Z",
    "currencies": [
      {
        "currency": "USDT",
        "networks": [
          {
            "name": "ethereum",
            "amount": "25"
          }
        ]
      }
    ]
  }
}

Last updated