Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 3ds in change PM for subscription flow #10453

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

timur27
Copy link
Contributor

@timur27 timur27 commented Feb 26, 2025

Fixes #2822

Changes proposed in this Pull Request

This PR adds support for subscription payment method change with 3DS cards. It interferes with core subscriptions and hooks onto an action that allows us stop updating payment methods for subscriptions in order to be able to authenticate them first.

Testing instructions

Change payment method flow

  • Purchase a subscription with a normal non-3DS card
  • Navigate to change payment method flow and change payment method to a 3DS 4000002760003184 with the following use-cases
    • Upon authorization, cancel the modal window from the top right side and confirm
      • The We are unable to authenticate your payment method. Please choose a different payment method and try again error on the page
      • Subscription has the old payment method still attached
    • Click on "Change payment method" once again, this time fail the authorization and confirm that
      • We are unable to authenticate your payment method. Please choose a different payment method and try again. notice is visible
      • Subscription has the old payment method still attached
    • Uncheck the Use this payment method for all of my current subscriptions checkbox and confirm the authorization
      • Once the confirmation modal pops up, confirm there is no success notice displayed behind the pop-up window since we're still in the process of confirming the payment for 3DS
      • Confirm that you are redirected to the subscription details page under my account
      • Confirm tha the successful Payment method updated. notice is displayed
    • Check the Use this payment method for all of my current subscriptions checkbox and confirm the authorization
      • Confirm that you are redirected to the subscription details page under my account
      • Confirm that the successful Payment method updated for all your current subscriptions. notice is displayed
      • Confirm that all the subscriptions were updated with the new payment method
  • Change payment method to a new non-3DS card
  • Change payment method to a saved card (both 3DS and non-3DS)
  • Use the insufficient funds 3DS card 4000000000009995 and confirm the card is not attached to the subscription after failure, and the correct error notice for insufficient funds is being displayed
  • Process renewal for a subscription that has a 3DS card attached to it as a result of a change payment method flow
    • Upon renewal processing attempt, the order should be expectedly put On hold and once you navigate to the link in the renewal order email sent to the shopper, you should be able to successfully renew order with a 3DS card
    • Perform the same test, but change to a non-3DS card during renewal order

  • Run npm run changelog to add a changelog file, choose patch to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Post merge

@botwoo
Copy link
Collaborator

botwoo commented Feb 26, 2025

Test the build

Option 1. Jetpack Beta

  • Install and activate Jetpack Beta.
  • Use this build by searching for PR number 10453 or branch name add/change-pm-3ds-flow in your-test.site/wp-admin/admin.php?page=jetpack-beta&plugin=woocommerce-payments

Option 2. Jurassic Ninja - available for logged-in A12s

🚀 Launch a JN site with this branch 🚀

ℹ️ Install this Tampermonkey script to get more options.


Build info:

  • Latest commit: f9c6651
  • Build time: 2025-03-06 08:50:27 UTC

Note: the build is updated when a new commit is pushed to this PR.

Copy link
Contributor

github-actions bot commented Feb 26, 2025

Size Change: +176 B (0%)

Total Size: 1.3 MB

Filename Size Change
release/woocommerce-payments/dist/blocks-checkout.js 56.1 kB +24 B (0%)
release/woocommerce-payments/dist/cart-block.js 17.3 kB +27 B (0%)
release/woocommerce-payments/dist/checkout.js 34.7 kB +23 B (0%)
release/woocommerce-payments/dist/express-checkout.js 15.9 kB +26 B (0%)
release/woocommerce-payments/dist/product-details.js 12.7 kB +27 B (0%)
release/woocommerce-payments/dist/tokenized-express-checkout.js 16.9 kB +26 B (0%)
release/woocommerce-payments/dist/woopay-express-button.js 23.5 kB +23 B (0%)
ℹ️ View Unchanged
Filename Size
release/woocommerce-payments/assets/css/admin.css 1.4 kB
release/woocommerce-payments/assets/css/admin.rtl.css 1.4 kB
release/woocommerce-payments/assets/css/success.css 189 B
release/woocommerce-payments/assets/css/success.rtl.css 190 B
release/woocommerce-payments/dist/blocks-checkout-rtl.css 2.74 kB
release/woocommerce-payments/dist/blocks-checkout.css 2.74 kB
release/woocommerce-payments/dist/cart.js 5.73 kB
release/woocommerce-payments/dist/checkout-rtl.css 1.28 kB
release/woocommerce-payments/dist/checkout.css 1.28 kB
release/woocommerce-payments/dist/express-checkout-rtl.css 236 B
release/woocommerce-payments/dist/express-checkout.css 236 B
release/woocommerce-payments/dist/frontend-tracks.js 854 B
release/woocommerce-payments/dist/index-rtl.css 35.6 kB
release/woocommerce-payments/dist/index.css 35.7 kB
release/woocommerce-payments/dist/index.js 237 kB
release/woocommerce-payments/dist/multi-currency-analytics.js 1.08 kB
release/woocommerce-payments/dist/multi-currency-rtl.css 4.29 kB
release/woocommerce-payments/dist/multi-currency-switcher-block.js 61.1 kB
release/woocommerce-payments/dist/multi-currency.css 4.29 kB
release/woocommerce-payments/dist/multi-currency.js 59.2 kB
release/woocommerce-payments/dist/order-rtl.css 740 B
release/woocommerce-payments/dist/order.css 740 B
release/woocommerce-payments/dist/order.js 42.5 kB
release/woocommerce-payments/dist/payment-gateways-rtl.css 1.34 kB
release/woocommerce-payments/dist/payment-gateways.css 1.34 kB
release/woocommerce-payments/dist/payment-gateways.js 40.3 kB
release/woocommerce-payments/dist/plugins-page-rtl.css 375 B
release/woocommerce-payments/dist/plugins-page.css 375 B
release/woocommerce-payments/dist/plugins-page.js 20.1 kB
release/woocommerce-payments/dist/product-details-rtl.css 433 B
release/woocommerce-payments/dist/product-details.css 436 B
release/woocommerce-payments/dist/settings-rtl.css 11.4 kB
release/woocommerce-payments/dist/settings.css 11.4 kB
release/woocommerce-payments/dist/settings.js 224 kB
release/woocommerce-payments/dist/subscription-edit-page.js 703 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal-rtl.css 524 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.css 524 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.js 20.2 kB
release/woocommerce-payments/dist/subscription-product-onboarding-toast.js 730 B
release/woocommerce-payments/dist/subscriptions-empty-state-rtl.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.js 19.3 kB
release/woocommerce-payments/dist/tokenized-express-checkout-rtl.css 236 B
release/woocommerce-payments/dist/tokenized-express-checkout.css 236 B
release/woocommerce-payments/dist/tos-rtl.css 235 B
release/woocommerce-payments/dist/tos.css 235 B
release/woocommerce-payments/dist/tos.js 21.8 kB
release/woocommerce-payments/dist/woopay-direct-checkout.js 6.13 kB
release/woocommerce-payments/dist/woopay-rtl.css 4.31 kB
release/woocommerce-payments/dist/woopay.css 4.28 kB
release/woocommerce-payments/dist/woopay.js 71 kB
release/woocommerce-payments/includes/subscriptions/assets/css/plugin-page.css 625 B
release/woocommerce-payments/includes/subscriptions/assets/js/plugin-page.js 814 B
release/woocommerce-payments/vendor/automattic/jetpack-assets/build/i18n-loader.js 2.46 kB
release/woocommerce-payments/vendor/automattic/jetpack-assets/build/jetpack-script-data.js 772 B
release/woocommerce-payments/vendor/automattic/jetpack-assets/src/js/i18n-loader.js 1.02 kB
release/woocommerce-payments/vendor/automattic/jetpack-assets/src/js/script-data.js 69 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/babel.config.js 163 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/identity-crisis.css 2.47 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/identity-crisis.js 14.2 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/identity-crisis.rtl.css 2.47 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-connection.css 10 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-connection.js 28.4 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-connection.rtl.css 10 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.css 198 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.js 280 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-admin-create-user.rtl.css 198 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.css 625 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.js 333 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-login.rtl.css 626 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/jetpack-sso-users.js 424 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-ajax.js 521 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-callables.js 585 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-admin-create-user.css 215 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-admin-create-user.js 521 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-login.css 721 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-login.js 412 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/src/sso/jetpack-sso-users.js 632 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/about.css 1.04 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-empty-state.css 294 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-order-statuses.css 408 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin.css 3.59 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/checkout.css 301 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/modal.css 746 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/view-subscription.css 574 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/wcs-upgrade.css 414 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin-pointers.js 543 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js 9.4 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.js 6.78 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.min.js 3.84 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-coupon.js 545 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-subscription.js 2.52 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.js 22.2 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.min.js 11.7 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/payment-method-restrictions.js 1.29 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/wcs-meta-boxes-order.js 507 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/payment-methods.js 358 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/single-product.js 428 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/view-subscription.js 1.38 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js 782 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/modal.js 1.09 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/wcs-upgrade.js 1.26 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.css 391 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.js 3.04 kB

compressed-size-action

@timur27 timur27 force-pushed the add/change-pm-3ds-flow branch from 7bae0c2 to 62ed534 Compare February 27, 2025 09:40
@timur27 timur27 force-pushed the add/change-pm-3ds-flow branch from 62ed534 to 900b0c8 Compare February 27, 2025 09:48
@timur27 timur27 marked this pull request as ready for review February 28, 2025 19:21
Comment on lines +1700 to +1708
} elseif ( $this->is_changing_payment_method_for_subscription() ) {
// Only attempt to use WC_Subscriptions_Change_Payment_Gateway if it exists.
if ( class_exists( 'WC_Subscriptions_Change_Payment_Gateway' ) ) {
// Update the payment method for subscription if the payment intent is not requiring action.
WC_Subscriptions_Change_Payment_Gateway::update_payment_method( $order, $payment_information->get_payment_method() );
}

// Because this new payment does not require action/confirmation, remove this filter so that WC_Subscriptions_Change_Payment_Gateway proceeds to update all subscriptions if flagged.
remove_filter( 'woocommerce_subscriptions_update_payment_via_pay_shortcode', [ $this, 'update_payment_method_for_subscriptions' ], 10 );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to manually update subscription with the new payment method which is non-3DS

Comment on lines +1722 to +1732
if ( isset( $status ) && Intent_Status::REQUIRES_ACTION === $status && $this->is_changing_payment_method_for_subscription() ) {
// Because we're filtering woocommerce_subscriptions_update_payment_via_pay_shortcode, we need to manually set this delayed update all flag here.
if ( isset( $_POST['update_all_subscriptions_payment_method'] ) && wc_clean( wp_unslash( $_POST['update_all_subscriptions_payment_method'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
$order->update_meta_data( '_delayed_update_payment_method_all', wc_clean( wp_unslash( $_POST['payment_method'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
$order->save();
}

wp_safe_redirect( $response['redirect'] );
exit;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to set the stage for 3DS handling and force quit to stop subscriptions from making unwanted changes, as we will handle once 3DS is confirmed later by update_order_status AJAX.

Comment on lines +3513 to +3529
$return_url = $this->get_return_url( $order );

if ( $is_changing_payment ) {
$payment_token = $this->get_payment_token( $order );
if ( class_exists( 'WC_Subscriptions_Change_Payment_Gateway' ) ) {
WC_Subscriptions_Change_Payment_Gateway::update_payment_method( $order, $payment_token->get_gateway_id() );
$notice = __( 'Payment method updated.', 'woocommerce-payments' );

if ( WC_Subscriptions_Change_Payment_Gateway::will_subscription_update_all_payment_methods( $order ) && WC_Subscriptions_Change_Payment_Gateway::update_all_payment_methods_from_subscription( $order, $token->get_gateway_id() ) ) {
$notice = __( 'Payment method updated for all your current subscriptions.', 'woocommerce-payments' );
}

wc_add_notice( $notice );
}
$return_url = method_exists( $order, 'get_view_order_url' ) ? $order->get_view_order_url() : $this->get_return_url( $order );
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the follow up for 3DS that we prepared for in https://github.com/Automattic/woocommerce-payments/pull/10453/files#r1976071421

Comment on lines +228 to +255
add_filter( 'woocommerce_subscriptions_update_payment_via_pay_shortcode', [ $this, 'update_payment_method_for_subscriptions' ], 10, 3 );
}

/**
* Stops WC Subscriptions from updating the payment method for subscriptions.
*
* @param bool $update_payment_method Whether to update the payment method.
* @param string $new_payment_method The new payment method.
* @param WC_Subscription $subscription The subscription.
* @return bool
*/
public function update_payment_method_for_subscriptions( $update_payment_method, $new_payment_method, $subscription ) {
// Skip if the change payment method request was not made yet.
if ( ! isset( $_POST['_wcsnonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['_wcsnonce'] ), 'wcs_change_payment_method' ) ) {
return $update_payment_method;
}

// Avoid interfering with use-cases not related to updating payment method for subscriptions.
if ( ! $this->is_changing_payment_method_for_subscription() ) {
return $update_payment_method;
}

// Avoid interfering with other payment gateways' operations.
if ( $new_payment_method !== $this->id ) {
return $update_payment_method;
}

return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main hook that lets us stop the normal subscription payment method change flow executed by core subscriptions

// We don't want to allow metadata for a successful payment to be disrupted.
if ( Intent_Status::SUCCEEDED === $this->get_intention_status_for_order( $order ) ) {
if ( Intent_Status::SUCCEEDED === $this->get_intention_status_for_order( $order ) && ! $is_changing_payment_method_for_subscription ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should let the change payment method flow update the intent in order even though the previous intent is successful, that's why we are not letting this function to stop the flow for successful intents with change payment method use-case.

// Send back redirect URL in the successful case.
echo wp_json_encode(
[
'return_url' => $this->get_return_url( $order ),
'return_url' => $return_url,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default get_return_url redirects users to the order received page because subscription change nonce is gone at this point as we're in the 3DS confirmation follow up AJAX here, that's why I'm using get_view_order_url.

Comment on lines +241 to +243
if ( ! isset( $_POST['_wcsnonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['_wcsnonce'] ), 'wcs_change_payment_method' ) ) {
return $update_payment_method;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to let the "update payment method for all subscriptions" checkbox display, as the action this code hooks onto is being executed by the change payment method form on the page load.


if ( $amount > 0 ) {
if ( $amount > 0 && ! $is_changing_payment ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid entering the pi flow even though orders of type subscription might have amount > 0.

@timur27 timur27 requested a review from mattallan February 28, 2025 22:53
@@ -1697,10 +1697,19 @@ public function process_payment_for_order( $cart, $payment_information, $schedul
'payment_method' => $payment_information->get_payment_method(),
];
}
} elseif ( $this->is_changing_payment_method_for_subscription() ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered adding an extra filter to execute this code only for succeeded setup intent statuses, skipping processing and requires_capture. Besides the information gathered from Stripe docs that those statuses are unlikely (and for the requires_capture this status is never set for change payment method flow p1740995860215559-slack-C01BPL3ALGP), the main conclusion I made was that for non-3DS cards historically, our payment processing implementation resulted in a successful response for PROCESSING and REQUIRES_CAPTURE statuses, which for the change_payment_method flow meant that it still updated subscription status for those payments.

Having said all that, I think entering this flow for statuses other than REQUIRES_ACTION makes sense. LMK how does it sound to you.

@timur27 timur27 requested review from a team, brettshumaker and james-allan and removed request for a team and mattallan March 4, 2025 08:23
@james-allan
Copy link
Contributor

james-allan commented Mar 4, 2025

🧪 Test cases

3DS Payment method authorization failures

  • Upon canceling the modal window from the top right side, confirm:
    • "We are unable to authenticate your payment method. Please choose a different payment method and try again." error is displayed.
    • Subscription still has the old payment method attached.
    • Processing a renewal successfully used the old card.
  • Upon failing the authorization, confirm:
    • "We are unable to authenticate your payment method. Please choose a different payment method and try again." notice is visible.
    • Subscription still has the old payment method attached.
    • Processing a renewal successfully used the old card.

3DS Payment method authorization success - 4000002760003184

  • If the "Use this payment method for all of my current subscriptions" checkbox is unchecked, confirm:
    • No success notice is displayed behind the confirmation modal window.
    • You are redirected to the subscription details page under My Account.
    • "Payment method updated." success notice is displayed.
  • If the "Use this payment method for all of my current subscriptions" checkbox is checked, confirm:
    • You are redirected to the subscription details page under My Account.
    • "Payment method updated for all your current subscriptions." success notice is displayed.
    • All subscriptions were updated with the new payment method.

Edge cases

  • When using the insufficient funds 3DS card (4000000000009995), confirm:
    • The card is not attached to the subscription after failure.
    • The correct error notice for insufficient funds is displayed.

Subscription renewal with 3DS payment method

  • When processing a renewal for a subscription with a 3DS card attached, confirm:
    • The order is placed On hold upon renewal processing attempt.
    • Upon navigating to the link in the renewal order email, the order can be successfully renewed with a 3DS card.
  • Perform the same renewal test, but change to a non-3DS card during renewal order.

@james-allan
Copy link
Contributor

@timur27 I ran into an error (Error: No such payment_intent: 'seti_1Qz4Px2HReucZ98RTRxC0v6N') when attempting to successfully update a subscription.

I'm not sure if I'm doing something wrong. I've uploaded this video to show what I was doing:

woopayments.PR.10453.mov

@timur27
Copy link
Contributor Author

timur27 commented Mar 5, 2025

@james-allan thanks for your review and testing so far! Interestingly, I cannot reproduce this so far. I first thought maybe you're trying to test a subscription that was created prior to the bugfix (which is a perfectly valid scenario to test) but then I noticed the subscription start date from 4 minutes ago which made me think that this is probably not the case. Also from your screen recording I can see that we are trying to search for a setup intent doing via a payment intent request, although this flow should be avoided per some changes in this PR, so I'm not sure why it's entering it.

I'll try further to reproduce it. In the meantime, feel free to add any more details you might find helpful. Thanks!

Screen.Recording.2025-03-05.at.08.06.43.mov

UPDATE: @james-allan I was able to reproduce it on JN site where I use the WooPayments package based on my branch. This doesn't behave the same as my local environment. I think the isChangingPayment flag is not added to the global config due to one of the check failing. I don't think it's is_changing_payment_method_for_subscription because I see the change_payment_method in the URL path so I guess this has something to do with is_subscriptions_enabled. I'll be looking further into it, feel free to drop any ideas regarding WooPayments <-> Subscriptions integration that might be missing in the setup, if you have some.

@timur27
Copy link
Contributor Author

timur27 commented Mar 5, 2025

@james-allan @brettshumaker The failure here probably happens due to some subscription packages missing in WooPayments' production build. To not block testing/review, can you please review/test locally if your environment allows you to, while I'll have a look at the problem.

@james-allan
Copy link
Contributor

I was able to reproduce it on JN site where I use the WooPayments package based on my branch.

Ah, I was thinking while reading your message that it could be related to the zip generated on JN.

I think the isChangingPayment flag is not added to the global config due to one of the check failing.

Unless I've misunderstood, I don't think this is the issue I'm seeing on my JN site.

On the change payment method page I see this:

Screenshot 2025-03-06 at 12 17 35 pm

When the modal pops up, it does change to "1" however, looking at how the isChangingPayment is used, I don't think that would cause an issue.

Screenshot 2025-03-06 at 12 18 37 pm

@timur27 timur27 force-pushed the add/change-pm-3ds-flow branch from 8a21467 to 1b92419 Compare March 6, 2025 08:29
@timur27
Copy link
Contributor Author

timur27 commented Mar 6, 2025

@james-allan Thanks for your help by providing some useful details! The problem turned out to be the request parser was not supporting booleans and those should be converted to strings. It worked locally because the value from the back-end was mapped to a "1" whereas in JN it's true and I needed to map it to string, similarly to how it's done in other place.

@james-allan @brettshumaker this is now ready to be further tested and reviewed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Payment - Error when changing subscription payment method to a new 3DS CC with UPE disabled
3 participants