woocommerce / woocommerce-gateway-paypal-express-checkout

59 stars 64 forks source link

Fix JS errors when Payment Action is set to Authorize #754

Closed mattallan closed 4 years ago

mattallan commented 4 years ago

Issue: #750

Ticket: 3007850-zen


Description

The checkout is currently broken when you set the Payment Action in PPEC settings to Authorize.

With the new sdk/js we must set the intent query-parameter when loading the payment form otherwise PayPal defaults to capture and then throws and error when trying to place the order.

From my understanding, in 1.6.21 we never had to set an intent when loading the from with checkout.js because we handled authorization in later API requests once we received a token from PayPal, but with the new sdk we need to.

Steps to test:

  1. Set the payment action settings to Authorize: https://d.pr/i/2ONQis
  2. Visit checkout page
  3. Try click PayPal button and notice a JS error

Closes #750

james-allan commented 4 years ago

LGTM 👍

I could replicate the original issue and confirmed this fixes the issue. I also tested using Authorize/Capture and Sale on all pages and no errors.

onicholas87 commented 4 years ago

Thanks for your support, I look forward to the fix :)