Hi @joecole1,
Our developer docs display the entire plugin’s code base along with all the hooks available in the plugin. Here is a link to the exact filter you can use to change the submitForSettlement property before the transaction is processed.
https://docs.paymentplugins.com/wc-braintree/api/source-class-WC_Braintree_Payment_Gateway.html#622
Kind Regards
Thread Starter
Joe
(@joecole1)
I swear I searched for that!
Sorry for wasting your time, but thank you for the quick response.
Thread Starter
Joe
(@joecole1)
Oh I guess I misunderstood the filter. It’s not enough to just add a filter? I already have an action that runs on wp_loaded that runs a bunch of other filters if this product is in the cart, so I’d prefer to simply set it there.
add_filter( ‘wc_braintree_transaction_submit_for_settlement’, ‘__return_false’ );
From my quick look at the code, it looks like if get_option is ‘capture’, it’s just setting that filter to true. So if I set to false it should authorize?
I tested it with PayPal, and it says authorized in the order notes, but it still captured the payment in PayPal.
@joecole1,
What is the status of the transaction in the Braintree control panel?
It should be authorized.
Thread Starter
Joe
(@joecole1)
That’s what was confusing to me.
In Woocommerce the order note says: Order authorized in Braintree: Transaction ID: ********. Payment method: PayPal – *********@gmail.com
In Braintree and in PayPal, the payment is authorized, submitted for settlement, and settled all at the same time.
-
This reply was modified 6 years, 8 months ago by
Joe.
@joecole1,
Do the same test but with the credit card gateway. I think there’s one extra field that has to be changed with PayPal.
Once you confirm it works with the cc gateway I’ll show you where to change the extra paypal attribute.
Kind regards,
Thread Starter
Joe
(@joecole1)
Woocommerce: Order authorized in Braintree: Transaction ID: ********. Payment method: American Express ending in ****
Braintree Authorized!
So yes, it is an issue of CC vs PayPal Gateways.
My intent is to use the PayPal gateway because I can have an authorization that lasts up to 29 days versus credit cards that are only good for 3 days (Amex) up to 2 weeks (others). So it’d be great to figure this out!
Hi @joecole1,
PayPal is a little different than the other gateways and requires that you change one extra parameter. Please review the code at the following link:
https://docs.paymentplugins.com/wc-braintree/api/source-class-WC_Braintree_PayPal_Payment_Gateway.html#130
You can use filter wc_braintree_localized_paypal_params to change $data['options']['intent'] = authorize.
Valid values for intent are:
authorize
capture
Kind regards,
Thread Starter
Joe
(@joecole1)
Fixed with this filter, run on wp_loaded
add_filter( 'wc_braintree_localized_paypal_params', function($data) {
$data['options']['intent'] = 'authorize';
return $data;
});