Skip to content

Latest commit

 

History

History
98 lines (61 loc) · 2.69 KB

README.md

File metadata and controls

98 lines (61 loc) · 2.69 KB

Example Web Checkout

Example integration of Universal Checkout using the Primer Web SDK

This is a companion project to the Web Getting Start Guide.


✅ Pre-requisites

  • A Primer sandbox account 🚀

  • A handful of programs installed on your machine
    node, and yarn or npm, that's it! 💪

  • 5 minutes of your time
    Then you can show your colleagues how powerful Universal Checkout is 😎

🚀 Get Started

👨‍💻 Installation

Clone this repository:

git clone https://github.com/primer-io/example-web-checkout.git
cd ./example-web-checkout

Then install the dependencies using yarn or npm:

# With yarn
yarn
# With npm
npm i

🔑 Set up the API Key

Grab your API Key, or create a new one, from the Primer Dashboard.

Dashboard API Key

Copy env.example and name the file .env.

cp env.example .env

Open .env and set the environment variable API_KEY with the API key available on your dashboard.

# .env
API_KEY=1234-1234-1234-1234 # Your Primer API Key

🏃‍♂️ Run the server

# With yarn
yarn start

# With npm
npm start

The server is deployed on port 8880 by default. You can change the port by setting the PORT environment variable in the .env file.

This server uses nodemon under the hood to automatically re-run the server when a change to the source files or .env is made.

💳 Access the checkout

Check the checkout at http://localhost:8880/.

You should see Universal Checkout appear with the payment methods configured on your Dashboard! 🎉

Checkout UI

👀 What's next?