• Resolved robwebfx

    (@robwebfx)


    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!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @robwebfx,

    This could be difficult and I see potential problems when changing the intent setting on the fly for particular orders.
    For now, I don’t think it’s possible, but generally, it may be easier to set the intent to Authorize for all orders and then have additional logic either capture the order instantly or after a review depending on the account capabilities.

    As of now, orders could only be captured through the order actions though. We are looking towards integrating more ways to capture payments programmatically as well.

    Kind regards,
    Niklas

    Thread Starter robwebfx

    (@robwebfx)

    Re: setting Authorize as the intent and capturing target orders immediately after — this was actually what I was thinking as a backup plan (I just wanted to double check if there was a pre-existing way to do the above before putting that together).

    I’ll continue working on this implementation — thanks for your help!

    Plugin Support Syde Niklas

    (@niklasinpsyde)

    This would be safer in my view as the plugin setting would apply to all orders. So there is conflict potential if two different users with varying capabilities created orders at the very same time.

    In any case, a dedicated feature/hook to programmatically capture authorized payments will be included in a future update. So if you can’t get it to work for now, then the feature we will provide should make it easier to pull this off.

    Kind regards,
    Niklas

    Hi Robweb and Niklas..
    I have same implementation to do. As Niklas suggest, I thought the solution to to set the “intent” on Authorize for all orders, and contextually capture the order for most of them….

    This request comes because some products is sell with a logic similar to KickStarte. Process the orders asking Authorization for payment (the intent to buy something from the customers). After N days and only if the target is reached capture the order.

    An advantage of my situation is that I have to separate the classic products from those that need a fundraiser. For some problem linked to economic issues. In fact if the fundraising does not reach the goal, the process does not become order.

    For this reason, can be useful know how to change conditionally this option, and process the order with full functionality of the plugin…

    Many thanks for any suggestion
    Bye JJ

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditionally set intent (e.g. capture/authorize)’ is closed to new replies.