Use Email to find a Customer

2,126 views
Skip to first unread message

Priyabrata Sarkar

unread,
Dec 10, 2014, 10:27:17 PM12/10/14
to api-d...@lists.stripe.com
Hi,

I am facing a typical issue, The Customer API allows only customer id to be used to fetch a customer which is fine. But there are cases where I need to first check a customer exists by email,

To get a work around this, I have to download all customers to a table and run the lookup. This is time taking task if the account has over 10k customers. Having a provision to search a customer by email could drastically improve the speed.

Our app is using email to verify a customer in merchant account, verify in db table, if found charge the customer or create a new customer

In another case I found Stripe allows to create multiple customer on same email. This is logically incorrect since customer account is unique across the account, so does the email. Even for some reason it was allowed, a provision to search a customer by email could allow the apps to perform the check themselves instead of relying on Stripe.

Could you tell me this provision can some time be added.

Thanks in advance


Jim Danz

unread,
Dec 12, 2014, 4:28:49 PM12/12/14
to api-d...@lists.stripe.com
Hi Priyabrata,

Thanks for this note, and for explaining your use cases and concerns.
I agree that our API today does not support using Stripe to enforce
uniqueness of email per customer. If you want to enforce that
uniqueness, my best recommendation is to maintain a mapping of email
address (or other user-identifying-token) to stripe customer id on
your side.

I apologize for the hassle here. It's something that does come up and
that we may improve in the future, though we likely wouldn't go all
the way toward *enforcing* uniqueness of email per customer, as some
users have bonafide use cases for having multiple Stripe customer
records that pertain to the same end user email address.

Hope this helps provide a bit more color, though sorry that we don't
have the "right" answer for you here.
Jim
> --
> You received this message because you are subscribed to the Google Groups
> "Stripe API Discussion" group.
> To post to this group, send email to api-d...@lists.stripe.com.
> Visit this group at
> http://groups.google.com/a/lists.stripe.com/group/api-discuss/.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to api-discuss...@lists.stripe.com.

Matthew Arkin

unread,
Dec 12, 2014, 4:51:37 PM12/12/14
to api-d...@lists.stripe.com
A great case of not having unique emails is if a customer wants 2 subscriptions and wants each to bill a separate credit card, this actually invoices 2 stripe customers with the same email address.

--
Matt Arkin
Kollective Solutions
http://kollective.it
http://mattarkin.com
signature.asc

Priyabrata Sarkar

unread,
Dec 12, 2014, 11:49:55 PM12/12/14
to api-d...@lists.stripe.com
Hi Jim ( and Matthew)

I completely understand the use case currently exists within Stripe to
allow same email to create multiple customers, although I would not
believe this is widely used.

So be it and applying uniqueness of email per customer is really now
big task so I definitely would not ask for it.

But adding a feature where I can search a customer by email via api (
may it return multiple customers ) would allow me to perform the logic
check in my app. It already exists in Stripe Dashboard where I can
search a customer by email, adding the feature in API should not be a
big task I hope.

Thanks for your responses though

Regards,

Priyabrata Sarkar

Web Development & Solutions Consultant.
Proprietor, Sologic Solutions

Company : [http://www.sologicsolutions.com]
Portfolio: [http://www.yespbs.com]
LinkedIn: [http://in.linkedin.com/in/yespbs]

priyabrata.sarkar [skype]
yes...@gmail.com [GTalk & AIM]
priyabrata.sarkar_73 [yahoo]
priyabra...@hotmail.com [MSN]

Jasim Mohd

unread,
Dec 13, 2014, 2:44:13 AM12/13/14
to api-d...@lists.stripe.com
Hi Priyabrata,

Normally we track the system by adding a 'billing_ref' (stripe customer's unique id) field to the customer(who having email id).

In case you forgot to add the the field at first, and added a 1000 customers in your stripe account. you could fetch all the customers from stripe, programmatically and create a mapping between email address and customer id for eg:(ab...@gmail.com :cus_234223423423) and save it to csv file, and add the 'billing_ref' to the customer table, run a query to update all the fields. Later when you get the emailid of customer, get the billing_ref also from the database table, and get the stripe customer object via billing_ref

Priyabrata Sarkar

unread,
Dec 13, 2014, 3:40:59 AM12/13/14
to api-d...@lists.stripe.com
Hi Jasim,

Thanks for your explanation, I am currently doing similar approach to
sync the data in a mysql table and running the look. But I am
requesting if you can add the provision ( search customer by email and
return a 404 or customer object if found).

The app I am developing is using stripe merchant app, once merchant
connects, we put a queue to sync his stripe customers into our
database.

The next step is product purchase which uses email to identify the
buyer as stripe customer, we are doing look up in the customers table
as pointed above, if stripe customer found, we are charging his
default card, if not found we are sending him to a stripe checkout
popup where he enters his credit card, submitting which a stripe
customer is created and synced in our customers table for next time
check.

The system works fine without problem except the below.

When there is more than 10k customers for an account, it takes time to
sync all customers, think of a case when a buyer who has not yet
synced in the lookup customers table, we are showing him stripe
checkout which created a new customer.

So now we have two customers account in our lookup table for same email !

We could have avoided that if there was a customer lookup in api via
email, it may return multiple accounts, we will take the first one.

I hope I have clarified my issue and requirement

Thanks in advance

The
Regards,

Priyabrata Sarkar

Web Development & Solutions Consultant.
Proprietor, Sologic Solutions

Company : [http://www.sologicsolutions.com]
Portfolio: [http://www.yespbs.com]
LinkedIn: [http://in.linkedin.com/in/yespbs]

priyabrata.sarkar [skype]
yes...@gmail.com [GTalk & AIM]
priyabrata.sarkar_73 [yahoo]
priyabra...@hotmail.com [MSN]


Reply all
Reply to author
Forward
0 new messages