Creating invoice

POST /api/public/v1/invoices

This endpoint creates invoices.

Headers

NameValue

Content-Type

application/json

Authorization

Bearer <api_key>

Body

NameTypeRequiredDescription

data.type

string

Yes

Can only be invoices.

data.attributes.amountBilled

string

Yes

Invoice amount to display to end users. Determines the amount due after conversion.

data.attributes.billedCurrency

string

Yes

Invoice currency to display to end users. Determines the currency due after conversion. Refer to supported currencies.

data.attributes.chargedCurrency

string

Yes

Crypto currency that customer must pay in. Refer to supported currencies.

data.attributes.network

string

Yes

Payment network. Refer to supported networks.

data.attributes.reference

string

No

The custom reference ID to tie the invoice to end-user who pays. This can be anything you choose.

cURL

curl -X "POST" "https://api.sandbox.txn.pro/api/public/v1/invoices" \
     -H 'Content-Type: application/vnd.api+json' \
     -H 'Authorization: Bearer <api_key>' \
     -d $'{
  "data": {
    "type": "invoices",
    "attributes": {
      "billedCurrency": "usd",
      "reference": "9556e207-b785-4faf-9486-8e79fb442e76",
      "network": "TTRX:USDT",
      "amountBilled": "100",
      "chargedCurrency": "USDT"
    }
  }
}'

Response

{
  "data": {
    "id": "55f7832f-9745-4553-8548-1a06e30fb251",
    "type": "invoices",
    "attributes": {
      "amountBilled": "1000.00",
      "amountCharged": "1011.233592",
      "billedCurrency": "USD",
      "chargedCurrency": "USDT",
      "reference": "9556e207-b785-4faf-9486-8e79fb442e76",
      "statusContext": "unpaid",
      "network": "TTRX:USDT",
      "networkName": "Tron (TRC20)",
      "status": "pending",
      "paymentStatus": "expecting",
      "exchangeRate": "0.9888912",
      "expiresAt": "2024-06-14T12:50:53.637Z",
      "createdAt": "2024-06-14T12:30:53.693Z"
    },
    "relationships": {
      "address": {
        "data": {
          "type": "addresses",
          "id": "b5c97775-1378-4170-a7f0-78c2c5d60720"
        }
      },
      "invoiceTransactions": {
        "meta": {
          "included": false
        }
      },
      "coinDeposits": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "included": [
    {
      "id": "b5c97775-1378-4170-a7f0-78c2c5d60720",
      "type": "addresses",
      "attributes": {
        "label": "USDT TTRX",
        "value": "TBq5k63KV9q4reE6JEF9e7wTYGo3RUkMQU",
        "createdAt": "2024-06-14T12:18:47.095Z"
      },
      "relationships": {
        "account": {
          "meta": {
            "included": false
          }
        },
        "network": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ],
  "meta": {},
  "jsonapi": {
    "version": "1.0"
  }
}

Last updated