mern-paystack-

Job ID: 37807686

Budget: $10 – $30 USD

hi,

i have a referral system that is built using next.js and mongodb.

PROBLEM:

when a user submits the /[referralId] form, we redirect the user to their /rewards/[pathId] route, and then save the user to the db. this flow works fine, but the problem is that users are self-referring themselves.

SOLUTION:

when a user submits the /[referralId] form, i want the user to be redirected to a paystack checkout so the user's bank card or other payment method will be charged. if the checkout is successful, i want the user to be redirected to their /rewards/[pathId] route, and then save the user to the db. but if the checkout is not successful, we will redirect the user to the /[referralId]/failed route and we will not save the user to the db.

It's a next.js app that uses MongoDB/Mongoose for database.

kindly see the screenshots attached.

cheers,

K
Related categories: JavaScript React.js MongoDB Next.js MERN