#satyashetty
1 messages · Page 1 of 1 (latest)
Hi, let me help you with this.
Are you using Stripe Checkout to create Subscriptions?
Are you with me?
You can then save the Customer ID in your database and check for the ID in the customer.subscription.created webhook event. This way you will know what customer the subscription belongs to.
see i am using a api call to redriect user to susbscription page of stripe
then once user subscription is successful i am using a webhook to capture the success in my database
This perfectly aligns with my suggestion.
my question is - what if the user changes his email id once i redirect him to the stripe subscription page - as this is the only priomary key i have to identify the customer
No, in Stripe the only primary key is the Customer ID: cus_xxx
You can have many Customers with the same email but they all will have different ids
correct cus_xx - is stripe primary key , so what ur suggesting is create the stripe id cus_xxx for each new user on signup ? and then pass this on to the subscription page so that even if user changes his email id i will have a unique stripe customer id to track him?
You can create a Customer object before you create a Checkout Session, and use the customer.id in the Checkout Session and also save it in your database.
ok so i only pass the customer field & not pass the customer email ; Also, is there a link which lists the steps to create a customer without the customer having to make any payment on stripe>? Bascially when a new user signs up I want to create a stripe customer id and store it in my database against the particular customer
You can use this API call to create a Customer object: https://stripe.com/docs/api/customers/create
ok let me try this and get back to u
bascially we track the customer based on his cus_id on stripe - doesnt matter if he changes his email midway, all that we need to track is the customer id
Correct
cool thanks
Happy to help.