Skip to main content

Receive Purchase Webhooks

XGate sends an event to your URL on every status change of a crypto purchase.


Setup​

The setup is the same as for the other webhooks (see Receiving Webhooks): in the XGate dashboard, Webhooks menu, select the event type Crypto Purchases (CRYPTO_PURCHASE) and the statuses you want to receive.

The CRYPTO_PURCHASE type only appears for companies with crypto enabled.


Event format​

Envelope differs from deposit and withdrawal webhooks

Crypto events do not use the flat format of the deposit and withdrawal webhooks (id, status, amount, operation...). They come in an envelope with id, type, createdAt and data.

  • Method: POST
{
"id": "evt_6ad6d669b2be17e22bbec226_DELIVERED",
"type": "purchase.delivered",
"createdAt": "2026-10-13T14:11:40.031Z",
"data": {
"id": "6710c2f4a1b2c3d4e5f60718",
"externalId": "order-7781",
"status": "DELIVERED",
"asset": "USDT",
"network": "TRON",
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"amount": "1500.00",
"deliveredAmount": "270.890088",
"txHash": "9f2c1e7b0a…",
"rejection": null,
"updatedAt": "2026-10-13T14:11:40.031Z"
}
}

Event envelope​

FieldTypeDescription
idstringUnique event ID. Use to discard duplicate deliveries.
typestringEvent type (table below).
createdAtstringEvent creation date (ISO 8601, UTC).
dataobjectPurchase summary (table below). The full object is in Get Purchase.

Fields in data (purchase summary)​

FieldTypeDescription
idstringPurchase ID at XGate. Use in GET /crypto/purchases/{id}.
externalIdstringOrder ID in the integrator's system.
statusstringPENDING_PAYMENT · EXECUTING · PENDING_APPROVAL · DELIVERED · REJECTED · EXPIRED.
assetstringPurchased asset.
networkstringDelivery network.
addressstringDestination wallet.
amountstringDebited BRL amount.
deliveredAmountstring | nullQuantity delivered (or to be delivered) to the wallet. null before execution.
txHashstring | nullOn-chain hash in DELIVERED. null before delivery.
rejectionobject | nullOnly in REJECTED: { reason, refunded }. null in other statuses.
updatedAtstring (ISO)Last update; use with status to sort out-of-order events.

Events​

Event (type)Dashboard statusWhen
purchase.pending_paymentPENDING_PAYMENTOnly in purchases opened from a deposit: awaiting Pix payment.
purchase.executingEXECUTINGBRL debited from balance (usually before the 201 response of POST).
purchase.pending_approvalPENDING_APPROVALPurchase entered XGate's approval queue.
purchase.deliveredDELIVEREDCrypto confirmed on the network; data.txHash populated. Final.
purchase.rejectedREJECTEDPurchase not delivered; data.rejection provides reason and refunded. Final.
purchase.expiredEXPIREDSource deposit was not paid in time. Final.

Rules for the integrator​

  • One event per status change, sent once. Internal transitions within EXECUTING do not trigger events.
  • At-least-once delivery: the same event may arrive more than once. Handle idempotency using the event id.
  • Order: events may arrive out of order. Sort by data.updatedAt and data.status.
  • Respond 200 quickly, as with the other webhooks.
  • A purchase rejected before debit (422 error on POST) generates only the purchase.rejected event.