#coryschires
1 messages · Page 1 of 1 (latest)
Hello coryschires, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• coryschires, 6 minutes ago, 24 messages
👋
Followin up on this thrad https://discord.com/channels/841573134531821608/841573134531821616/threads/1166751255398461470
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Is there a way to tell Stripe NOT to automatically add a card to a customer when they pay an invoice?
Are you using charge_automatically here?
No. I think not
I am using charge by email invoice (or whatever the option is called)
Ah okay so send_invoice
Yes, taht
Hmm let me check one sec.
Yeah no that's not possible. You would need to detach the Card via Webhook. You can't prevent it from happening in this flow.
Gotcha. But here's the rub. I am currently detaching via webhook. But, according to your colleage, that's detachment is causing the other problem where the card is subsequently rejected, which frusterates users.
Let me look at one of the examples you provided before
One moment
Hmm what Event do you listen to in your Webhook handler to determine you should detach the card?
Ah yeah that is the issue
And we sniff it out using something like payment_method_added_by_stripe = payment_method_id =~ /^src_+/
Bc, as I recall, if the payment method id starts with src_ it means it was automatically added by Stripe
Yes that is the case with cards added via the Hosted Invoice Page
Got it. Yes. That's the case we are trying to avoid / undo.
Our customers think, "I'm making a one-off payment." Then they are surprised / upset that we quietly collected / stored their card
So really though you don't want to detach before you get a payment_intent.succeeded Event...
While it pretty dumb, this is a problem for their internal processes / billing departments (bc they work at large institutions)
Yeah I understand
The issue here is that you also want to detach when payment fails 🤔
Okay so here is what I recommend.
On the edge of my seat 😆
Actually easier than I thought. You just want to detach when you receive payment_intent.payment_failed or payment_intent.succeeded. Ignore everything else basically.
Let me do one quick check test around that to make sure but pretty sure that is all you need.
FWIW, we do have lots of other use cases (again, big institutions, sheesh). For example, we collect one-off payments from non-customers via credit card. We also do a good bit of charge_automatically billing. It's quite a range.
I'm mentioning this because I want to be wary of uninteneded side-effects
Yeah this is tough then as you would have a ton of overlap by using the Event types I mentioned and you would have to retrieve the Customer each time to check whether a Card Source was attached.
Hrmm
I'm curious why I only recently started encountering this problem. Looking at my git history, I know that my code has been auto-detaching cards in this way since May 2022
We recently put in place CAPTCHA to prevent card testing in this flow. It is related to that.
I can't think of a much better way than using payment_intent.succeeded and payment_intent.payment_failed in terms of things being foolproof here. The other thing that you could do is you could set a delay before you detach. So like wait an hour or something and then that should also avoid this situation.
looking...
Thanks everyone for the help! I will discuss these ideas with my team and follow up if need be!
Y'all Tech support is the best! Major reason I use and recommend Stripe to startup!
♥️