Buy

The Buy endpoint converts a successful calculation into a pending invoice. This step initiates the purchase process, providing your user with a window to confirm the final weight, price, and total amount before the transaction is finalized.

ℹ️

Invoice Status: All invoices created via this endpoint start with a pending status. You must subsequently notify Treasury to either confirm or cancel the transaction based on the user's action.

Create Buy Invoice

POST /asset/transaction/buy

Headers

Header / TypeConditionDescription
Authorizationstring
required
Bearer token retrieved from the Authentication endpoint.
X-User-Idstring
optional-when
X-Partner-User-Id
Unique user identifier from Treasury.
X-Partner-User-Idstring
optional-when
X-User-Id
Your internal user identifier.

Request Body

Field / TypeConditionDescription
calculate_uidstring
required
The unique ID received from the Calculate process.
reference_idstring
optional
Your internal invoice or transaction number from the partner side. Highly recommended to prevent reconciliation mismatches.

Response

Sample Response (200 OK)

json
{
  "code": 200,
  "data": {
    "status"      : "pending",
    "invoice_code": "GBA...",
    "reference_id": "x...",
    "transaction" : {
      "asset_type"       : "gold",
      "asset_grams"      : 0.05,
      "amount"           : 132481,
      "commission_amount": 2103,
      "adjustment_amount": 500,
      "buy_price"        : 2633639,
      "sell_price"       : 2549192,
      "transaction_at"   : "2026-01-01T12:00:00+07:00",
      "expired_at"       : "2026-01-01T12:10:00+07:00"
    }
  }
}