Conditionally set intent (e.g. capture/authorize)
-
Hi!
Our store includes orders in which payment should immediately be processed and go through (e.g. “Captured”) while some orders should be authorized, but won’t be captured until later review.
The condition should work depending on User Capabilities for the person completing the order and metadata attached to the order.
I see that the PayPal Checkout Settings > Intent option is saved to “woocommerce-ppcp-settings” in the database, which is then pulled from WooCommerce\PayPalCommerce\WcGateway\Settings\Settings and this value is then passed to the frontend WooCommerce\PayPalCommerce\Button\Assets\SmartButton through wp_localize_script to generate the PayPal buttons that a user would click to open the popup window to complete payment.
I couldn’t figure out a way to conditionally modify the intent based on the order (it looks like the get_option call in Settings is invoked before Woocommerce loads session data). Plus, this method would only work if the user was completing the order using Javascript.
Do you have a recommendation on how we can conditionally process some orders as “Capture” and some orders as “Authorize”?
Thanks!
- The topic ‘Conditionally set intent (e.g. capture/authorize)’ is closed to new replies.