Invoice API

To find out how to create an API key visit API key page.

The merchant API uses Bearer authentification via HTTP headers. You need to provide the header ‘Authorization‘ with your API key that can be found in merchant panel. Each request must have the header in the following format: Authorization: Bearer <API_KEY>

Create invoice

Endpoint

POST /api/invoice

Request body

{
  "order_id": "string",
  "number": 0,
  "title": "string",
  "currency": {
    "Crypto": "Btc"
  },
  "items": [
    {
      "amount": "345200",
      "name": "VPN subscription 1 month"
    },
    {
      "amount": "42345200",
      "name": "10GB RAM stick"
    }
  ],
  "due_date": "2023-12-28T12:39:14",
  "callback_url": "string"
}

Description

  • order_id is optional unique ID that can be used to identify the invoice by the merchant service. Thai Digital Wallet always assigns a new UUID to the invoice as primary ID, so the field is optional.
  • number is optional numeric number for customer. That field is displayed in the page when the customer is redirected to the invoice.
  • title is mandatory field that is displayed in the invoice to the customer.
  • currency is mandatory field that specifies which currency to use for the invoice. The table of accepted values is located here
  • items is mandatory field that holds info about goods the customer is paying for. Amounts are specified in integral format with respect of decimal fields in the currencies section. For the USD the decimals value is 2. So the value of 2500 is translated to 25$.
  • due_date is a deprecated field and does nothing
  • callback_url is optional field that specifies customer return location. Thai Digital Wallet redirects the customer to the specified URL after the payment of the invoice is finished.

Response

The endpoint returns 200 HTTP status with single quoted string for created invoice ID: cdc13370-dbfd-499a-9a97-d23d703f8135 The endpoint returns the following JSON response if some error is occured (non 200 status):

{
    "error": {
        "code": 0 ,
        "reason": "string",
        "description": "string"
    }
}

View invoice

Endpoint

GET /api/invoice?id=<uuid>

Response

{
    "id": "uuid",
    "external_order_id": "external id",
    "external_number": 0,
    "tittle": "optional title",
    "currency": {
        "Crypto": "Btc"
    },
    "items": [
        {
        "amount": "345200",
        "name": "VPN subscription 1 month"
        },
        {
        "amount": "42345200",
        "name": "10GB RAM stick"
        }
    ],
    "created_date": "1970-12-31T00:00",
    "due_date": "deprecated",
    "choosen": {...},
    "status": "InvoiceStatus",
    "state": "InvoiceState",
}