#jaybabu_code
1 messages ¡ Page 1 of 1 (latest)
đ 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.
- jaybabu_code, 8 hours ago, 13 messages
- jaybabu_best-practices, 6 days ago, 59 messages
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
The previous guidance is how to do this. You'd have to manually examine the card fingerprint
But it still attaches to the customer
You have to examine fingerprint in your code
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?
Exactly
Does that sound like a good idea?
Why would you confirm the intent if the fingerprint has been seen previously?
I need to collect money
I thought you wanted to block existing cards?
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
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?
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
Oh so you have a different payment flow in your integration for offline payments
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
Ok so then in your case you should unset setup_future_usage on the payment intent before confirming
So that card isn't attached
and we don't know it is the same card until they tap so i can't change the api call for collect payment
wherre would i unset it? i don't see the confirm api takingn that in? https://docs.stripe.com/api/terminal/readers/confirm_payment_intent?api-version=2025-09-30.preview
sorry, maybe that's ann old doc. llet me update versionns
yeah, it is the same there
so it would be reader.collect_payment_method then detect duplicate then update.payment_intent (unset future) then reader.confirm?
yeah
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
Yeah you can always detach if you'd rather do it that way
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?
correct
yes you're correct
okay, would stripe know a payment method is no longer valid like the stolen case?
i don't see a dedicated webhook that i can listen to for that. guessing just payment_method.updated?
No worries!