Automattic/woocommerce-payments

WooPay Subscription error when using direct checkout

Opened this issue · 0 comments

Describe the bug

(copied from the WooPay repo, text by @malithsen)

Shopper should always be logged into the merchant site when purchasing a subscription via WooPay, however this requirement is bypassed when using Direct Checkout which can sometimes results in an order failure.

To Reproduce

  1. Create a new account in the merchant site.
  2. Log out of the account.
  3. In a separate tab create a WooPay account using the same email address used in step 1.
  4. Go back to the merchant site, add a subscription product to the cart.
  5. Go to the cart page.
  6. Click on the Proceed to Checkout button.
  7. You will be redirected to the WooPay checkout page.
  8. Place order.
  9. Notice that the order fails and the payment gets auto-refunded.

This failure is because when processing the subscription, merchant site tries to create a new user for the email provided by WooPay but fails as there's already a user with that email.

Actual behavior

Direct Checkout is enabled when shopper is logged out and is purchasing a subscription.

Screenshots

Expected behavior

Direct Checkout should be disabled when the shopper is not logged in to merchant site and is purchasing a subscription.