admin管理员组文章数量:1313613
I have this:
const customer = await stripe.customers.retrieve(
'[email protected]'
);
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.
I have this:
const customer = await stripe.customers.retrieve(
'[email protected]'
);
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.
Share Improve this question edited Oct 7, 2022 at 23:47 Super Kai - Kazuya Ito 1 asked Oct 27, 2021 at 3:31 gianlpsgianlps 2174 silver badges14 bronze badges 2- it says you need the id stripe./docs/api/customers/retrieve – cmgchess Commented Oct 27, 2021 at 3:44
- maybe there can be many accounts for one email address – cmgchess Commented Oct 27, 2021 at 3:47
2 Answers
Reset to default 8You will need to use https://stripe./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.
Using "list()" and "search()", you can get customers by email with these Node.js code below:
const customers = await stripe.customers.list({
email:"[email protected]",
});
const customers = await stripe.customers.search({
query:"email:'[email protected]'",
});
You can also limit customers to get with "limit" parameter as shown below:
const customers = await stripe.customers.list({
email:"[email protected]",
limit: 3,
});
const customers = await stripe.customers.search({
query:"email:'[email protected]'",
limit: 3,
});
本文标签: javascriptHow to retrieve customers by email in nodejs (Stripe)Stack Overflow
版权声明:本文标题:javascript - How to retrieve customers by email in node.js (Stripe) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741937896a2405966.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论