---
title: Create Refund
slug: create-refund
docTags: 
createdAt: 2025-05-02T10:40:00.252Z
---

This API creates a refund order to enable merchants to refund a successfully processed transaction. It accepts amount and the order details.  &#x20;

This api requires access token that can be generated using [Access Token](docId\:lq-v6fF_2i-h1O3XD5KKA) API.

:::ApiMethodV2
```json
{
  "name": "Create Refund ",
  "method": "POST",
  "url": "https://your-hostname.pay3.app/v1/client/fiat-refund",
  "description": "Create an order with payout details from application's backend",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "eXhyHL9RWXfgU_lG6oq1Q",
        "language": "curl",
        "code": "curl --location 'https://your-hostname.pay3.app/v1/client/fiat-refund' \\\n--header 'signature': \"generated-signature\"\\\n--header 'access-token' : \"dynamic-access-token\" \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"fiatAmount\": \"0.02\",\n    \"requestId\": \"9824649238\",\n    \"clientId\": \"your-client-id\"\n}'",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "eXhyHL9RWXfgU_lG6oq1Q"
  },
  "results": {
    "languages": [
      {
        "id": "VQyRchSR38UbBEhATUpjh",
        "language": "200",
        "customLabel": "",
        "code": "{\n  \"requestId\": \"9824649238\",\n  \"refundId\": \"a35dc551-9fb4-491c-9f9b-44d9c2ef4b32\",\n  \"fiatAmount\": \"0.02\",\n  \"status\": \"REFUND_CREATED\"\n  }\n}\n"
      }
    ],
    "selectedLanguageId": "VQyRchSR38UbBEhATUpjh"
  },
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "signature",
        "kind": "required",
        "type": "string",
        "description": "Signature generated with sha256 followed by base64 encoding. Check below section for more details",
        "children": []
      },
      {
        "name": "access-token",
        "kind": "required",
        "type": "string",
        "description": "Access token received from Access token API. You can reuse the access token across multiple API calls till it is expired",
        "children": []
      }
    ],
    "bodyDataParameters": [
      {
        "name": "requestId",
        "kind": "required",
        "type": "string",
        "description": "The requestId used to create the parent order. ",
        "": "The requestId used to create the parent order. "
      },
      {
        "name": "fiatAmount",
        "kind": "required",
        "type": "string",
        "description": "Amount user can be refunded in string format. This amount should be less than or equal to the parent order amount. Maximum two decimal places are allowed",
        "": "Amount user can be refunded in string format. This amount should be less than or equal to the parent order amount. Maximum two decimal places are allowed"
      },
      {
        "name": "clientId",
        "kind": "required",
        "type": "string",
        "description": "Client id. Application's identifier",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "create-refund",
  "legacyHash": "ndwJglHmBpAR2On-P5bTb"
}
```
:::

## Signature Generation

The request for creating payout order requires a header `signature`. This can be generated using following javascript code snippet.&#x20;

```javascript
const crypto = require('crypto');

// Required Parameters
const secretKey="Api-Secret-Provided-By-Pay3";
const fiatAmount =  "0.02";
const requestId = "Order-Id-Generated-By-Application";
const clientId = "your-client-id";
const accessToken = "dynamic-access-token";

const getSignature = (secretKey, fiatAmount, requestId) => {
    // Prepare the string to sign in same format. 
    // fiatAmount followed by requestId
    const stringToSign = 'fiatAmount=' + fiatAmount + '&requestId=' + requestId;
    
    // Generating signature using SHA256 and provided secret and
    // base64 encode the result
    const mac = crypto.createHmac('sha256', secretKey);
    return mac.update(stringToSign).digest('base64');
}

// Generate Signature
const signature = getSignature(secretKey, fiatAmount, requestId);

```

***

