0

I'm trying to refund transactions via Omnipay and it looks like Omnipay supports refunds. However the documentation isn't clear and I've some confusion about how to go about this.

Omnipay Example code for refund:

    $transaction = $gateway->refund(array(
        'amount'    => '10.00',
        'currency'  => 'AUD',
    ));
    $transaction->setTransactionReference($sale_id);
    $response = $transaction->send();
    if ($response->isSuccessful()) {
        echo "Refund transaction was successful!\n";
        $data = $response->getData();
        echo "Gateway refund response data == " . print_r($data, true) . "\n";
    }

What's the $sale_id here? My Payments table has transaction id saved as:

'PAYMENTINFO_0_TRANSACTIONID' => $data['PAYMENTINFO_0_TRANSACTIONID'],

Which looks like: 01H36802XU637613S (PayPal) & ch_1IYpA7BJRxbFR9rFrGmPKs85 (Stripe). Are these the $sale_id?

floatingLomas
  • 8,553
  • 2
  • 21
  • 27
bhu1st
  • 1,282
  • 11
  • 23

1 Answers1

1

This is really something Omnipay will likely have to answer on the whole, but maybe this helps:

ch_1IYpA7BJRxbFR9rFrGmPKs85 would be what you'd use to create a refund in Stripe: https://stripe.com/docs/api/refunds/create#create_refund-charge

floatingLomas
  • 8,553
  • 2
  • 21
  • 27