﻿# Refund Application
The payment methods which support to refund refer to [Cashier Payment - Payment Method List] , Transactions are refundable within 180 days from the transaction date.
The time user receive the refund money depends on the processing time of banks or institutions.

### 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-refund/post)
 
Endpoint：refund
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                                                                                                                       | 2022-01-22T10:00:00.500+08:00    |
| 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 | M           | 64          | Merchant refund order id, uniquely identifying a refund application transaction                                                                                                                                |                                  |
| 「refundAmount    | Number | M           | (20,4)      | The amount of the refund, the unit of the amount is Yuan, and it is sent according to the decimal point supported by the currency of each country.                                                             |                                  |
| 「refundCurrency  | String | M           | 3           | Refund currency (original transaction currency)                                                                                                                                                                |                                  |
| 「outTradeNo      | String | M           | 64          | Original Merchant Order No.                                                                                                                                                                                    |                                  |
| 「comments        | String | O           | 512         | Refund Description (Reason for Merchant Refund)                                                                                                                                                                |                                  |
| 「refundNotifyUrl | String | O           | 256         | Refund callback link, which can be configured in the background of the system,see[【Configure the Callback Notification Address】](https://docs.payermax.com/en/202606-version/developer/config-settings.md) |                                  |

>Response Parameters

| Parameter       | Type   | If Required | Max. Length | Description                                                                           | Example |
| --------------- | ------ | ----------- | ----------- | ------------------------------------------------------------------------------------- | ------- |
| code            | String | M           | 32          | returned code，’APPLY_SUCCESS’means success                                         |         |
| msg             | String | M           | 256         | returned message，'Success.'                                                          |         |
| +data           | Object | M           |             |                                                                                       |         |
| 「outRefundNo   | String | M           | 64          | merchant refund order id                                                              |         |
| 「refundTradeNo | String | M           | 64          | PayerMax refund no                                                                    |         |
| 「tradeOrderNo  | String | M           | 64          | Transaction order id                                                                  |         |
| 「status        | String | M           | 32          | [Refund status](https://docs.payermax.com/en/202606-version/appendix/collection/refund-status "Refund status") |         |

# 2. Sample Code
>refund application

```json
{
    "version": "1.1",
    "keyVersion": "1",
    "requestTime": "2022-01-17T09:20:54.047+00:00",
    "appId": "3b242b56a8b64274bcc37dac281120e3",
    "merchantNo": "020213827212251",
    "data": {
        "outRefundNo": "R1642411016202",
        "refundAmount": 1000,
        "refundCurrency": "IDR",
        "outTradeNo": "P1642410680681",
        "comments": "20220117070423TI408900055079",
        "refundNotifyUrl": "https://www.payermax.com"
    }
}
```

>Refund Request Response

```json
{
    "code": "APPLY_SUCCESS",
    "msg": "Success.",
    "data": {
        "outRefundNo": "R1642411016202",
        "tradeOrderNo": "20220117091121TI366100056090",
        "refundTradeNo": "20220117091657TI790000055087",
        "status": "REFUND_PENDING"
    }
}
```
