# 4.4. Callback

## 1. Payment Callback <a href="#id-1overview" id="id-1overview"></a>

### 1.1. Overview <a href="#id-1overview" id="id-1overview"></a>

Uses callBackUrl to send the payment result to the merchant when the payment processing reaches a final state of success or failure. Merchants promote merchant-side transactions based on the payment result.

Note: If the merchant response is { "transResult": "SUCCESS" } , the callback notification will stop. If not,the callback notification will be performed every 5 minute,After 3 retries, the callback notification will be stopped.

### 1.2. Request Info <a href="#id-2request-info" id="id-2request-info"></a>

* **Method: post**
* **Path: The callBackUrl parameter when the** [**Payment**](https://newpay-api-document.gitbook.io/newpay-api-document/4.-apis-v1-deprecated/broken-reference)

#### 1.2.1 Request Header <a href="#id-21-request-header" id="id-21-request-header"></a>

| Key          | Value            |
| ------------ | ---------------- |
| Content-Type | application/json |

#### 1.2.2 Request Data <a href="#request-data" id="request-data"></a>

| Name             | Description                                                                                                | Type   |
| ---------------- | ---------------------------------------------------------------------------------------------------------- | ------ |
| appId            | Unique identifier assigned to a third-party application platform                                           | string |
| payMethod        | Payment method: 1.NewPay; 4.MasterCard;                                                                    | int    |
| orderAmt         | Payment amount                                                                                             | string |
| currency         | Payment currency, LAK/USD                                                                                  | string |
| newpayOrderNo    | Newpay order number                                                                                        | string |
| orderNo          | Order number                                                                                               | string |
| subject          | Commodity title                                                                                            | string |
| transStatus      | Payment result: 0-success; 1-failure                                                                       | int    |
| transInfo        | The reason for failure                                                                                     | string |
| settlementStatus | Settlement status: 1-no settlement; 2-have already settled                                                 | int    |
| timestamp        | Callback execution time                                                                                    | string |
| extra            | Third party order supplementary fields                                                                     | string |
| sign             | [Data signature](https://newpay-api-document.gitbook.io/newpay-api-document/8.-signature-and-verification) | string |

### 1.3. Example Data <a href="#id-3-example-data" id="id-3-example-data"></a>

#### 1.3.1 Request (Request Merchant) <a href="#id-31-request-request-merchant" id="id-31-request-request-merchant"></a>

```json
{
    "orderNo":"202209067002502223",
    "subject":"1",
    "transInfo":"Transaction Success",
    "sign":"RUgPFHojyrvmGpIGxzdzHG6BlxDn9Ei...",
    "orderAmt":"123.00",
    "newpayOrderNo":"202209210000006950",
    "settlementStatus":1,
    "payMethod":1,
    "extra":"",
    "appId":6,
    "currency":"LAK",
    "transStatus":0,
    "timestamp":1663738614280
}
```

#### 1.3.2 Response（Merchant's response） <a href="#id-32-response-merchants-response" id="id-32-response-merchants-response"></a>

```json
{
    "transResult": "SUCCESS"
}
```

## 2. Refund Callback

### 2.1. Overview <a href="#id-1overview" id="id-1overview"></a>

Uses callBackUrl to send the refund result to the merchant when the refund processing reaches a final state of success or failure. Merchants promote merchant-side transactions based on the refund result.

Note: If the merchant response is { "transResult": "SUCCESS" } , the callback notification will stop. If not,the callback notification will be performed every 5 minute,After 3 retries, the callback notification will be stopped.

### 2.2. Request Info <a href="#id-2request-info" id="id-2request-info"></a>

* **Method: post**
* **Path: The callBackUrl parameter when the** [**Refund**](https://newpay-api-document.gitbook.io/newpay-api-document/4.-apis-v1-deprecated/4.3.-common-apis/4.3.2-refund)

#### 2.2.1 Request Header <a href="#id-21-request-header" id="id-21-request-header"></a>

| Key          | Value            |
| ------------ | ---------------- |
| Content-Type | application/json |

#### 2.2.2 Request Data <a href="#request-data" id="request-data"></a>

| Name                | Description                                                                                                | Type   |
| ------------------- | ---------------------------------------------------------------------------------------------------------- | ------ |
| appId               | Unique identifier assigned to a third-party application platform                                           | string |
| payMethod           | Payment method: 1.NewPay; 4.MasterCard;                                                                    | int    |
| refundOrderAmt      | Payment amount                                                                                             | string |
| currency            | Payment currency, LAK/USD                                                                                  | string |
| newpayOrderNo       | Newpay order number                                                                                        | string |
| newpayRefundOrderNo | Newpay refund order number                                                                                 | string |
| orderNo             | Order number                                                                                               | string |
| refundOrderNo       | Order number                                                                                               | string |
| tranStatus          | Payment result: 1-success; 0-failure                                                                       | int    |
| transInfo           | The reason for failure                                                                                     | string |
| timestamp           | Callback execution time                                                                                    | string |
| sign                | [Data signature](https://newpay-api-document.gitbook.io/newpay-api-document/8.-signature-and-verification) | string |

### 2.3. Example Data <a href="#id-3-example-data" id="id-3-example-data"></a>

#### 2.3.1 Request (Request Merchant) <a href="#id-31-request-request-merchant" id="id-31-request-request-merchant"></a>

```json
{
    "orderNo":"202209067002502223",
    "refundOrderNo":"202209067002502232",
    "transInfo":"Transaction Success",
    "transStatus":0,
    "sign":"RUgPFHojyrvmGpIGxzdzHG6BlxDn9Ei...",
    "refundOrderAmt":"123.00",
    "newpayOrderNo":"202209210000006950",
    "newpayRefundOrderNo":"202209210000006950",
    "payMethod":1,
    "appId":6,
    "currency":"LAK",
    "transStatus":0,
    "timestamp":1663738614280
}
```

#### 2.3.2 Response（Merchant's response） <a href="#id-32-response-merchants-response" id="id-32-response-merchants-response"></a>

```json
{
    "transResult": "SUCCESS"
}
```
