Web Payments quickstart not working


I am unable to get a sandbox payment to work using the quickstart app. All I need to do is add the Payments API to my website, but the instructions for doing that are virtually non-existent. Or else I just don’t know where to look.

I did configure the API using the Create Payment application but I get errors. Is there a good tutorial out there somewhere that can walk me step by step on how to implement the API on my website?

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Make your First API Call
Payment API: Process Online and In-Person Payments
In-App Payment Solutions

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

To integrate Square Payments API into your website, you can use the Web Payments SDK. This SDK provides a customizable UI for a secure, PCI-compliant way of accepting supported payment methods on your website.

Here are the general steps you need to follow:

  1. Add the Web Payments SDK to your website. This SDK will allow you to accept payment methods and generate a secure payment token.

  2. On your server-side, you will use the Payments API to process the payment. You will send a CreatePayment request to the Payments API, providing the payment token generated by the Web Payments SDK.

  3. Square will process the payment and return a Payment object in the response. This object will contain information about the transaction.

For a more detailed guide, you can refer to the Web Payments SDK Overview and the guide on how to Take Payments. These guides provide step-by-step instructions on how to integrate the Web Payments SDK and Payments API into your website.

If you’re testing in the Square Sandbox, remember to use the Sandbox credentials (access token and application ID) and the Sandbox environment URL (https://connect.squareupsandbox.com).

If you’re still encountering errors, it would be helpful to know the specific error messages you’re receiving to provide more targeted assistance.

This answer was reviewed by @Bryan-Square.

Also our Quickstart walkthrough has a full working example. :slightly_smiling_face:

OK, so I already have the quickstart example project. That’s what I mentioned in my original post. I use xampp as my local test server on my home computer. The quickstart project mentions installing Node.js. I really don’t have to do that, do I?

I’m goinf to try implementing the SDK without using the quickstart stuff.

Yes, for that Quickstart it relies on Node.js. That’s why in the README.md section one of the first things it has you do is to run npm install in the directory. :slightly_smiling_face:

I think I have it solved. I am using PHP so I downloaded and installed the PHP SDK. I was able to get a successfule sandbox payment

Glad to hear that you got it to work. :slightly_smiling_face: