Skip to content

Latest commit

 

History

History
66 lines (38 loc) · 2.19 KB

README.md

File metadata and controls

66 lines (38 loc) · 2.19 KB

Primer Banner

💳 Primer Example Backend

This project is a very simple companion backend to the example apps of Primer Universal Checkout:


This server uses Node as the runtime and Fastify as the HTTP server framework.

This project uses Node v16 to be compatible with Glitch but we encourage you to use a more recent version of Node.

🚀 Get started

Pre-requisites

  • A Primer sandbox account 👤

  • An API key for your Sandbox 🔑
    You can grab your API key or create a new one from the Primer Dashboard.

Deploy on Glitch ⚡️

We recommend using Glitch to quickly spin up a new instance of your server for free.

  1. First, click on this button to open the project in Glitch and start the server.
    It may take a moment to start.

    Remix With Glitch

  2. On Glitch, open the file .env.
    Set the environment variable PRIMER_API_KEY to your Primer sandbox API key.

  3. On Glitch, grab the URL of your Glitch instance.
    It should look like https://xxx-yyy-zzz.glitch.me.

  4. Paste your Glitch instance URL in the example project.

Run it locally

  1. First, make sure Node is installed on your machine.

  2. Clone this repository:

    git clone https://github.com/primer-io/example-backend.git
    
    cd ./example-backend
  3. Install the dependencies:

    npm install
  4. Clone the file .env.example and call it .env. Set the environment variable PRIMER_API_KEY to your Primer sandbox API key.

  5. Execute the following script on a terminal window:

    npm start

🤖 Capabilities

  • GET /
    Health check

  • POST /client-session
    Create a client session