So, I want to create a dynamic route and pass the link to an external application under their callback section.
The URL is usually like this:
htttp://localhost3000/builder/live/thankyou?trxref={reference}
The reference is dynamic which means it changes and comes from the external website. I could do this easily in create react app. I am struggling with doing same in Nextjs.
Inside the page folder
, I created mine this way:
builder/live/[slug].tsx
This is always returning page not found error whenever the url
gets hit. That is obviously because it is not the actual path. How do I achieve this since.
The entire idea is that a user pays for a product, after succeessfully paying, I want to redirect the user to this page in my Nextjs application and I need to create the page and pass that as a callback to the payment gateway website.
2
Answers
UPdate I made mistake with my api request which was causing the error. The error was not coming from Nextjs. I have corrected my mistake
You can use this path:
builder/live/thankyou.tsx
and use this way to get the
reference
value: