Handling Payments and Building a Good Component for that
Unanswered
Tonkinese posted this in #help-forum
TonkineseOP
Hey,
So i am currently working on a Payment System using Stripe!
But there isn't just a Plan! I want the user to configure its Plan!
Currently I am having this Component I attached here! There the user can enter everything and see as a preview, how its customized solution would look.
Now I am unsure, how to get its payment. More of like how to safe his settings.
The Preview is clientside. I created a Payment Link in Stripe and there the user has to pay. I get a webhook when payed.
But because it is clientside i am unsure how to save it. Should I add like a form action, a button and when you press it, the current values get added to a cache and the user gets added to the Payment page?
And more how do i know, which settings i have to get from the cache when it is payed? like i have somehow to link the settings to the payment.
I was thinking about the Custom Fields on Stripe and everything you need you can enter at stripe - Would be a solution but there are only 3 Custom Fields currently.
Aswell it would be much nicer to have a preview and then you can directly order that one and dont have to reconfigure it.
I hope you can understand my issue right now.
Regards
So i am currently working on a Payment System using Stripe!
But there isn't just a Plan! I want the user to configure its Plan!
Currently I am having this Component I attached here! There the user can enter everything and see as a preview, how its customized solution would look.
Now I am unsure, how to get its payment. More of like how to safe his settings.
The Preview is clientside. I created a Payment Link in Stripe and there the user has to pay. I get a webhook when payed.
But because it is clientside i am unsure how to save it. Should I add like a form action, a button and when you press it, the current values get added to a cache and the user gets added to the Payment page?
And more how do i know, which settings i have to get from the cache when it is payed? like i have somehow to link the settings to the payment.
I was thinking about the Custom Fields on Stripe and everything you need you can enter at stripe - Would be a solution but there are only 3 Custom Fields currently.
Aswell it would be much nicer to have a preview and then you can directly order that one and dont have to reconfigure it.
I hope you can understand my issue right now.
Regards
14 Replies
Northeast Congo Lion
Store it in a database
if its one off payment or subscription,
store it inside database with associated data like config:
for image, name etc
store it inside database with associated data like config:
for image, name etc
that's how I would do it.
you could make route inside
so stripe webhooks goes to API route in nextjs,
and inside API route you can interact with database
/src/app/api/.... to handle webhook:so stripe webhooks goes to API route in nextjs,
and inside API route you can interact with database
TonkineseOP
Yeah I am currently also having a Webhook
So I would need to do a Form and save it in the db if you press order
Or in the Cache
So if it isnt orderd the data expires
But
How do I know which settings are linked to the Payment
Northeast Congo Lion
well you could still storein db
and have a CRON job which checks say if db entry has not been PAID since x days from CREATED
then remove it
TonkineseOP
Okay true