Let's say a customer is returning to pay for a subscription after some time of not using the service. Once card information from a customer is POSTed from the client browser, does stripe.customers.create identify the card that has been used before? In such case, does customer object id returned has the same id as the one customer had before? I am asking this question because I am not sure if I should relate one customer ID per a user in my DB or multiple customer IDs per a user.
If a customer come back to do some operation we can suppose that you have already all the informations about that.. So you have to handle if create or update a customer (card or subscription, etc.. )
This is the documentation about Stripe.create.Customer.
And it say:
Creates a new customer object.
Anyway, explains more about your situation. Is it into a site where the user is already logged-in? Or is it different?
Yes Customer ID is a constant string in stripe. In your application, when you register your customer, make sure you through one call to stripe payment gateway to register there. stripe.customers.create() method should be invoke with customer object as parameter.
https://stripe.com/docs/api#create_customer
After creating user in stripe you can add card for that user from you api by throwing a call to this method of stripe stripe.customers.createSource({},{},cb)
here first parameter will be customer ID which is returned from stripe. second parameter will be token and third parameter will be a callback function if you are in (Node.js) environment.
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With