Reputation: 1070
I'm receiving a confirmation token after successfully paying through the Stripe API.
I'd then like to give paying customers access to an API endpoint, which they'll query to receive data. But only paying customers should be successful in querying the API. So how should I think about doing this? I'm entirely new to online payment systems.
I was thinking like this:
User -> Stripe -> Payment confirm -> Payment token
User -> Send token to endpoint -> Check token is valid? -> Return data if so
Is that right? If so, how would I check the token? I thought Stripe might have a way to verify a token. Or should I build my own db for this purpose?
My app is running in Node and Express.
Upvotes: 0
Views: 734
Reputation: 1179
Access to the service should be handled wholly in your own system, you could do this by associating a particular payment with a customer in your own database. If the customer pays at Stripe, then you could be notified about that via a webhook [1], and then you could "turn on" access for the authenticated user for example.
How you associate a particular payment with customer can also be handled in your system, for example, creating PaymentIntents and then saving them mapped against your customer in your own DB.
[1] https://stripe.com/docs/webhooks
Upvotes: 1