-
Notifications
You must be signed in to change notification settings - Fork 206
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
Fix Cash App Pay token reuse issues (with subscriptions) #3263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @wjrosa. I've been following some general Subscription testing instructions. I've listed them all below. I ran into a couple of issues, I'll follow up and finish testing shortcode checkouts tomorrow or later this week.
BLOCK CHECKOUT
- Purchase subscription
- New token
- Existing token
- Free trial subscription
- New token
- ❗ Existing token
- Selecting an existing token and attempting to sign up to a free trial
just leaves the customer on the checkout pageleaves the subscription without a stored payment method. There's more to this as well. I'll leave a comment below. *
- Selecting an existing token and attempting to sign up to a free trial
- Mixed checkout (simple + subscriptions)
- New token
- Existing token
- Multiple Subscriptions
- New token
- Existing token
SHORTCODE CHECKOUT
- Purchase subscription
- New token
- Existing token
- Free trial subscription
- New token
- Existing token
- Mixed checkout (simple + subscriptions)
- New token
- Existing token
- Multiple Subscriptions
- New token
- Existing token
OTHER FEATURES
- Renew subscriptions
- New token
- Existing token
- Change subscription payment
❗ I cannot get Cash App to show as an option on the change payment method screen. (screenshot)- New token
- Existing token
- Add payment method via My Account.
❗ The Cash App modal isn't shown. There's a browser console error and this error in Stripe.This is not related to this PR. Fixed in Fix Stripe Link saved payment methods #3311
- Failed/manual renewal - Block Checkout
- New token
- Existing token
- Failed/manual renewal - Shortcode Checkout
- New token
- Existing token
* Free trial - existing token issue. Even if I fixed the redirect problem, there's another issue where the subscription's payment method isn't set to the Cash App token. This is because the return happens so early in the process_payment_with_deferred_intent()
function that things like saving the payment method information doesn't happen.
includes/payment-methods/class-wc-stripe-upe-payment-gateway.php
Outdated
Show resolved
Hide resolved
I believe the latest changes fixed this issue.
I had the same issue and did some debugging. The issue happens on It looks like this property is set by calling |
…nt method so Cash App can be selected
I actually fixed the above on 64b20d5 @james-allan 👍 |
hi @james-allan ! I tested the other flows from your checklist myself, and I guess it is all good. One thing that I noticed is that when using an existing token, the subscription is set to "active", while with a new token, it is set to "pending". Is this expected? 🤔 I thought both would require a webhook call to process |
@wjrosa this flow is causing an issue for me. If you add a subscription with a free trial to your cart and then use a saved Cash App token, the resulting subscription will have missing payment method token information.
To fix this we'd need to update this section of the code. If you purchase a free subscription with a saved token, the payment_complete and early return occurs without storing the token to the order. We essentially need to make sure we still save the token to the order too. re: $this->maybe_update_source_on_subscription_order(
$order,
(object) [
'payment_method' => $payment_information['payment_method'],
'customer' => $payment_information['customer'],
],
$this->get_upe_gateway_id_for_order( $upe_payment_method )
); |
Yeah that seems a little off. Are you sure one of them is just going straight to active? My webhooks are so quickly processed that I don't notice any difference. But yes, if you're using a saved payment method or a new token to pay for a new subscription that has an upfront cost I'd expect both of them to involve a webhook process. In my case when I use a new or existing token by the time I land on the order received page the subscription is active. Now that I think on it, perhaps what you're seeing is the difference between a setup intent and just payment intent. 🤷 In my testing though both result in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look pretty good @wjrosa. I just left a comment about the subscriptions with a free trial being purchased with a saved payment method.
Thanks, @james-allan ! I fixed this on b8bd1af |
Any ideas where this status change to |
Still not sure where the issue is, but I did some debugging and saw that:
So, what should we do in this case? (when using a saved Cash App Pay token for a paid subscription)
(but it may break something as we will have only the setup intent when the order/subscription is processed by the webhook call)
|
@james-allan I did some additional analysis today for the status difference I mentioned earlier (after your fix for live payments), and I think the issue might be the Non-saved token
Saved token
So:
|
I just tested this on a JN site, and the webhook call worked. So, maybe we don't need to do anything else here. |
Nah I don't think we do need to display the QR code because the PM has already been set up and we have a saved token.
Ok I'll rerun through some tests and confirm this works as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLOCK CHECKOUT
- Purchase subscription
- New token
- Existing token
- Free trial subscription
- New token
- Existing token
- Mixed checkout (simple + subscriptions)
- New token
- Existing token
- Multiple Subscriptions
- New token
- Existing token
OTHER FEATURES
- Renew subscriptions
- New token
- Existing token
- Change subscription payment
- New token
- Existing token
- Add payment method via My Account.
- Failed/manual renewal - Block Checkout
- New token
- Existing token
I also ran a basic test using a new token and a saved token on the shortcode checkout just to be sure.
Fixes #3171
Changes proposed in this Pull Request:
This PR enables the use of Cash App Pay when paying for subscriptions with free trials and as an option when changing a subscription's payment method.
For that, I have updated the usage of the Cash App Pay confirm method. The wallet hash generation method includes a new parameter (the payment intent type).
Known issue: The subscription extension adds a "success message" before the redirect is completed, which can be confusing for customers.
Testing instructions
fix/cashapp-token-reuse2
)npm install
,npm run build:webpack
andnpm run up
(the following testing guide was extracted from the original issue)
Free trial
Changing payment method
changelog.txt
andreadme.txt
(or does not apply)Post merge