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 | Type | Description |
---|---|---|
refundAmount | Integer | the amount of the prior finance purchase to be refunded in pence |
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
A request for refund is near real-time but is not synchronous. You are unlikely to receive confirmation of the refund in the immediate API response as it is being processed separately on the customer account. Your request to this endpoint will simply provide an HTTP 200
if the action was performed successfully.
In cases where the refund has been successfully performed and recorded prior to our API response, the response payload will include a copy of the original order (basket) object, but adding 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"
}
],
If you do not receive this object in the immediate response, you will need to separately poll the transactions endpoint for the status of the original order. When the refund is authorised the response, which includes the orignal order (basket) object will have added the corresponding refunds
object seen above.
In the event the request cannot be processed, the other possible HTTP responses your might receive are as follows:
HTTP Code | Reason |
---|---|
200 | Request is valid and can be processed |
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.