Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.23 KB

File metadata and controls

36 lines (23 loc) · 1.23 KB

Getting Started Guide: PayPal Buy Button with NextJS

With PayPal's Buy Button accept payments without building your own payment workflow.

Open the code in the web IDE now using GitHub Codespaces... Open in GitHub Codespaces

Preview

PayPal Buy Button example

Prerequisites

  • PayPal Business Account (free)
  • NodeJS, NPM

Setup

You can use GitHub Codespace 1 click deploy, but if you prefer to run this locally follow these steps:

  1. Clone this repo with git clone git@github.com:paypaldev/getting-started-guide-buy-button-nextjs.git
  2. Navigate into the new project cd getting-started-guide-buy-button-nextjs
  3. Install dependencies npm install
  4. Add your PayPal client id and client secret to your projects environment variables in .env.local

Copy example file .env.example to .env.local with the command cp .env.example .env.local

# .env.local

NEXT_PUBLIC_PAYPAL_ENVIRONMENT=sandbox
NEXT_PUBLIC_PAYPAL_CLIENT_ID=your_sandbox_client_id_here
PAYPAL_CLIENT_SECRET=your_sandbox_secret_here
  1. Run the project npm run dev
  2. Visit http://localhost:3000