﻿# Refund Inquiry
### 1. API Parameters
For details, please refer: [API](https://docs.payermax.com/api.html?docName=New%20Version&docVer=v1.0&docLang=en#/paths/aggregate-pay-api-gateway-refundQuery/post)
 
Endpoint：refundQuery
Sign rule：[Rule](https://docs.shareitpay.in/#/30?page_id=647 "Rule")
>Request Parameters

| Parameter       | Type   | If Required | Max. Length | Description                                                                                     | Example                          |
| --------------- | ------ | ----------- | ----------- | ----------------------------------------------------------------------------------------------- | -------------------------------- |
| version         | String | M           | 8           | API version. Current value: 1.1                                                                 | 1.1                              |
| keyVersion      | String | M           | 8           | Signature Algorithm Version, Current value: 1                                                   |                                  |
| requestTime     | String | M           | 32          | Request time, compliant with rfc3339 specification, format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX        |                                  |
| appId           | String | M           | 64          | Merchant App Id, the unique identifier assigned to the merchant app by PayerMax                 | 46153e2b787241ae8b01857bb087d1bd |
| merchantNo      | String | O           | 15          | Merchant ID, the unique identifier generated when the merchant signs the contract with PayerMax | 010229810189301                  |
| +data           | Object | M           |             | request data body                                                                               |                                  |
| 「outRefundNo   | String | O           | 64          | Original merchant refund order id                                                               |                                  |
| 「refundTradeNo | String | O           | 64          | PayerMax refund order id, choose one of the outRefundNo and refundTradeNo                       |                                  |

>Response Parameters

| Parameter        | Type   | If Required | Max. Length | Description                                                                                                                                                 | Example |
| ---------------- | ------ | ----------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| code             | String | M           | 32          | Return code, 'APPLY_SUCCESS' means success                                                                                                                  |         |
| msg              | String | M           | 256         | Response description,'Success.'                                                                                                                             |         |
| +data            | Object | C           |             |                                                                                                                                                             |         |
| 「outRefundNo    | String | C           | 64          | Merchant refund order id                                                                                                                                    |         |
| 「refundTradeNo  | String | C           | 64          | PayerMax refund order id                                                                                                                                    |         |
| 「refundAmount   | Number | C           | (20,4)      | The amount of the refund, the unit of the amount is yuan, and it will be returned according to the decimal point supported by the currency of each country. |         |
| 「refundCurrency | String | C           | 3           | Refund currency (original transaction currency)                                                                                                             |         |
| 「outTradeNo     | String | C           | 64          | Original merchant order id                                                                                                                                  |         |
| 「status         | String | C           | 32          | the status of refund，Please refer to[【Refund status】](https://docs.payermax.com/en/202606-version/appendix/collection/refund-status.md)                                              |         |
| 「resultMsg      | String | C           | 256         | the reason of refund status，it only has a value when it fails                                                                                              |         |
# 2. Sample Code
>Refund inquiry request

```json
{
    "version": "1.1",
    "keyVersion": "1",
    "requestTime": "2022-01-17T07:01:23.737+00:00",
    "appId": "a0dddd1f622243cb9aa1b676e808b5f8",
    "merchantNo": "02021382719993",
    "data": {
        "outRefundNo": "R1642411016202"
    }
}
```
>Refund Inquiry Response

```json
{
  "code": "APPLY_SUCCESS",
  "msg": "Success.",
  "data": {
    "outRefundNo": "R1642411016202",
    "refundTradeNo": "20220117091657TI790000055087",
    "refundAmount": 10000,
    "refundCurrency": "IDR",
    "outTradeNo": "P1642410680681",
    "status": "REFUND_SUCCESS"
  }
}
```
