Automatic Delayed Capture
-
Hello.
I understand that there are no settings for creating an automatic delayed capture in the plug-in. I think this would be a good feature to implement. Including a way to select how many days after authorisation to capture, or automatic capture 6 hours before cancellation which I believe is the Stripe default. This would allow customers a small grace period to change their mind and not end up costing the shop any fees.
If this is not possible, I would like to implement this through some other means.
Google AI suggest this code in functions.php, after setting the Stripe plug-in to manual capture.
add_filter( 'woocommerce_stripe_payment_intent_args', 'force_stripe_24h_delayed_capture', 10, 2 );
function force_stripe_24h_delayed_capture( $args, $order ) {
// Only apply if the WooCommerce plugin is set to capture later
if ( isset( $args['capture_method'] ) && $args['capture_method'] === 'manual' ) {
$args['capture_method'] = 'automatic_delayed';
// Tells Stripe to automatically capture 1 day (24 hours) after authorization
$args['payment_method_options']['card']['capture_delay_days'] = 1;
}
return $args;
}Are there any experts on hand to verify this as a good solution?
Many thanks
JS
You must be logged in to reply to this topic.