Refund
Use Refund API to refund a Captured Transaction
Refunding a Captured Transaction
If a purchase has been captured, and the merchant would like to refund the customer for part of or all of their purchase, the Refund API should be used. This will initiate a process in which transferred funds are pulled back from the merchant and the customer's payment plan total and installment amounts are adjusted accordingly.
Tip: Refund can also be performed from the PayBright portal optionally. Please confirm with the PayBright Solutions team first before initiating the refund from portal.
Refer to the API Reference guide for a description of the contents in the API and to identify the mandatory fields.
To refund a transaction, you will need to create the signature using the API Key and API Token shared with you by the PayBright team.
curl --location --request POST 'https://sandbox.paybright.com/checkout/api2.aspx' \
--header 'Content-Type: application/json' \
--header 'Cookie: OriginalURL=https://sandbox.paybright.com/CheckOut/ApplicationForm.aspx; VisitCount=19; ASP.NET_SessionId=qhnqjnw2uv1g1bpa2bd34xql' \
--data-raw '{
"x_account_id" : "Z9s7Yt0Txsqbbx",
"x_test" : "true",
"x_url_callback" : "https://mystore.io/ping/1",
"x_transaction_type" : "refund",
"x_currency" : "CAD",
"x_amount" : "2009.00",
"x_reference" : "000000055",
"x_gateway_reference" : "51325",
"x_signature" : "faa55f7824b009f9c77fe1892f3d94310134111c8b1d06edd30d0b781f32aa40"
}
'
PayBright will send a response of Refund API call as a POST request to x_url_callback and a second response to the initial request. The x_result field in the response will return the status of Refund call which can be either 'completed' or 'failed'.
Tip: The call-back URL shall be able to process the POST request and return a 200 OK in the response. Failure to do so will result in synchronization issues between PayBright and your store.
You should receive a response that looks like this:
x_account_id=Z9s7Yt0Txsqbbx&x_amount=2009.00&x_currency=CAD&x_gateway_reference=51325&x_message=success&x_reference=000000055&x_result=Completed&x_test=true&x_transaction_type=refund&x_timestamp=2020-08-31T15:48:08Z&x_signature=ebea0631af38335f8b939f171989e6a47c53c79ba5c65c8a473bb7607a230508
Please check the API Reference for more Refund API details.
Updated almost 4 years ago