Instore (Refund using Gateway Reference)

Overview

This API call refunds in store orders that have been captured (either auto captured or auth then captured). You will need to use the PayBright Gateway Reference, also known as the Contract Key, to capture this order.

If you recieve a 200 code response, along with the parameter message: 'success', you have successfully refunded this order. If you recieve a 400 error, or the message returned is not 'success', you have not refunded the application.

Refunding the Order

Our In Store APIs use Basic Authorization, You can use create the Authorization Key using the API Key and Token shared with you by PayBright.

🚧

Security Token

Authorization Key will be a Base 64 encoding of APIKey:APIToken string e.g.

If API Key == txtzmjUfVsfEctvnBCjW and API Token == fd5jyxjSLLNwFPZTCfko
Then the formatting will be txtzmjUfVsfEctvnBCjW:fd5jyxjSLLNwFPZTCfko

Use https://www.base64encode.org/ for testing the Base64 encoding you create

In this example, this will result in the Key being:
dHh0em1qVWZWc2ZFY3R2bkJDalc6ZmQ1anl4alNMTE53RlBaVENma28=

Body of this API contains the required parameters to refund.

📘

v.2 Updated API URL

The new API url for Instore (Capture using Gateway Reference) is:
Sandbox:
https://sandbox.api.paybright.com/api/v2/instore/{GatewayReference}/refund/
Production:
https://api.paybright.com/api/v2/instore/{GatewayReference}/refund/

curl --location --request POST 'https://sandbox.api.paybright.com/api/v2/instore/68107/refund/' \
--header 'Authorization: Basic dHh0em1qVWZWc2ZFY3R2bkJDalc6ZmQ1anl4alNMTE53RlBaVENma28=' \
--header 'Content-Type: application/json' \
--data-raw '{
  "AccountID": "WVejbO48xRDKuSEY5fzd7dOtJRpvnzOVGT5fyht4abNUgn8cRQ",
  "Amount": "400"  
}'

Response

You will recieve a response letting you know if the refund was successful, along with a few other select values, such as the original purchase amount.

{
    "Amount": "400",
    "CreatedDate": "05/06/2021",
    "ProcessingDate": "05/07/2021",
    "Type": "refund",
    "OrderId": "68107",
    "Message": "Success",
    "OriginalReferenceNumber": "SO-12344432",
    "OriginalPurchaseAmount": "400.00"
}