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
?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.