Skip to content

blockonomics/book-store

 
 

Repository files navigation

Blockonomics Checkout API Bitcoin Payments demo in Next JS

This demo uses the Checkout API provided by Blockonomics to receive Bitcoin payments. It can be easily integrated with your online store. The video tutorial for this demo can be found here.

Installing Guide

Installing dependencies
  npm install

This should install all the dependencies needed.

Setting up Environment Configurations
  • Open the .env file and replace the dummy connection URL with the connection URL of your PostgreSQL database. Follow the steps in this guide to create a local PostgreSQL database. For example, if your database is hosted on Supabase, the URL might look as follows:
DATABASE_URL="postgresql://postgres:[YOUR-PASSWORD]@db.ObubJTKrJYcPSkdsWqms.supabase.co:5432/postgres"
  • Make sure you have your Blockonomics API Key handy. To get one for free, create your account and go to the STORE tab on merchant page. Now place your api key to the BLOCKONOMICS_API_KEY variable in .env file.
  BLOCKONOMICS_API_KEY=[API_KEY]
  • Create your Blockonomics payment button. Get the button code and assign it to the BLOCKONOMICS_PARENT_UID variable in .env file as shown below.
  BLOCKONOMICS_PARENT_UID=[PARENT_UID]
  • Remember to save the changes.
Sync your database schema to Prisma
npx prisma db push

You should see the following output:

  Environment variables loaded from /Users/nikolasburk/Desktop/nextjs-guide/blogr-starter/.env 
Prisma schema loaded from prisma/schema.prisma

🚀  Your database is now in sync with your schema. Done in 2.10s
Start the server
  npm run dev

This will start the application on your localhost.

To test the code locally, follow instructions from this video and make sure to place the <domain>/api/confirmation as your order hook url. Here <domain> is the domain you get from reverse proxy (Ngro k/localtunnel).

About

Demo of Blockonomics Checkouts API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.0%
  • JavaScript 6.7%
  • CSS 0.3%