ForgingBlock is a peer-to-peer cryptocurrency payment system that enables merchants and developers to accept stablecoins using APIs similar to traditional card-payment infrastructure. ForgingBlock offers APIs, libraries, and Ecommerce plugins to assist merchants and developers.
This package is the official Node.js SDK for the ForgingBlock API.
- Node.js >= 18
- A ForgingBlock account
- An API key generated from the dashboard
- Log in to the ForgingBlock dashboard
- Go to Account Settings → Integrations → API Token
- Generate an API key
- Store it securely (environment variable recommended)
npm install forgingblock.jsimport { forgingblock } from 'forgingblock.js'
const fb = forgingblock({
apiKey: process.env.FORGINGBLOCK_API_KEY
})Order support optional merchant-side order identifier using order_id parameter
Creates a new payment order.
const order = await fb.orders.create({
price_amount: '0.01',
price_currency: 'USD',
title: 'Test order',
description: 'Example order'
})
console.log(order.id)
console.log(order.invoice_url) // invoice lifetime 20 minutes
console.log(order.checkout_url) // generates new invoice using same order dataReturns a paginated list of orders (100 per page).
const list = await fb.orders.list({ page: 1 })
console.log(list.current_page)
console.log(list.total_orders)
console.log(list.orders)Retrieves full details for a single order.
const order = await fb.orders.get('<order_id>')
console.log(order.status)
console.log(order.price_amount)
console.log(order.crypto_amount)
console.log(order.customerInfo)