You can manually refund any completed purchases via the FlexPay Merchant Portal - by searching for an applicable order and returning either the full amount of a purchase in one transaction, or any smaller amounts individually that in total do not exceed the overall value of the prior finance purchase.

You can find out more information about this feature in the Merchant Portal user guide here. However, you may also choose to use the FlexPay API to implement refunds automatically from within your systems. This will allow you to initiate refunds directly without having to access the Merchant Portal.


Update Transaction API

To request a refund via API you will need to use the transaction API endpoint, using an order reference that you supplied to the verify-basket endpoint in a prior checkout which resulted in a finance purchase. This order reference is appended to the transaction API endpoint along with the action itself:

{Environment }/transaction/{transactionId}/{orderAction}

where transactionId is your prior order reference supplied at checkout previously as reference during a finance purchase, and where orderAction in this case is always 'refund'.

Your request body should include the following parameters:

  • actionType which in this case should be 'REFUND'
  • options has the following properties:
Property Value Description
refundAmount Integer the amount of the prior finance purchase to be refunded
description String text an optional description of the refund for reporting in the Merchant Portal

An example request might look as follows:

curl -X 'POST' \
  'https://dummy-api.staging.host.com/transaction/d290f1ee-6c54-4b01-90e6-d701748f0851/refund' \
  -H 'accept: application/hal+json' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp6SXZmaU1HNkJqVEpUWGxkRlVwZSJ9.eyJpc3MiOiJodHRwczovL2Rla29wYXktbWVyY2hhbnQtZGV2LmV1LmF1dGgwLmNvbS8iLCJzdWIiOiJ2TDBac0VOOWo1TlQ0VlAzY0ZLQnAxakY5NHNtNUM4dkBjbGllbnRzIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgxL2FwaS9jaGVja291dCIsImlhdCI6MTYxNjU5MTU4NywiZXhwIjoxNjE2Njc3OTg3LCJhenAiOiJ2TDBac0VOOWo1TlQ0VlAzY0ZLQnAxakY5NHNtNUM4diIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.F-dzPkJVF0ub2kGiWn1As5PSMnIiqAriOhyux47t7lbNk0tD9Wu655JGHmjuAqqQ3uWyqXx9-feuYjv61xufgBfxH17OkIqBB9lVJzEONoVqF5uIzsnaTD2z0FTzcvOuH8RXzA-_q7vFZwvbboE9iZCFd-JN8vI_1jjWDUpdKFWzGk0-AmID9F7qgNnyC2WEb6DK4Ky5VttXPXcGfnIGD2ybOgkg1dOlBhzabJBT9jU_UQuBoKjqQoNqVm1ovhFJzzSWMsHqDIDOb7r-0zXRB33ka4_oKoVnVrvxL2hGblgC-2Jg6gfB7uuVPdbM5FIBFx8Cbt4T83KxXbpJy5hQbg'
  -H 'Content-Type: application/json' \
  -d '{
  "actionType": "REFUND",
  "options": {
    "refundAmount":1000,
    "description":"Refund due to goods returned"
    }
  }'

Update Transaction Response

Your request to the endpoint will provide a response of HTTP 204 if the action has been performed successfully. In such cases the response payload will include a copy of the original order (basket) object, with a new refunds object containing details of the completed refund:

  "refunds": [
    {
      "refundId": "662b9cf6-80bd-4cd7-bca0-679d56634098",
      "amount": 1000,
      "description": "Refund due to goods returned",
      "status": "SUCCEEDED",
      "creationDate": "2024-02-22T14:34:24.898991Z"
    }
  ],

In the event the request cannot be processed, the other possible HTTP responses your might receive are as follows:

HTTP Code Reason
204 Request is valid and can be processed (payload provides details)
400 Values provided in the request are not valid
404 The order cannot be found

You can see more details about this API in the specification for updating a transaction.