# Callback notification

{% hint style="info" %}
TIP

After the payment is completed, the payment center will send the relevant payment results and relevant information to the merchant, and the merchant needs to receive processing and return the response. When interacting with background notifications, if the payment center receives a merchant response that is not successful or times out, the payment Center 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 system. And the merchant system must be able to handle correctly the same notification. Recommended practices are as follows. When processing a notification, firstly checking the status of the corresponding service data 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

Attention: The merchant system must do signature verification for the content of the order callback, and verify whether the returned order amount is consistent with the order amount. The reason for doing these to prevent data leakage resulting in "false notice" resulting in loss of funds.
{% endhint %}

### Interface address <a href="#interface-address" id="interface-address"></a>

```
The notify url parameter submitted by the POST unified order interface is set. If you cannot access the link, your service system cannot receive the notification from the payment center.
```

### Request Body <a href="#request-body" id="request-body"></a>

| 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 SUCCESS.                                                                                                                                             |             |
| resource         | object | Notification resource data                                                                                                                                                                                          |             |
| » original\_type | string | The original callback type is transaction                                                                                                                                                                           |             |
| » 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 [TransactionNotifyDetail](/description/data-structure.md#transaction-detail). |             |
| » nonce          | string | Encrypt using random strings                                                                                                                                                                                        |             |

### Request example <a href="#request-example" id="request-example"></a>

```json
{
	"app_id": "xxxxx",
	"mch_id": "zzzzzz",
	"create_time": "2023-06-26T17:21:17.754429+08:00",
	"resource_type": "encrypt-resource",
	"event_type": "TRANSACTION.SUCCESS",
	"resource": {
		"original_type": "transaction",
		"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 <a href="#return-example" id="return-example"></a>

```
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/wallet/callback-notification.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.
