#uri-easter_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1257396482584088606
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
I like your crow photo
Very elegant
Is that crow one of your pets? Or is it because you really like crows?
Hi there, apologies for the delay. I meant to circle back to this, but the server is busy.
Cannot find module 'next/dist/compiled/next-server/pag
Require stack
Can you paste the full error message here?
P.S. Thanks for the crow mention. I just dig crows
I think this might simply be out of date. Like, the Youtube video links out to a branch of our test samples that shows a 404 for the path to the relevant code: https://github.com/stripe-samples/accept-a-payment/blob/main/custom-payment-flow/client/react-cra/src/Fpx.js
Are you just trying to accept FPX payments using React? Or are you hoping to demo/prototype something else?
I am trying to use FPX payments using react. Right now I am using this as a demo, but I am planning to use Stripe in two other projects. I plan to do so on developer mode to show I can get a working model going.
What payment surface do you want to use? Checkout? Elements? etc.
Following the tutorial, I am thinking more like a checkout form.
That above is what the tutorial looks like
This is what I will modify:
basically, I will create my own checkout form, and place it within that modal to conditionally render a success note, or an error message.
Hello, two-shoes had to step out but I can help. Catching up in this thread
Okay. Thank you! I appreciate you.
I am having trouble finding info on this but I am still looking.
It is really unfortunate that the error message paths keep getting clipped like that. Trying to think of whether there is a way to get the full path which may be helpful in diagnosing this
yes it is. I would give more, but that is the full error I am getting.
๐ this looks like a local config problem
https://stackoverflow.com/questions/76962605/module-not-found-cant-resolve-for-next-js seems somewhat similar
Can you check in .next/server/pages/ to see if you see anything there?
Will do
I see "_app.js","_document.js", "_error.js", and "index.js"
any particular one I should choose?
Yep what is in _document.js?
That is what the SO above mentions
Honestly I'm not very familiar with Next.JS so I don't really know the intricacies here
But hopefully we can piece it together
Me neither @honest garden. This example uses it, so I am trying to follow along, but I am more of a standard react man myself.
Is there any particular reason you want to follow this example?
Like it is from ~4 years ago
You would be much better off following something more recent (like our docs) and building a project in a framework that you are familiar with....
The likely culprit of your errors are either weird Next.JS minutaie which we likely will have a hard time figuring out, or more likely just environmental incompatibilities since this sample is so old
I'd recommend just using https://docs.stripe.com/payments/quickstart
That is a working sample and will be much easier here
I suppose I was following the video because it is the smallest workign example I could think to replicate.
Gotcha, I'd recommend instead using the sample I provided above
It is looking for index.html within the public folder
Did you download the code from the docs page directly?
Or are you dropping into your own project?
I was dropping into a new project.
Then yeah you need to mirror the expected format dependent on your react and server config
Are you using node with Express?
If so, then likely you have app.use(express.static("public"));
Try putting your index.html folder within a public directory
Or change app.use(express.static("public")); to . instead of public
Okay, I downloaded the tutorial and got it to work that way. When thinking about using this logic as a checkout form, how would you go about it?
I'm not sure what you mean by that?
On the left is the website where I am wanting to place a checkout form in the modal.
Practically, I could probably refactor the code to use the same payment fields, and have the "order" button be the "pay now" button.
Yeah I mean with Elements you render them into your own UI and then you customzie from there
And yes, you rig up your own "pay" button to use with that
But is what I am thinking the best way to simulate a payment processing on the front end, and then seeing the the simulated payment info in my stripe account?
Yep
You use our test cards (https://docs.stripe.com/testing) with an integration that uses your test keys
Okay, let me test that real quick. I have one of my test keys handy.
So this is an old account:
Way back in 2022, I was able to follow a tutorial and get what appeared to be payment confirmation working on the back end.
But not on front end and back end at the same time.
The docs and sample I provided above have everything you need for both frontend and back end
Are there errors?
Like you need to do some troubleshooting on your end... I can't walk you through everything here
You need to look both in your web console
And in your server console
Failed to load resource: the server responded with a status of 400 ()
Sorry if my problem is a little difficult. This is why I started with the specific tutorial. I was hoping it would show me how to do the specific request of showing payments processing on the backend, while also taking relevant data from the front end.
Yep so looks related to an issue with the data you are getting back from your server
It isn't that it is difficult, it is that you are the developer here and need to build and debug your own integration
We are happy to help with specific questions you have, but we don't build your integration for you.
I appreciate the respect. I do not want it built for me, but I guess I do want to understand concisely what is missing to make this successful. I know how to get the payment to process on the backend so that it shows in Stripe. I also know how to simulate payment on the front end. But I guess I am lacking an example to show how both work together.
I have done research, and will continue to do so, but might you know of some resources that more adequately suit the solution I have been researching?
What do you mean by that though? When you collect a payment method via Elements you do so on the frontend, and you create a PaymentIntent via the backend to be used with that collected payment method.
What you are doing right now is the most straightforward (custom) integration. So I'm not really sure what you mean by "lacking an example to show both working together"... you just need to fix your code by troubleshooting the errors that are arising while you are testing here.
Actually Bismarck, I think I am beginning to understand. You are brilliant!
Troubleshooting to where my error was two years ago, I think I go the backend info using paymentIntents
The tutorial I brought to start this chat uses it, and the example you provided me uses it.
๐
"When you collect a payment method via Elements you do so on the frontend, and you create a PaymentIntent via the backend to be used with that collected payment method."
The actual integration guide for Payment Element is https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
That talks a bit more about the step-by-step here
Thank you so much Bismarck! reading it now!
Yes, I think this is exactly what I needed today. It goes over exactly what was in that tutorial. I know it was very time-consuming to share that information with me. Is there any way I can repay you with a survey or something to that effect?
Glad that's what you need!