#devangbhuva97-customer
1 messages ยท Page 1 of 1 (latest)
How can I get specific payment method details of specific customer?
you can just do
const paymentMethod = await stripe.paymentMethods.retrieve(
pm.id
);
``` if that helps
I think there's a mistake in the docs since it doesn't mention that.
yes.. above method I'm already using today I found that this method will return payment method object which are not linked with any customer
means customer deleted that payment method
So I checked this documentation & found that stripe has different api for that where I can pass customer id & payment method id
that method I posted above works for getting a PaymentMethod attached to a customer just fine
yes.. but if you delete that payment method.. still this api gives result without customer
well you can't delete a payment method, only detach it(and after that you can still retrieve it to look at details of it as you mention). What's the problem exactly?
see sample
id: 'pm_1LVBLYCScnf89tZovY3cz6JT',
object: 'payment_method',
billing_details: {
address: {
city: null,
country: null,
line1: null,
line2: null,
postal_code: null,
state: null
},
email: null,
name: 'Vivek',
phone: null
},
card: {
brand: 'visa',
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: 'pass'
},
country: 'US',
exp_month: 4,
exp_year: 2042,
fingerprint: 'yy5zeuJOgfQskwH5',
funding: 'credit',
generated_from: null,
last4: '4242',
networks: { available: [Array], preferred: null },
three_d_secure_usage: { supported: true },
wallet: null
},
created: 1660124225,
customer: null,
livemode: false,
metadata: {},
type: 'card'
}```
Yes.. I mean delete means detach
From stripe dashboard, we can delete payment method from customer details page
yep! but again, not following what the problem is
you can't entirely delete a payment method, the dashboard doesn't do that either (it might use that word but that's not how the API works)
imagine the scenario:
- create a customer with pm_123
- do a payment ch_123 using pm_123
- later, you detach the payment method
- later, you are doing some accounting and are looking at that payment ch_123 and you want to see if it used a visa or mastercard
- you can retrieve the pm_123 referenced from the charge and see what it was. If it was deleted that would be impossible
that's why it works this way
yess.. that totally make sense
it's not any problem.. we can handle it our hand by checking customer field
i was expecting that there will be some api where I can pass both ids & validate
https://stripe.com/docs/api/payment_methods/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.
but it's fine
I think above api document is just misleading
yep it is wrong, I don't understand why it shows the list call instead of the retrieve call that I shared
Yupp... thanks @full sonnet
One more question.. what is max limit of payment methods in single stripe customer?
I'm pretty sure it's 200
One of our fraudster customer got error ๐ your card attach limit is exceed!
So I was trying to find max limit in doc.
Thanks
yeah that does happen sometimes unfortunately
yess.. it won't happen with real customer ๐