# 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

| Parameter name | Data type | Value                                                                                                                       | Example                                                                                                              | Description                      |
| -------------- | --------- | --------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| status         | string    | success                                                                                                                     | success                                                                                                              | Request execution status         |
| invoice\_id    | string    | id                                                                                                                          | DZLF4212                                                                                                             | Unique payment identifier        |
| amount\_crypto | decimal   | sum                                                                                                                         | 0.4567                                                                                                               | Payment amount in cryptocurrency |
| currency       | string    | <p>BTC</p><p>LTC</p><p>ETH</p><p>USDT\_TRC20<br>USDT\_ERC20<br>USDC\_TRC20<br>USDC\_ERC20<br>TUSD\_TRC20<br>TUSD\_ERC20</p> | BTC                                                                                                                  | Currency code                    |
| order\_id      | string    | id                                                                                                                          | ORD99999                                                                                                             | Store order identifier           |
| token          | string    | token                                                                                                                       | eyJ0eXAiOiJKV1QiLCJhbGciOiJIAcI1NiJ9.eyJpZCI6MTMsImV4cCI6MTYzMTc4NjQyNn0.HQavV3z8dFnk56bX3MSY5X9lR6qVa9YhAoeTEHkaAzs | JWT token                        |

{% hint style="info" %}
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.
{% endhint %}

## Response example

```json
{
   "status": "success",
   "invoice_id": “DZLF4212”,
   "amount_crypto": 0.4567,
   "currency": “BTC“,
}
```

## Example of POSTBACK processor

{% tabs %}
{% tab title="Python" %}

```python
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)
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const express = require('express');
const app = express();

app.use(express.json());

app.post('/postback', (req, res) => {
    const { status, invoice_id, amount_crypto, currency, order_id, token } = req.body;
    
    // ... your code for processing postback ...
    
    res.json({ message: 'Postback received' });
});

app.listen(3000, () => {
    console.log('Server is running on port 3000');
});
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cryptocloud.plus/en/api-reference-v1-old/postback.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
