# 4.3.2 Refund

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

Use this API to initiate a refund against a successful payment. The refund can be ***full or partial***. A transaction can have multiple refunds as long as the total refund amount is less than or equal to the original transaction amount. If the refund request is out of the refund window determined in the contract the refund request will be declined.

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

* **Method: post**
* **Path: <https://prod-openapi.newpay.la/api/open/converge/pay/v1/refund>**

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

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

### **2.2 Request Data** <a href="#id-22-request-data" id="id-22-request-data"></a>

| Name           | Description                                                                                                | Type      | Required |
| -------------- | ---------------------------------------------------------------------------------------------------------- | --------- | -------- |
| appId          | Unique identifier assigned to a third-party application platform                                           | string    | true     |
| merchantId     | Unique identifier assigned to a thired-party merchant                                                      | string    | true     |
| timestamp      | Request timestamp                                                                                          | timestamp | true     |
| sign           | [Data signature](https://newpay-api-document.gitbook.io/newpay-api-document/8.-signature-and-verification) | string    | true     |
| refundOrderAmt | Refund amount                                                                                              | string    | true     |
| orderNo        | Order number                                                                                               | string    | true     |
| refundOrderNo  | Refund order number                                                                                        | string    | true     |
| refundDesc     | Reason for refund                                                                                          | string    | true     |
| callBackUrl    | Refund callback address                                                                                    | string    | true     |

### **2.3 Response Data** <a href="#id-23-response-data" id="id-23-response-data"></a>

| Name                  | Description                                                                                               | Type    |
| --------------------- | --------------------------------------------------------------------------------------------------------- | ------- |
| success               | Success flag: true/false                                                                                  | boolean |
| message               | Response message                                                                                          | string  |
| code                  | [Reponse code](https://newpay-api-document.gitbook.io/newpay-api-document/9.-business-code#response-code) | string  |
| timestamp             | Response timestamp                                                                                        | long    |
| data                  | Result                                                                                                    | object  |
| > appId               | Unique identifier assigned to a third-party application platform                                          | string  |
| > sign                | Data signature                                                                                            | string  |
| > tranStatus          | transaction status: 1-success;0-failure                                                                   | int     |
| > tranInfo            | transaction information                                                                                   | string  |
| > refundOrderAmt      | Refund amount                                                                                             | string  |
| > payMethod           | Payment method: 1.NewPay; 4.MasterCard;                                                                   | int     |
| > currency            | Payment currency, LAK/USD                                                                                 | string  |
| > orderNo             | Order number                                                                                              | string  |
| > refundOrderNo       | Refund order number                                                                                       | string  |
| > newpayRefundOrderNo | Refund order number in NewPay                                                                             | string  |

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

### **3.1 Request** <a href="#id-31-request" id="id-31-request"></a>

```json
{
    "appId": "3514d69403bc4ce1a8fafb6415a31018",
    "timestamp": {{current_timestamp}},
    "sign": "{{sign}}",
    "refundOrderAmt": 50000,
    "merchantId": "876266cdc7154dd08a022fd1f2eace55",
    "orderNo": "ORDERNO000000000A104",
    "refundOrderNo": "ORDERNORFD000000000A104",
    "refundDesc": "reason",
    "callBackUrl": "www.google.com"
}
```

### **3.2 Response** <a href="#id-32-response" id="id-32-response"></a>

```json
{
    "success": true,
    "message": "success",
    "data": null,
    "code": "0",
    "timestamp": "1662528697925"
}
```
