#jaybabu_code

1 messages ¡ Page 1 of 1 (latest)

clear bayBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1480944355589095514

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

ivory gyro
#

I just realize the previous guidance doesn't help. How do I prevent the duplicate payment method from being attached to the customer

#

avoid creating duplicate payment methods for the same card on a customer? We don't know the card details until the customer taps their card which is after the process call
Instead of process_payment_intent, you can do collect_payment_method
https://docs.stripe.com/terminal/features/saving-payment-details/save-after-payment?terminal-sdk-platform=server-driven#collect-payment-method
At this point, you can access attributes like card brand, funding, and other useful data from the PaymentMethod.
When you use collect_payment_method, you should be able to access attributes from the PaymentMethod, of which, you can access the fingerprint [0] and check if it is the same as an existing payment method attached to the Customer

[0] https://docs.stripe.com/api/payment_methods/object?api-version=2026-02-25.preview&rds=1#payment_method_object-card_present-fingerprint

Accept an in-person payment and save payment details to use later, when the customer is not present.

copper juniper
#

The previous guidance is how to do this. You'd have to manually examine the card fingerprint

ivory gyro
#

But it still attaches to the customer

copper juniper
#

You have to examine fingerprint in your code

ivory gyro
#

I know I can examine the fingerprint

#

But it stilll attaches the payment method to the customer

#

Are you saying don't call confirm payment intent if the fingerprint was previously seen?

ivory gyro
#

Does that sound like a good idea?

copper juniper
#

Why would you confirm the intent if the fingerprint has been seen previously?

ivory gyro
#

I need to collect money

copper juniper
#

I thought you wanted to block existing cards?

ivory gyro
#

No, I simply want to create a customer and save their payment information for future use (with consent)

#

however if i see the same card again, it shouldn't create a new payment method on the customer

copper juniper
#

So when they tap an existing card, you want to process payment offline with the saved payment method instead of the presented payment method?

#

Or just pay with the presented card and not attach it?

ivory gyro
#

No, when they are tappinng their card that will be processed in the same flow. We save their card for offline use later

#

for a future offline purchase

copper juniper
#

Oh so you have a different payment flow in your integration for offline payments

ivory gyro
#

yes, we can use that card in the future like if they place an order online, we verrify their identity and they can just checkout or a subscription, etc.

#

but if they are tapping their card again, that means they are purchasing something at the physical store which is a new transaction like you buying groceries/liquor for example

#

we would get their consent to save their card for future use, but it is useless to save the same card twice

copper juniper
#

Ok so then in your case you should unset setup_future_usage on the payment intent before confirming

#

So that card isn't attached

ivory gyro
#

and we don't know it is the same card until they tap so i can't change the api call for collect payment

#

sorry, maybe that's ann old doc. llet me update versionns

#

yeah, it is the same there

copper juniper
#

Unfortunately you'd have to add an other api call

#

to update the PI

ivory gyro
#

so it would be reader.collect_payment_method then detect duplicate then update.payment_intent (unset future) then reader.confirm?

copper juniper
#

yeah

ivory gyro
#

that is quite ugly in the core payment flow. can i simply collect it. listen to webhook for customer.attached_pm then detect duplicate and detach there? may need to cancel payment method too

copper juniper
#

Yeah you can always detach if you'd rather do it that way

ivory gyro
#

is my understanding corrrect inn that onnce detached, it just can't be used in anything? my understanding frrom the doc. i don't see a way to "cancel" the payment method itself

#

that seems implicit with the detach api

#

also, if the card were to get updated like expiration, the existing payment method would get updated and if they tapped the new updated card, it wouuld have the same fingerprint? i think stolen would just be a new card all together so different fingerprint?

ivory gyro
#

okay, would stripe know a payment method is no longer valid like the stolen case?

ivory gyro
#

i don't see a dedicated webhook that i can listen to for that. guessing just payment_method.updated?

ivory gyro
#

Sorry, i am dumb. thanks!

#

that should be all for now!

copper juniper
#

No worries!