Skip to content

alexiscirmi/nextjs-square-payments

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

Getting Started

  1. Install the dependencies:
npm install
  1. Go to your Square Developer Dashboard, create an app and get the credentials.

  2. Create a file named .env.local in your project's root folder, copy this code and replace the data with your credentials:

SQUARE_ACCESS_TOKEN='YOUR_ACCESS_TOKEN'
NEXT_PUBLIC_SQUARE_APP_ID='YOUR_APP_ID'
NEXT_PUBLIC_SQUARE_LOCATION_ID='YOUR_LOCATION_ID'
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000 with your browser to see the result.

  2. Use any of the Sandbox credit card numbers to test the payment flow.

Learn More

To learn more about Next.js, take a look at the following resources:

To learn more about Square on Next.js, take a look at: https://developer.squareup.com/blog/accept-payments-with-square-using-next-js-app-router/