Hook to add Stripe [receipt_url] to order_meta
-
You helped me on Version 2.4.0 with a code snippet that saved the Stripe receipt URL to the order meta data. It has worked flawlessly until the 2.7.0 release. I’m currently running Woocommerce 7.5.1 and WP 6.2.
Here’s the snippet from the original support task:
add_filter( 'http_response', function ( $response, $r, $url ) { if ( doing_action( 'wp_ajax_woo_mp_process_transaction' ) && isset( $_REQUEST['order_id'] ) && $url === 'https://api.stripe.com/v1/payment_intents' ) { $decoded_body = json_decode( wp_remote_retrieve_body( $response ) ); if ( isset( $decoded_body->charges->data[0] ) ) { $order = wc_get_order( $_REQUEST['order_id'] ); if ( $order ) { $charge = $decoded_body->charges->data[0]; $order->add_meta_data( 'manual_payment_stripe_receipt_url', json_encode( [ 'charge_id' => $charge->id, 'receipt_url' => $charge->receipt_url, ] ) ); $order->save(); } } } return $response; }, 10, 3 );
Here’s the original support topic: https://www.ads-software.com/support/topic/add-stripe-receipt_url-to-order_meta/#post-11954097
It looks like the hooks and functions still exist. Did the stripe API update in woo-mp-2.7.0 cause this snippet to stop working or is it something else?
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Hook to add Stripe [receipt_url] to order_meta’ is closed to new replies.