Integrating hosted checkout page to react app

Hi there,

I’m trying to integrate Square hosted checkout page to my react app but I just don’t know where to start. There are a lot of code snippets out there but I just don’t know where to put the code ( clients side or backend or both). I’m using React as frontend and AWS Amplify as backend. Appreciate any help!

Unfortunately, we don’t have a React wrapper for the Checkout API. We do have a supported partner React Web Payments SDK. As for where to put the code all the calls to the Checkout API will need to be server side code. You can configure all client side form fields to collect information to build the payment link and then submit it to your server to make the server side request. :slightly_smiling_face:

Hi Bryan,

Thank you so much for getting back to me! I I went through the React Web Payments SDK docs and managed to do the client side part (the PaymentForm), but I’m unable to call the createPayment method from Lambda function. I get an internet server error.
attached my lambda function code.


What’s the error message your getting? :slightly_smiling_face:

I’m getting “internal server error”!

could you please go through my code maybe I did something wrong.

Hello, just thought i’d chime in here.

That’s what i use, and seems to work quite well

Hi, thanks so much!
That’s exactly what I’m using and it works well on frontend side. My issue is that I don’t know how to call Create Payment API from an AWS lambda function. Any past experience with calling an API from Lambda?

We have a few videos on this but it they’re for payments with our In-App Payments SDK. :slightly_smiling_face:

Bryan, you are giving me short answers. These videos aren’t much related. Please give me full answer if you would to help me. Again, I’m running a Node application with React as frontend and Lambda function as a backend. I need help calling the Create Payment from the lambda function.

Unfortunately we don’t have any Lambda backend examples. We do have a Node example however you may want to reach out to Amazon for more information on making server side request with Lambda. :slightly_smiling_face: