#coryschires

1 messages · Page 1 of 1 (latest)

quaint fieldBOT
#

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

gilded quail
#

👋

celest summit
#

Is there a way to tell Stripe NOT to automatically add a card to a customer when they pay an invoice?

gilded quail
#

Are you using charge_automatically here?

celest summit
#

No. I think not

#

I am using charge by email invoice (or whatever the option is called)

gilded quail
#

Ah okay so send_invoice

celest summit
#

Yes, taht

gilded quail
#

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.

celest summit
#

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.

gilded quail
#

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?

celest summit
#

Looking...

#

payment_method.attached

gilded quail
#

Ah yeah that is the issue

celest summit
#

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

gilded quail
#

Yes that is the case with cards added via the Hosted Invoice Page

celest summit
#

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

gilded quail
#

So really though you don't want to detach before you get a payment_intent.succeeded Event...

celest summit
#

While it pretty dumb, this is a problem for their internal processes / billing departments (bc they work at large institutions)

gilded quail
#

Yeah I understand

#

The issue here is that you also want to detach when payment fails 🤔

#

Okay so here is what I recommend.

celest summit
#

On the edge of my seat 😆

gilded quail
#

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.

celest summit
#

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

gilded quail
#

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

celest summit
#

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

gilded quail
#

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.

celest summit
#

looking...

quaint fieldBOT
celest summit
#

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!

gilded quail
#

♥️