Automatic POSTBACK

After successful payment execution, a POST request with information about the payment is sent to the notification URL specified in the project settings.

Request parameters

JWT token — response signature from the server. It is signed with a secret key generated in the project settings. Additionally, UUID of the invoice is added to the token. The token is valid for 5 minutes after the notification is created. It is generated each time a payment notification is sent.

The encryption algorithm is HS256.

Response example

{
    "status": "success",
    "invoice_id": "XXXXXXXX",
    "amount_crypto": 100,
    "currency": "USDT_TRC20",
    "order_id": "order_id",
    "token": b"token",
    "invoice_info": {
        "uuid": "INV-XXXXXXXX",
        "created": "2024-08-22 11:49:59.756692",
        "address": "address",
        "currency": {
            "id": 4,
            "code": "USDT",
            "fullcode": "USDT_TRC20",
            "network": {
                "code": "TRC20",
                "id": 4,
                "icon": "https://cdn.cryptocloud.plus/currency/crypto/TRX.svg",
                "fullname": "Tron"
            },
            "name": "Tether",
            "is_email_required": false,
            "stablecoin": true,
            "icon_base": "https://cdn.cryptocloud.plus/currency/icons/main/usdt.svg",
            "icon_network": "https://cdn.cryptocloud.plus/icons-currency/USDT-TRC20.svg",
            "icon_qr": "https://cdn.cryptocloud.plus/currency/icons/stroke/usdt.svg",
            "order": 1
        },
        "date_finished": "2024-08-22 11:51:53.753528",
        "expiry_date": "2024-08-23 11:49:59.746385",
        "side_commission": "client",
        "type_payments": "crypto",
        "amount": 100,
        "amount_": 100,
        "status": "overpaid",
        "invoice_status": "success",
        "is_email_required": false,
        "project": {
            "id": 0,
            "name": "My Project",
            "fail": "",
            "success": "",
            "logo": ""
        },
        "tx_list": [
            ""
        ],
        "amount_in_crypto": null,
        "amount_in_fiat": 0.0,
        "amount_usd": 100.0,
        "amount_to_pay": 102.0,
        "amount_to_pay_usd": 102.0,
        "amount_paid": 102.0,
        "amount_paid_usd": 102.0,
        "fee": 1.4,
        "fee_usd": 1.4,
        "service_fee": 0.8048,
        "service_fee_usd": 0.8,
        "received": 99.7952,
        "received_usd": 99.8,
        "to_surcharge": 0.0,
        "to_surcharge_usd": 0.0,
        "total_rub": 0,
        "step": 3,
        "test_mode": false,
        "type": "up",
        "aml_enabled": false,
        "aml_side": "merchant",
        "aml_checks": [],
        "links_invoice": null
    }
}

Example of POSTBACK processor

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/postback', methods=['POST'])
def handle_postback():
    data = request.json
    status = data.get('status')
    invoice_id = data.get('invoice_id')
    amount_crypto = data.get('amount_crypto')
    currency = data.get('currency')
    order_id = data.get('order_id')
    token = data.get('token')
    
    # ... your code for processing postback ...
    
    return jsonify({'message': 'Postback received'}), 200

if __name__ == '__main__':
    app.run(port=5000)

Last updated