woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
232 stars 204 forks source link

[Split PE] Deleting APM tokens from My Account > Payment method doesn't delete the token in Stripe. #2898

Closed mattallan closed 7 months ago

mattallan commented 7 months ago

Describe the bug While on checked out on the fix/2872-dPE-APM-subscription-support branch (https://github.com/woocommerce/woocommerce-gateway-stripe/pull/2883), deleting an APM saved card (i.e. ideal) doesn't remove it from Stripe. The next time the customer's cards are fetched from Stripe to sync to Woo, the deleted tokens are re-added back.

This issue is caused by WC_Stripe_Payment_Tokens::woocommerce_payment_token_deleted() not working properly when UPE gateway is enabled and the token is anything other than 'stripe'.

To Reproduce Steps to reproduce the behavior:

  1. Checkout fix/2872-dPE-APM-subscription-support branch
  2. Enable Woo Subscriptions
  3. Enable an APM method (ideal, SEPA, etc)
  4. Purchase a subscription product using iDeal
  5. Confirm the new iDeal token is saved in your wc_woocommerce_payment_tokens table
  6. Navigate to the Stripe dashboard (https://dashboard.stripe.com/test/customers/cus_XXXXXXX) and confirm the new iDeal/SEPA payment method in the list of the customers payment methods
  7. Navigate to My Account > Payment methods and delete the iDeal token (listed as SEPA IBAN) image
  8. Notice the payment method has not been removed from Stripe.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

mattallan commented 7 months ago

Closed by #2902. Thanks Danae for picking this up so quickly! :)