#devangbhuva97-customer

1 messages ยท Page 1 of 1 (latest)

full sonnet
#

hi, not sure I understand the question, what are you missing exactly?

little willow
#

How can I get specific payment method details of specific customer?

full sonnet
#

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.

little willow
#

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

full sonnet
#

that method I posted above works for getting a PaymentMethod attached to a customer just fine

little willow
#

yes.. but if you delete that payment method.. still this api gives result without customer

full sonnet
#

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?

little willow
#

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

full sonnet
#

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

little willow
#

yess.. that totally make sense

#

it's not any problem.. we can handle it our hand by checking customer field

#

but it's fine

#

I think above api document is just misleading

full sonnet
#

yep it is wrong, I don't understand why it shows the list call instead of the retrieve call that I shared

little willow
#

Yupp... thanks @full sonnet

#

One more question.. what is max limit of payment methods in single stripe customer?

full sonnet
#

I'm pretty sure it's 200

little willow
#

One of our fraudster customer got error ๐Ÿ˜„ your card attach limit is exceed!

So I was trying to find max limit in doc.

Thanks

full sonnet
#

yeah that does happen sometimes unfortunately

little willow
#

yess.. it won't happen with real customer ๐Ÿ˜„