By default, the WooCommerce Stripe Payment Gateway captures payments rather than authorizing and this works well for most use-cases. However, imagine you’re a merchant who has issues with chargebacks related to subscription renewal orders and would rather authorize the payments to give the customer a few days. How can this be done? The WP-Http class provides a filter that can be used to manipulate HTTP request data and this would be a trivial task to hook into that filter and change the payment from capture to authorize at that point in code execution. The conditions to look for would be a
$url that equals https://api.stripe.com/v1/payment_intents and a request body that contains an element called
off_session with a value of
true. Based on that condition, add an element to the request body named
capture_method with a value of
manual That might look something like this:
And here’s a visual representation:
Not sure what to do with code snippets? See What Do I Do With These Code Snippets?