#Handling Payments and Building a Good Component for that

15 messages · Page 1 of 1 (latest)

red shale
#

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

lyric nacelleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

viral elbow
#

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

#

that's how I would do it.

#

you could make route inside /src/app/api/.... to handle webhook:

so stripe webhooks goes to API route in nextjs,

and inside API route you can interact with database

red shale
#

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

viral elbow
#

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