---
title: "Create Refund"
source_url: https://docs.rapyd.net/en/create-refund.html
lang: en
---

# Create Refund

Refund of a payment.

The refund is credited against a specific payment. The money is returned to the payment method that was used for the payment, and the currency is the same as what was used in the payment.

If the action of a third party is not required, this method triggers the [Refund Completed Webhook](https://docs.rapyd.net/en/refund-completed-webhook.md "Refund Completed Webhook"). This webhook contains the same information as the response.

The following asynchronous webhooks provide information about later changes to the refund:

- [Refund Completed Webhook](https://docs.rapyd.net/en/refund-completed-webhook.md "Refund Completed Webhook")
- [Refund Rejected Webhook](https://docs.rapyd.net/en/refund-rejected-webhook.md "Refund Rejected Webhook")

> **Note:**
>
> - The payment must be in **closed** status.
> - If you are running this method in the sandbox and the payment method requires the action of a third party, run [Complete Refund](https://docs.rapyd.net/en/complete-refund.md "Complete Refund") to complete your simulation.
> - To refund a payment where the funds are collected from two or more payment methods, see [Create Group Refund](https://docs.rapyd.net/en/create-group-refund.md "Create Group Refund").
> - Some payment methods do not support refunds. See [List Payment Methods by Country](https://docs.rapyd.net/en/list-payment-methods-by-country.md "List Payment Methods by Country").
> - All wallets in the `ewallets` array must specify `amount` or all wallets must specify `percent`.
> - To create a full or partial refund of a payment that included FX, you must specify both the `amount` and `currency` that the customer will receive.
> - Disputed payments cannot be fully refunded.
> - The code samples include successful requests (200) and bad requests (400).
>
>   - For error messages that appear due to bad requests (400), see:
>
>     - [General Errors](https://docs.rapyd.net/en/general-errors.md "General Errors")
>     - [Refund Errors](https://docs.rapyd.net/en/refund-errors.md "Refund Errors")
>   - For information about unauthorized request (401) and other authentication errors, see [Troubleshooting Authentication and Authorization Errors](https://docs.rapyd.net/en/troubleshooting-authentication-and-authorization-errors.md "Troubleshooting Authentication and Authorization Errors").

### Parameters

### Request Header Parameters

- - access_key
  - Unique access key provided by Rapyd for each authorized user.

    See [Developers](https://docs.rapyd.net/en/developers.md "Developers").
- - Content-Type
  - Indicates that the data appears in JSON format. Set to **application/json**.
- - idempotency
  - A unique key that prevents the platform from creating the same object twice.

    See [Idempotency](https://docs.rapyd.net/en/idempotency.md "Idempotency").
- - salt
  - Random string. Recommended length: 8-16 characters.
- - signature
  - Signature calculated for each request individually.

    See [Request Signatures](https://docs.rapyd.net/en/request-signatures.md "Request Signatures").
- - timestamp
  - Timestamp for the request, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time") (seconds).

### Request Body Parameters

- - amount
  - The amount of the refund. Decimal.
- - currency
  - The currency of the amount received by the original payment source. Three-letter ISO 4217 code.
- - ewallets
  - An array of objects that represent wallets that the refund is charged to.

    - - ewallet
      - ID of the wallet, a string starting with **ewallet_**.
    - - amount
      - The amount to release to this wallet. Relevant when `percentage` is not set.
    - - percentage
      - The percentage of this escrow to release to this wallet. Relevant when `amount` is not set. On a partial release after the first, this refers to the percentage of the original amount of the escrow.
- - merchant_reference_id
  - Identifier defined by the client for reference purposes. Limit: 45 characters.
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - payment
  - ID of the `payment` object that the refund is charged against. String starting with **payment_**.
- - reason
  - Description of the reason for the refund.

### Response Parameters

- - amount
  - Amount of the refund, in units defined by `currency` in the original payment.
- - created_at
  - Time of creation of this refund, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - currency
  - The currency of the amount received by the original payment source. Three-letter ISO 4217 code.
- - ewallets
  - Array of objects that define the allocation of the refund to multiple wallets.

    - - ewallet
      - ID of the wallet, a string starting with **ewallet_**.
    - - amount
      - The amount refunded to this wallet. Relevant when `percentage` is not set.
    - - percentage
      - The percentage of this payment refunded to this wallet. Relevant when `amount` is not set.
- - failure_code
  - Indicates the reason that the refund failed. See [Card Network Errors](https://docs.rapyd.net/en/card-network-errors.md "Card Network Errors").
- - failure_reason
  - Indicates the reason that the refund failed. One of the following:

    - **lost_or_stolen_card**
    - **expired_or_canceled_card**
    - **unknown**
    - Empty string
- - fixed_side
  - Indicates which side of the transaction the FX rate is fixed for. Relevant for refunds with foreign exchange. One of the following values:

    - **buy**
    - **sell**
- - fx_rate
  - Exchange rate for the transaction.

    - When `fixed_side` is **buy**, `fx_rate` is the buy rate.
    - When `fixed_side` is **sell**, `fx_rate` is the sell rate.

    Decimal number as string. Relevant to refunds with foreign exchange.
- - id
  - ID of the `refund` object. String starting with **refund_**.
- - merchant_reference_id
  - Identifier defined by the client for reference purposes. Limit: 45 characters.
- - merchant_debited_amount
  - Amount debited from the merchant. Relevant to refunds with foreign exchange.
- - merchant_debited_currency
  - Indicates the currency that is debited from the merchant. Three-letter ISO 4217 code. Relevant to refunds with foreign exchange.
- - merchant_ewallet
  - As a Payment Facilitator (PayFac), you can create a card payment and direct the funds that the sub-merchant collects to your client wallet.

    Relevant to a [PayFac](https://docs.rapyd.net/en/rapyd-payfac-integration-guide.md "Rapyd PayFac Integration Guide").
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - payment
  - ID of the `payment` object that the refund is credited against. String starting with **payment_**.
- - payment_created_at
  - Time that the original payment was created, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - payment_method_type
  - The original payment method type. Use [List Payment Methods by Country](https://docs.rapyd.net/en/list-payment-methods-by-country.md "List Payment Methods by Country") for a list of supported types for a country.
- - proportional_refund
  - Indicates whether the refund was returned in proportion to the amounts received by the wallets in the payment. Relevant to a refund for a payment split among multiple wallets.
- - reason
  - Description of the reason for the refund, provided by the merchant.
- - receipt_number
  - Number of the receipt for the refund, provided by the merchant.
- - status
  - Indicates the status of the refund operation. One of the following values:

    - **Canceled** - The merchant canceled the refund.
    - **Completed** - The refund was complete.
    - **Error** - The refund failed since the payment object on which the refund is based is not in **closed** status.
    - **Rejected** - The refund was rejected by the specific payment processor for this payment.
    - **Pending** - The request created a refund object on the Rapyd platform, but the refund is not yet complete. For example, the refund is for a payment method that requires a customer action, such as cash, bank redirect or bank transfer.
- - updated_at
  - Time that this refund was last updated, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").

### Code Samples

- - .NET

    - ```csharp
      using System;
      using System.Text.Json;

      namespace RapydApiRequestSample
      {
          class Program
          {
              static void Main(string[] args)
              {
                  try
                  {
                      var metadata = new
                      {
                          merchant_defined = true
                      };

                      var requestObj = new
                      {
                          payment = "payment_fdbae3bd097c9fffd88d7c3084f02ffe",
                          metadata,
                          merchant_reference_id = "CA1234567",
                          reason = "Merchandise returned",
                      };

                      string request = JsonSerializer.Serialize(requestObj);

                      string result = RapydApiRequestSample.Utilities.MakeRequest("POST", "/v1/refunds", request);

                      Console.WriteLine(result);
                  }
                  catch (Exception e)
                  {
                      Console.WriteLine("Error completing request: " + e.Message);
                  }
              }
          }
      }
      ```
- - JavaScript

    - ```javascript
      const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;

      async function main() {
        try {
          const body = {
            payment: 'payment_93186bb9a6d7ddfbae1d80f60285d736',
            metadata: {
              merchant_defined: true
            },
            merchant_reference_id: 'CA1234567',
            reason: 'Merchandise returned'
          };
          const result = await makeRequest('POST', '/v1/refunds', body);

          console.log(result);
        } catch (error) {
          console.error('Error completing request', error);
        }
      }
      ```
- - PHP

    - ```php
      <?php
      $path = $_SERVER['DOCUMENT_ROOT'];
      $path .= "/<path-to-your-utility-file>/utilities.php";
      include($path);

      $body = [
          "payment" => "payment_d99278076db1dbf210ace0790582ac78",
          "merchant_reference_id" => "CA1234567",
          "reason" => "Merchandise returned",
          "metadata" => array(
              "merchant_defined" => true
          )
      ];

      try {
          $object = make_request('post', '/v1/refunds', $body);
          var_dump($object);
      } catch(Exception $e) {
          echo "Error: $e";
      }
      ?>
      ```
- - Python

    - ```python
      from pprint import pprint

      from utilities import make_request

      create_refund_body = {
          "payment": "payment_7b3d9a457f108e8078f4a1a3fedf759c",
          "amount": 10,
          "metadata": {
              "merchant_defined": True
          },
          "reason": "Uncredited discount",
          "merchant_reference_id": "CA1234567"
      }
      response = make_request(method='post',
                              path='/v1/refunds',
                              body=create_refund_body)
      pprint(response)
      ```

- /v1/refunds

- Create Refund - Full Refund Single Seller
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_4594996f3e0e752e0de819545c6561ac",
      "merchant_reference_id": "2025-11-19a",
      "reason": "Merchandise returned"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "b7c090c5-5cc2-42f3-8bf5-0c53873dfbc7"
      },
      "data": {
          "id": "refund_34d395388fd0bd22f65f74b130fd58b5",
          "amount": 45,
          "payment": "payment_4594996f3e0e752e0de819545c6561ac",
          "currency": "EUR",
          "failure_reason": "",
          "metadata": {},
          "reason": "Merchandise returned",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763547845,
          "updated_at": 1763547845,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19a",
          "payment_created_at": 1763547805,
          "payment_method_type": "gb_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c1943cfeda5f98247ab117e5d2648861",
                  "amount": 45
              }
          ],
          "proportional_refund": true,
          "merchant_debited_amount": null,
          "merchant_debited_currency": null,
          "fx_rate": null,
          "fixed_side": null
      }
  }
  ```

- Create Refund - Full Refund Multiple Sellers
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_64ef1260576c14d301ecaa6e31e4ebe5",
      "merchant_reference_id": "2025-11-19b",
      "reason": "Merchandise returned"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "5720477c-99c4-4ed3-af47-a883107d6dff"
      },
      "data": {
          "id": "refund_cf5a0e0c0b99591afdfec39026ac8622",
          "amount": 10000,
          "payment": "payment_64ef1260576c14d301ecaa6e31e4ebe5",
          "currency": "COP",
          "failure_reason": "",
          "metadata": {},
          "reason": "Merchandise returned",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763549077,
          "updated_at": 1763549077,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19b",
          "payment_created_at": 1763548767,
          "payment_method_type": "co_debit_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
                  "amount": 1205
              },
              {
                  "ewallet": "ewallet_3cd928611934717f283df049a2c7c17e",
                  "amount": 6295
              },
              {
                  "ewallet": "ewallet_3801e782955b29955445586a2405a5db",
                  "amount": 2500
              }
          ],
          "proportional_refund": true,
          "merchant_debited_amount": null,
          "merchant_debited_currency": null,
          "fx_rate": null,
          "fixed_side": null
      }
  }
  ```

- Create Refund - Partial Refund Single Seller
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_74e1ed22841cff052762eb9677b88533",
      "amount": "20.21",
      "merchant_reference_id": "2025-11-19c",
      "reason": "Uncredited discount"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "e0227adc-2209-438d-9029-19853033a132"
      },
      "data": {
          "id": "refund_1065cf094ae139369982dd9669d88086",
          "amount": 20.21,
          "payment": "payment_74e1ed22841cff052762eb9677b88533",
          "currency": "EUR",
          "failure_reason": "",
          "metadata": {},
          "reason": "Uncredited discount",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763549331,
          "updated_at": 1763549332,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19c",
          "payment_created_at": 1763549298,
          "payment_method_type": "gb_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c1943cfeda5f98247ab117e5d2648861",
                  "amount": 20.21
              }
          ],
          "proportional_refund": true,
          "merchant_debited_amount": null,
          "merchant_debited_currency": null,
          "fx_rate": null,
          "fixed_side": null
      }
  }
  ```

- Create Refund - Non-Proportional Refund Multiple Sellers
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_d7044a53397e7ffa0f058a18ce3d26fc",
      "ewallets": [
          {
              "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
              "amount": 5
          }, 
          {
              "ewallet": "ewallet_3cd928611934717f283df049a2c7c17e",
              "amount": 10
          }
      ],
      "merchant_reference_id": "2025-11-19d",
      "reason": "Uncredited discount"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "160deba3-5641-4ead-9b71-95026b806f36"
      },
      "data": {
          "id": "refund_5ca747d2374898a05f4a437eb7babb91",
          "amount": 15,
          "payment": "payment_d7044a53397e7ffa0f058a18ce3d26fc",
          "currency": "COP",
          "failure_reason": "",
          "metadata": {},
          "reason": "Uncredited discount",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763549546,
          "updated_at": 1763549546,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19d",
          "payment_created_at": 1763549467,
          "payment_method_type": "co_debit_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
                  "amount": 5
              },
              {
                  "ewallet": "ewallet_3cd928611934717f283df049a2c7c17e",
                  "amount": 10
              }
          ],
          "proportional_refund": false,
          "merchant_debited_amount": null,
          "merchant_debited_currency": null,
          "fx_rate": null,
          "fixed_side": null
      }
  }
  ```

- Create Refund - Refund One of Multiple Sellers
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_295c18f4d4f0bd530933ce5285f85109",
      "ewallets": [
          {
              "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
              "amount": 5
          }
      ],
      "merchant_reference_id": "2025-11-19e",
      "reason": "Uncredited discount"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "b402abef-ed0d-4c44-9873-76b4b862785d"
      },
      "data": {
          "id": "refund_2dfdae4a8c41c35db8655be90a80d350",
          "amount": 5,
          "payment": "payment_295c18f4d4f0bd530933ce5285f85109",
          "currency": "COP",
          "failure_reason": "",
          "metadata": {},
          "reason": "Uncredited discount",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763550152,
          "updated_at": 1763550152,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19e",
          "payment_created_at": 1763550129,
          "payment_method_type": "co_debit_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
                  "amount": 5
              }
          ],
          "proportional_refund": false,
          "merchant_debited_amount": null,
          "merchant_debited_currency": null,
          "fx_rate": null,
          "fixed_side": null
      }
  }
  ```

- Create Refund - Proportional Refund Multiple Sellers
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_4ea189c9a2429f04bef2456155005d89",
      "amount": "10.00",
      "merchant_reference_id": "2025-11-19f",
      "reason": "Uncredited discount"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "b04ce105-f06e-48e7-ba62-2aaa66375af5"
      },
      "data": {
          "id": "refund_c60d51d1aadd23cf715acf1745a83dc3",
          "amount": 10,
          "payment": "payment_4ea189c9a2429f04bef2456155005d89",
          "currency": "COP",
          "failure_reason": "",
          "metadata": {},
          "reason": "Uncredited discount",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763550258,
          "updated_at": 1763550258,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19f",
          "payment_created_at": 1763550241,
          "payment_method_type": "co_debit_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
                  "amount": 1.21
              },
              {
                  "ewallet": "ewallet_3cd928611934717f283df049a2c7c17e",
                  "amount": 6.29
              },
              {
                  "ewallet": "ewallet_3801e782955b29955445586a2405a5db",
                  "amount": 2.5
              }
          ],
          "proportional_refund": true,
          "merchant_debited_amount": null,
          "merchant_debited_currency": null,
          "fx_rate": null,
          "fixed_side": null
      }
  }
  ```

- Create Refund - Refund from Multiple Sellers by Percentage
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_3366b2e1ad6bb767713077c9d4cb136a",
      "ewallets": [
          {
              "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
              "percent": 5
          },
          {
              "ewallet": "ewallet_3801e782955b29955445586a2405a5db",
              "percent": 50
          }
      ],
      "merchant_reference_id": "2025-11-19ee",
      "reason": "Uncredited discount"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "2aa243d8-916c-4ebf-91d5-6a7f6af1c135"
      },
      "data": {
          "id": "refund_eb2cb9cb3101636e1c1ba4c5c6c41864",
          "amount": 3705,
          "payment": "payment_3366b2e1ad6bb767713077c9d4cb136a",
          "currency": "COP",
          "failure_reason": "",
          "metadata": {},
          "reason": "Uncredited discount",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763551080,
          "updated_at": 1763551080,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19ee",
          "payment_created_at": 1763550901,
          "payment_method_type": "co_debit_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
                  "amount": 1205
              },
              {
                  "ewallet": "ewallet_3801e782955b29955445586a2405a5db",
                  "amount": 2500
              }
          ],
          "proportional_refund": false,
          "merchant_debited_amount": null,
          "merchant_debited_currency": null,
          "fx_rate": null,
          "fixed_side": null
      }
  }
  ```

- Create Refund - Refund of FX Payment
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_288508dafbe91086885383b6790a6c9d",
      "reason": "returned merchandise",
      "merchant_reference_id": "2025-11-19g",
      "amount": 49.56,
      "currency_code": "USD"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "e94964ca-f364-42bc-85c9-1f52a2cd0296"
      },
      "data": {
          "id": "refund_1b77a19d5983e89cdadf264b32dbc43a",
          "amount": 49.75,
          "payment": "payment_288508dafbe91086885383b6790a6c9d",
          "currency": "USD",
          "failure_reason": "",
          "metadata": {},
          "reason": "returned merchandise",
          "status": "Completed",
          "receipt_number": 0,
          "created_at": 1763551380,
          "updated_at": 1763551380,
          "merchant_ewallet": null,
          "merchant_reference_id": "2025-11-19g",
          "payment_created_at": 1763551361,
          "payment_method_type": "fr_visa_card",
          "ewallets": [
              {
                  "ewallet": "ewallet_c67c44ec60d5c2e62480aa7c76b3f8b4",
                  "amount": 49.56
              }
          ],
          "proportional_refund": true,
          "merchant_debited_amount": 49.56,
          "merchant_debited_currency": "EUR",
          "fx_rate": 1.0039151914,
          "fixed_side": "sell"
      }
  }
  ```

- Bad Request - Refund amount exceeds payment amount
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_20e5eb2c568be3ade1412c2a6ea5c234",
      "amount": 101,
      "metadata": {
          "merchant_defined": true
      },
      "merchant_reference_id": "CA1234567",
      "reason": "Merchandise returned"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "ERROR_REFUND_AMOUNT_EXCEEDS_PAYMENT_AMOUNT",
          "status": "ERROR",
          "message": "The request tried to create a refund of payment that was collected to one or more wallets, but the amount of all refunds against this payment exceeded the amount of the payment. The request was rejected. Corrective action: None. Determine why an attempt was made to refund more money than was collected originally.",
          "response_code": "ERROR_REFUND_AMOUNT_EXCEEDS_PAYMENT_AMOUNT",
          "operation_id": "4a51bc0a-632e-4839-9588-7030dba77b7f"
      }
  }
  ```

- Bad Request - Invalid amount
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/refunds' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "payment": "payment_20e5eb2c568be3ade1412c2a6ea5c234",
      "amount": "101$",
      "metadata": {
          "merchant_defined": true
      },
      "merchant_reference_id": "CA1234567",
      "reason": "Merchandise returned"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "INVALID_AMOUNT",
          "status": "ERROR",
          "message": "The request attempted an operation that requires an amount, but the amount was not found, was not a valid number or was out of bounds. The request was rejected. Corrective action: Use the correct amount.",
          "response_code": "INVALID_AMOUNT",
          "operation_id": "c18d4469-cb35-487a-a8af-6b8604cf1dc2"
      }
  }
  ```
