PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 23, 2022

[FIXED] How to retrieve customers by email in node.js (Stripe)

 October 23, 2022     api, email, javascript, node.js, stripe-payments     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing