Add Stripe [receipt_url] to order_meta
-
On Stripe transactions I want to save also the receipt_url charge attribute to the order_meta.
Is there a way to accomplish this through a code snippet rather than updating the following functions?
* Woo_MP\Woo_MP_Order::get_charge_defaults()
private function get_charge_defaults() { return [ 'id' => '', 'date' => current_time( 'M d, Y' ), 'last4' => '', 'amount' => 0, 'currency' => '', 'captured' => false, 'held_for_review' => false, 'receipt_url' => '', ]; }
* Woo_MP\Woo_MP_Order::add_woo_mp_payment()
public function add_woo_mp_payment( $payment ) { $payment += $this->get_charge_defaults(); $payments = $this->get_woo_mp_payments(); $payments[] = $payment; $this->update_meta_data( 'woo-mp-' . WOO_MP_PAYMENT_PROCESSOR . '-charges', json_encode( $payments ) ); $this->update_meta_data( WOO_MP_PAYMENT_PROCESSOR . '_receipt_url', $payments->receipt_url); }
* Woo_MP\Payment_Processor::save_charge()
private function save_charge( $charge ) { $charge['order']->add_woo_mp_payment( [ 'id' => $charge['trans_id'], 'last4' => $charge['last_4'], 'amount' => $charge['amount'], 'currency' => $charge['currency'], 'captured' => $charge['capture'], 'held_for_review' => $charge['held_for_review'], 'receipt_url' => $charge['receipt_url'], ] );...
* Woo_MP\Payment_Gateways\Stripe\Payment_Processor::process()
... return [ 'trans_id' => $charge->id, 'held_for_review' => $charge->outcome->type === 'manual_review', 'receipt_url' => $charge->receipt_url, ];...
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add Stripe [receipt_url] to order_meta’ is closed to new replies.