#brian.blanque-list-paymentmethods
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ do you have an example of a payment method that you were expecting to be returned?
Hi @sonic hamlet, just checking to see if you're still there?
sure
import stripe
stripe.api_key = 'sk_test_YFbFEON16P6Y8ZH2aM4u383k'
params = {'type': 'card'}
request = stripe.PaymentMethod.list(**params)
I'll test from the console itself in a moment
I can see a traceback in stripe_id which seems weird ๐ค
I'd strongly recommend you roll that key.
I'll roll it later or you think it's related to why I'm getting this response
I don't think it's related to the results you're seeing, just a security suggestion.
indeed, I know, but it's just a test key
๐ taking a closer look at your account now.
thank you ๐
I see what you're talking about, and am seeing the same behavior in my account. Please bear with me while I dig into this further.
sure no prob
any idea? tried with live key, same result also with another account's testing sk
Sorry, not yet, still looking.
Hey there, you need to get this list these with a customer included -- you cannot list all payment methods without a customer specified, that's not supported
we have 40k customers in production w stripe, we'll have to do that many requests then? what's the use of that method if stripe.PaymentMethod.list if stripe.Customer.list_payment_methods is recommended ๐ฟ
What are you trying to accomplish, exactly? Why do you need to list these?
inconsistency in our db, we need to check if the payment methods are attached
can you explain that a bit more, how might this happen?
we have payment methods recorded in our db that are actually detached so we want to do a task that retrieves all payment methods and if given pm does not exist or is not related to a customer remove it from our record
I see
so, for this case, i'd suggest wetting up a webhook to handle payment_method.detached events instead: https://stripe.com/docs/api/events/types#event_types-payment_method.detached
Then you can remove these as they happen, instead of trying to poll for them
indeed, we'll implement this as well, but we still need have a cronjob to fix what we've detached before
Gotcha - so for that initial pass you would need to pull the PMs per customer