# Refund a Voucher

In the situation where a redeem voucher operation needs to be cancelled, a refund action can be executed on the merchant API to revert the transaction.

A refund action can be performed after a completed redeem action.

It requires the capture_id returned by the redeem action.

# Needed Transaction Information

Used in the path.

  • scope: The backend scope for the transactions. For our DEMO and UAT environments, the value for this parameter is edr. This is found in the links provided in the redeem voucher response.
  • capture_id: the capture ID returned by the redeem voucher response.

# Needed Voucher Information

Used in the request body.

  • product_class: reference to the catalogue of products. For our DEMO and UAT environments, the value for this parameter is ETX_001.
  • ref: unique reference displayed on the voucher. Also available on the voucher as a QR or bar code depending on the its design.

# Other Request Parameters

# Main Information Returned

  • status: confirming that the refund is successful.

A successful refund will revert the deduction of the voucher's remaining value and update the status accordingly.

# Other Available Information

  • refund_id: the ID of the refund transaction
  • mid: the merchant ID
  • vouchers: details of the voucher if return_vouchers_info=true was requested.

# Example of an API Call

# API Endpoint and Headers

POST https://api.merchant.demo.uniqrewards.com/v1/transactions/{scope}-{capture_id}/actions/refund?return_vouchers_info=false

Headers:
X-Client-Id: a1f64ebc9c4fef739df58f5933ceec94
X-Client-Secret: 1231f6112bbff1b03892306f53281bb0
Content-Type: application/json

# Request Body

{
    "vouchers": [
        {
            "product_class": "ETX_001",
            "ref": "1701221318"
        }
    ]
}

# Response Body

{
  "data": {
    "refund_id": "0000100000000000017120211228002795715",
    "mid": "000000000000171"
  },
  "meta": {
    "status": "succeeded"
  }
}

The refund is successful (see status and refund ID).

Note: the sample values in this page are mock-up values. They are not valid credentials and they are not associated to any actual product or voucher.

More details can be found on the Technical Documentation (opens new window).