-
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
Move charge related code to separate try-catch to prevent renewal failure #3444
Conversation
} | ||
|
||
try { | ||
|
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.
The diff makes it look like some lines are added or removed. But the only change I made here is, I have moved this block to another try-catch below, where catch block logs the error only.
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 @Mayisha thanks for the details description and nice approach to this issue!
After performing code review I have a quick question, should we be returning at the end of the first catch
if the payment fails?
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.
Thanks @Mayisha for the latest commits!
I've tested these changes and confirm the order is not marked as failed if the request to get the latest charge and process response fails. 💯 The order was left pending payment and then later was automatically marked as processing once the intent success webhook was sent (i'm assuming this is correct).
Reported in 8657329-zd-a8c
Discussion p1726467962851179-slack-C7U3Y3VMY
In process_subscription_payment function under one try-catch block, we make 2 API calls during the payment flow.
charge
object to find the transaction ID. (here and here)The merchant reported that their customers are charged multiple times for the same subscription renewal. They have the retry mechanism enabled for failed payments.
We have noticed from their logs that they encountered some timeouts during requests to Stripe. In the above function, when they encountered the timeouts in step 2, it marked their order as failed. As a result the retry mechanism was triggered and customer was charged again.
Changes proposed in this Pull Request:
failed
.Testing instructions
develop
branch.Retry Failed Payments
.charges
request.Order actions
dropdown.charges
related error in your logs.