Home > Net >  retrieve customer by email address stripe node.js
retrieve customer by email address stripe node.js

Time:10-28

I have this:

 const customer = await stripe.customers.retrieve(
  '[email protected]'
);

I am 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.

CodePudding user response:

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: '[email protected]',
});

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.

  • Related