Refunds & Cancelations

You can only refund and/or cancel payments made via the BreathePay Payments API

BreathePay processes payments as midnight each night, therefore if payments have been made on the same day (and have not yet been processed), you must cancel them. If payments were made before midnight that day, they will have been processed and therefore you can use the refund method to return money to your customers.

ALWAYS validate the signature in the response object using the function written in the Handling API Responses page

Canceling a same-day request:

Using the code we stated in the Backend Code page, here is an example refund function which can be copied into your project:

//PHP
public function cancel() {
   $data = [
      'merchantID' => YOUR_MERCHANT_ID,
      'action' => 'CANCEL',
      'xref' => TRANSACTION_XREF //stored from the charge function
   ];

   $data['signature'] = $this->createBreathepaySignature($data, YOUR_MERCHANT_SECRET);

   return $this->sendRequest($data);
 }

Refunding a request made before this day:

//PHP
public function fullOrPartialRefund() {
   $data = [
      'merchantID' => YOUR_MERCHANT_ID,
      'action' => 'REFUND_SALE',
      'amount' => AMOUNT_TO_REFUND, //In pence, £1 = 100 (maximum is amount of transaction)
      'xref' => TRANSACTION_XREF //stored from the charge function
   ];

   $data['signature'] = $this->createBreathepaySignature($data, YOUR_MERCHANT_SECRET);

   return $this->sendRequest($data);
 }

Last updated