-
-
Notifications
You must be signed in to change notification settings - Fork 289
Skip email notification when fixing stale stripe orders #11179
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
base: main
Are you sure you want to change the base?
Conversation
server/lib/stripe/sync-order.ts
Outdated
| paymentIntent = await stripe.paymentIntents.retrieve(order.data.paymentIntent.id, { | ||
| stripeAccount, | ||
| }); | ||
| } catch (err) { | ||
| logging?.(`Order ${order.id} payment intent not found on stripe`, err); | ||
| if (!IS_DRY) { | ||
| await order.update({ | ||
| status: OrderStatuses.CANCELLED, | ||
| }); |
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.
We should look at the error type before cancelling the order. The request could fail for numerous other reasons: rate-limiting, network error, Stripe API being down...etc
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.
Fixed in this last push to specifically handle the case where the payment intent is expired on stripe. Happens when the payment intent is created, but no action is taken on it (i.e. user went into the last step of the contribution flow, but abandoned the contribution).
|
|
||
| logging?.(`Order ${order.id} paymentIntent status: ${paymentIntent.status}`); | ||
|
|
||
| const charge = (paymentIntent as any).charges?.data?.[0] as Stripe.Charge; |
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.
Why only look at the first charge? Could it be that a payment intent fails first, then succeeds after?
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.
This array contains the charges ordered by most recent first. Its a deprecated field, replaced by latest_charge in the latest API, but I did not want to modify this at this time. We are due a task to try and update our stripe API usage, this field is not missing even from the docs at stripe.
…ail-notification-on-stripe-fix
No description provided.