#richie138-last4
1 messages ยท Page 1 of 1 (latest)
There is no direct API. You would want to start with Listing PaymentMethod passing type = card, then filter the result's last4 by yourself: https://stripe.com/docs/api/payment_methods/list#list_payment_methods-type
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If the limit is 100, how can i hope to find the right card out of thousands?
You would want to use Pagination
The easiest way is auto-pagination
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hmm it seems to be returning nothing
$cards = $stripe->paymentMethods->all(['type' => 'card','limit' => 100]);
{
"object": "list",
"data": [],
"has_more": false,
"url": "/v1/payment_methods"
}
Double-checked you should have PaymentMethod in your account? Test/Live mode?
Live mode
You can confirm in your Dashboard
Certainly have hundreds of active customers
Oh sorry, I think this API expects a Customer Id
It's optional though which is odd then
Yeah admit that it's odd
Let me report internally about this, but I also can confirm that it returns nothing without specifying Customer Id, but as soon as I pass some Customer it started returns result
hmm
I am sorry there is no efficient way to do this. You definitely can 1. List all customer 2. For each customer list all PaymentMethod 3. Filter the result on its last4. But that is very inefficient and can make your call rate-limited, so I can't recommend
I will conduct an investigation for the List PaymentMethod above
Would be great to be able to mirror certain things that are possible in the dashboard
This last4 is a good example
Another is finding a customer by email address (case INSENSITIVE!)
Not sure how to get Stripe to take these things seriously ๐ฆ
File support request to Support and it would be well recorded ๐
I filled the task internally. Can you give me the email you just used? Will link in there