Issue
I have this:
const customer = await stripe.customers.retrieve(
'info@myemail.com'
);
I'm trying to get the customer number (id) of the customer based on the email address. Is this possible through stripe? It gives me an error when I do this.
Solution
You will need to use https://stripe.com/docs/api/customers/list and it will return a list of customers with that particular email address.
const customers = await stripe.customers.list({
email: 'info@myemail.com',
});
Note that there is a limit on the number of objects to be returned. You should make use of auto pagination in case there is a large number of customers with the same email.
Answered By - alex Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.