Postback Data

When you set a postback URL, after each transaction we’ll send a POST request with a JSON body in the following shape:

{
  "postback_secret": "xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "postback_type": "transaction",
  "tx_id": 67890,
  "tx_hash": "abcdef1234567890",
  "tx_type": "invoice",
  "label": "Order #1234",
  "currency": "USDTBEP20",
  "amount": 1000.00,
  "amount_usd": 1000.00,
  "network_fee": 0.00,
  "network_fee_usd": 0.00,
  "service_fee": 5.00,
  "service_fee_usd": 5.00,
  "received_amount": 500.00,
  "received_amount_usd": 500.00,
  "status": "paid",
  "created_at": "2025-05-24T15:00:00Z"
}

Field Reference

Field
Type
Description

postback_secret

string

Your postback secret from profile page

postback_type

string

Postback type (transaction, wallet_expired, invoice_expired)

tx_id

int

Internal transaction ID in our system

tx_hash

string

On-chain transaction hash

tx_type

string

invoice (payment to an invoice) or wallet (direct wallet transfer)

label

string

Your custom label passed in when creating the invoice or wallet

currency

string

Currency code; here USDTBEP20

amount

float

Amount in the original currency (before fees)

amount_usd

float

USD equivalent at the time of invoice creation (for stablecoins this will typically match)

network_fee

float

Network fee of a currency

network_fee_usd

float

USD equivalent of the network fee

service_fee

float

Our service fee

service_fee_usd

float

USD equivalent of the service fee

received_amount

float

Amount received for all payments per invoice (For invoices only)

received_amount_usd

float

USD equivalent of the net received amount

status

string

Transaction status. Possible values: paid, partially_paid

created_at

string

ISO 8601 timestamp when the transaction was created

Example

Flask

from flask import Flask, request, jsonify, abort
import os

app = Flask(__name__)
SHARED_SECRET = os.environ.get("POSTBACK_SECRET")

@app.route('/postback', methods=['POST'])
def postback():
    data = request.get_json()

    # Verify that the incoming secret matches
    if data.get("postback_secret") != SHARED_SECRET:
        abort(401)

    # Remove secret before further processing
    data.pop("postback_secret", None)

    # TODO: handle the transaction data
    # e.g. save to database, update order status, etc.

    return jsonify({"status": "ok"}), 200

FastAPI

from fastapi import FastAPI, Request, HTTPException
import os

app = FastAPI()
SHARED_SECRET = os.getenv("POSTBACK_SECRET")

@app.post("/postback")
async def postback(request: Request):
    payload = await request.json()

    # verify the shared secret
    if payload.get("postback_secret") != SHARED_SECRET:
        raise HTTPException(status_code=401, detail="Unauthorized")

    # remove secret before processing
    payload.pop("postback_secret", None)

    # TODO: handle transaction data
    return {"status": "ok"}

Django

# urls.py
from django.urls import path
from . import views

urlpatterns = [
    path('postback/', views.postback),
]

# views.py
import os, json
from django.http import JsonResponse, HttpResponse
from django.views.decorators.csrf import csrf_exempt

SHARED_SECRET = os.getenv("POSTBACK_SECRET")

@csrf_exempt
def postback(request):
    if request.method != "POST":
        return HttpResponse(status=405)

    try:
        payload = json.loads(request.body)
    except json.JSONDecodeError:
        return HttpResponse(status=400)

    # verify the shared secret
    if payload.get("postback_secret") != SHARED_SECRET:
        return HttpResponse(status=401)

    # remove secret
    payload.pop("postback_secret", None)

    # TODO: handle transaction data
    return JsonResponse({"status": "ok"})

Last updated