# Callback

{% hint style="info" %}
TIP

After the payout is completed, the system will send the relevant payout results and information to the merchant, and the merchant needs to receive and return the response. When interacting with background notifications, if the system receives a merchant response that is not successful or times out, the system considers the notification to have failed. The notification will be re-initiated periodically according to a certain policy to maximize the success rate of the notification, but there is no guarantee that the notification will be successful. （The notification frequency is 0s/15s/30s/3m/10m/20m/30m/60m/3h/6h）
{% endhint %}

{% hint style="warning" %}
WARNING

Note: The same notification may be sent multiple times to the merchant. And the merchant must be able to handle correctly the duplicate notification. Recommended practices are as follows, When processing a notification, firstly checking the status of the payout to determine whether the notification has been processed. If no, process it again. If yes, direct return a success result. Before state checking and processing of business data, concurrency control is performed using data locks to avoid data chaos caused by function reentrant.
{% endhint %}

{% hint style="danger" %}
DANGER

Merchants must do signature verification on the content of the payout callback and check whether the returned payment amount is correct, to prevent data leakage and the emergence of “fake notification”, resulting in loss of funds.
{% endhint %}

## **POST**

{% code fullWidth="false" %}

```
The notify url parameter submitted by the 'Create Payout'. If the link cannot access, 
your merchant cannot receive the notification from the system.
```

{% endcode %}

## **Request Body**

| Name             | Type   | Description                                                                                                                                                                                                        | Description |
| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| app\_id          | string | Application                                                                                                                                                                                                        |             |
| mch\_id          | string | Merchant                                                                                                                                                                                                           |             |
| create\_time     | time   | Notification time                                                                                                                                                                                                  |             |
| resource\_type   | string | The resource data type of the notification. Payment success notification is encrypt-resource                                                                                                                       |             |
| event\_type      | string | Notification type. The type of payment success notification is PAYPAYOUT.SUCCESS.                                                                                                                                  |             |
| resource         | object | Notification resource data                                                                                                                                                                                         |             |
| » original\_type | string | The original callback type is payout                                                                                                                                                                               |             |
| » algorithm      | string | Currently, only AES-256-ECB is supported for the encryption algorithm that encrypts the result data                                                                                                                |             |
| » ciphertext     | string | Base64 encoded on/off result data ciphertext. If enabled, the encrypted content is returned. After decryption, it is a json string of [PayoutTransactionDetail.](/description/data-structure.md#payanother-detial) |             |
| » nonce          | string | Encrypt using random strings                                                                                                                                                                                       |             |

## **Request example**

```json
{
	"app_id": "xxxxx",
	"mch_id": "zzzzzz",
	"create_time": "2023-06-26T17:21:17.754429+08:00",
	"resource_type": "encrypt-resource",
	"event_type": "PAYPAYOUT.SUCCESS",
	"resource": {
		"original_type": "payout",
		"algorithm": "AEAD_AES_256_GCM",
		"ciphertext": "I/psKgdkVwxbkEIWtwRxfxLzViuRS+gJTQSdLf+lmK7awoqUcIJisTAJx0Qbv4K6wV8WgyMRFYHD5CCLKmFNU2OnmEm2f2vGhaoS2h28A9BEGx1CWEUw3tfldf/+VWlBAnIBylFjHzbSo7fgn7S3fFEAZHTxoy+9jNIoynqHZbn4Y6eucj1YCw0ZmuKHPpPPrvclbhHmaZHfau+SKyag3C0/cj7zu4mBkRZ39zuk9B7DAADzaRENOZ/ZyibU+zs3gibnCbI2NWEnQWIiCi7vK0jq/FCBWytHihQM364zlVrPPCBDbv2MSqk4fyAM7IDeT6h/z/2kmDOQ6aFPYlLojIkgCCOIevQITS9E+BS1rgmmH+DRKsJNiD257aLhX2/F53VEnjfqqKdDs2lqfX0dCMLqselGUT981fFKceXg+r6hQqcUzLlF28XL5NrfVPreRDo6jI2K0tCy9cOx+cxH3yoDzOFBzM0RlxWqvUhRsMv9ZGfpgCZ0o9HxNObqLjVCQzE5SWPXvmkw+QpWk0oNUvpCEDhj9Vfq6XCV8j3tT3tZTYCa5UQy9VCdmval/2vb50QaAgDYXU6PH/9Xv7AXg6kg29iK+Ec0euxZxosRoVczzRg+0Arl/zvBcphWNIUTdx5IcA12WtP+krk9NNGtj7igk21DhcseJrKBpG7ll9O/Wmq1L8BwW+ypuJS+kHV61jRNYMFJY48Pt11Zoukgqu94kzrhz+KET8q463zlyu/Kp2z5yWI8xwvOtuyjosszfm6/YFQTFdhcmHY3X1yz44NaVG9FPev1QPoPmI7K3Jqa0Q8Q5kQTbe/KrB0eyRpXtyAaShOEeiS2ypmFAC81/m4mjuTd24yAjBcTIfBYzjxwjPbKfv+OYKahDwJP1b7EhsM+Sgu48wQ+pp6wc8TYCOkiRR1pKeb3kaxpQGzlq7VNbWHFPw9TDiyCIEnr8T5eiJtzJJ0U0iIfqN5WHk7iHiNK4Y4TvmdF4f6UyeMTHvaprvzUZI8il5wvoCgIiRUY7qvv5V/KL4ZWHN6Y3EEvQmP4WDo3Wx5IFW8C1gkyFv8lQ1COSNYMPog6RLAI0rNvKZjvc4baWwcHmk/fM92X19F2Y0DArqLFFUTJVE5bUQXQexiUO1e8IL07wqY=",
		"nonce": "d8816e8d6dca4409b790a4bcaa25c621"
	}
}
```

## **Return example**

```
success
```

Please return `success` to notify the notification server after successfully receives the callback request. After the notification server receiving `success`, the notification stops. Otherwise, the notification will be sent 10 times at the frequency of 0s/15s/30s/3m/10m/20m/30m/60m/3h/6h.


---

# 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://apidoc.tokenpay.me/payout/callback.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.
