#cnguyen-pi
1 messages · Page 1 of 1 (latest)
I have the payment method and the stripe user id only. But the payment method could be an old or a new one.
I hesitate between :
- check if the payment method was attached 'today'
- check the last transaction of the customer and check if the fingerprint is the same
Or maybe there is another way
maybe I can check if the user has a transaction with these specific payment method?
Hmm.... I believe the only way to know would be to retrieve all the customer's payment methods and check each one for the fingerprint.
Yes but I attach this payment method just before. And after I do the order. So, the customer's payment method will exists.
I need to know when it's his first payment with these card. But he can add a lot of multiple cards separately on his back-office
Ah! Sorry I meant you need to retrieve all the customer's payment intents and check the payment method for each.
Can I have all the transactions for a customer and a specific payment method?
If not, can I list all the payment intent with limit 1 to have the last one? And how can I have the payment method id? with expand property?
You ccan't list all transactions for a customer w/ a specific payment method, but you can get get all the transactions for a customer. https://stripe.com/docs/api/payment_intents/list#list_payment_intents-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You can set a limit of 1 with that call, and it'll give you the most recent Payment Intent. The Payment Method ID is available on the Payment Intent be default, but if you want the full object then you'll have to expand it
to have the fingerprint, I have to expand? Or it's not possible and I need to make a new request?
Ah, there is the fingerprint by default on the payment_method_details
Right?
To have the fingerprint you would expand the Payment Method and then check card.fingerprint (https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-fingerprint)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Are you sure? Because I do the request with the limit 1 and I see a fingerprint in the data[0].charges.data[0].payment_method_details.card.fingerprint
Ah, you were looking for it in charges - both of those options will work, it's just nested much deeper if you're looking at payment_method_details.card.fingerprint
Yes but it's by default so it's better than use the expand property no?
It's up to you really - either way will work and it's just a preference.