How To Accept Cryptocurrency On Your Website With ForgingBlock Payment Gateway

ForgingBlock Team
Published in
6 min readDec 13, 2021

This is a tutorial on how to accept cryptocurrency payments for your website, SaaS, or product using ForgingBlock Payment Gateway.

The ForgingBlock Payment Gateway works a lot like PayPal Checkout, in that a user can purchase a product from your site using a 3rd party service without ever having to leave it.

ForgingBlock Checkout Page

Setting Up Your ForgingBlock Payment Gateway Account

  1. Go to and create a new account.
  2. Verify your email address and log in with email and password you provided.
  3. Go through the setup/welcome process where you need to fill in your contacts and Bitcoin wallet address.

4. At the end of the process you will see your newly created dashboard.

Balances show how much money you have made. Payments show the actual transactions that have occurred.

5. For the merchants who are interested in create one time invoice for their services or single product: (if you would like to integrate the gateway to e-commerce software or any 3rd party application, please jump to “Using with e-commerce software” section )

Click on the Accept Payments button to create a new product that you want to sell. You can Sell a Product or Accept Donations.

6. Select Sell a Product and then enter a Product Name, Description, Price, Currency, and upload an image for your new product

Note: On the first run, you also can select modern or classic payment form, and later you can change that at Account Settings

7. You can now choose to use either a URL or embed the link with a payment button.

Using with e-commerce software

For popular e-commerce software, we have a set of plugins that you could find here.

Click on the Check out the Docs button for the e-commerce software of your choice and follow the installation instructions.

For all e-commerce platforms, except for Shopify, you would need to know your trade and token for authentication. And you can find those in Account SettingsAccess Tokens.

Shopify, on the other end, is a centralized platform, and to setup Shopify you need to follow instructions for the Shopify specific setup, and whitelist every domain and subdomain for your store that you are using through the checkout process.

A common error is that users don’t add www subdomain, or have a checkout process on a different subdomain/domain. To test it, you just need to check your URL on your checkout process. To do that, just add an item to your cart, and go through the process on your store until you see the Pay with ForgingBlock button. Don’t click it, but just validate your address/url bar, and make sure that the domain and subdomain you whitelisted are included. You could use the same code on different websites/Shopify stores. Just make sure that every subdomain and domain is whitelisted.

Integrate ForgingBlock Payment Gateway to your own applications and backend

If you have an app that needs to accept payments in cryptocurrencies, you will need IPN (Instant Payment Notification) to communicate with the ForgingBlock servers.

This section assumes that:

  1. You have a website or system where a user can select a product and purchase it
  2. You have an API running that can persist to a database
ForgingBlock API 3rd integration work flow

Here is the flow to work with ForgingBlock Crypto Payment Gateway:

  1. A user chooses some products on the website
  2. Merchant application calculates the total amount of money in usd
  3. Merchant application backend created a payment link (through /create-invoice)
POST /create-invoice#Parameters: 
#Trade: the authentication code that you can obtaine from ForgingBlock dashboard setting page
#Token : the authentication code that you can obtain from ForgingBlock dashboard setting page#Amount: fiat currency amount, 1 means 1 dollar if you select currency as usd.#Currency: flat currency, such as usd#order: is the order ID that is generated by the merchant's server for their internal uses. This ID is controlled by the merchant’s application.#notification: is a URL where you would receive JSON data after the payment had been made or the invoice had expired. Here you will send the url parameter that you have created on your server to ForgingBlock api. (please look at the samples)#link: to follow after the payment# Noted that Merchant need provide notification, order, and link parameters to the /create-invoice in order to enable the IPN

What’s an IPN (Instant Payment Notification) Message?

As a developer, I want to get notified on events when a payment is completed or rejected, in order to change my users’ plan, status, account balance, and even create invoices. That’s where IPN (Instant Payment Notification) comes in handy. IPN helps in receiving the success/error messages from the ForgingBlock server to your server. We have a few examples here on how to use the IPN for ForgingBlock:


curl ‘' -H ‘Content-Type: application/x-www-form-urlencoded’ — data ‘trade=yourtrade&token=yourtoken&amount=0.1&currency=usd&order=234&notification='# order 234 is a random ID that generated from merchant application # for the tracking purpose 
# notification in this case is
# which is the url merchant application created for receiving IPN # from forgingblock server

Response from /create-invoice end point ::

{“id”:”U8B7S21kdo8mB7TDtqDUDG”,”amount”:0.1,”currency”:”USD”,”realAmount”:”0.40162157",”creation”:1552319384000,”expiration”:1552320284000,”payUrl”:”bitcoin:tb1qufxkm89aybhp600aycm54s5ycdj2pqz9hzxj4l?amount=0.40162157",”status”:”new”,”url”:”"}# Note that “https://api.forgingblock.i/invoice?id=7hqLE4VN5eS5DyhZLzCVby “ is the payment url that needs to pass the buyer to proceed with the checkout.#Once the transaction is completed, ForgingBlock will pass the payment information in json format to the url that /create-invoice parameter, in this case that would be

4. The response from the /create-invoice includes a payment link for the buyer to check out.

5. The buyer is able to checkout through the ForgingBlock checkout page.

6. When the transaction is completed, merchant’s application receives json data on the url that the merchant provided to the /create-invoice route. The json data includes payment status and paid amount from the buyer.

In this tutorial, here is response from IPN message from

{“id”:”7hqLE4VN5eS5DyhZLzCVby”,”btcPrice”:”0.40162157" “btcPaid”:”0.40162157", “btcDue”:”0",”status”: “paid”,”url”:”"}const { id, btcPrice, btcPaid, btcDue, status, url } = response

7. Merchant can store the json data to its internal database.

Now you have all the data related to the invoice that you generated. You can save it in your DB according to your DB structure.


The purpose of this article was to point you in the right direction in setting up cryptocurrency payments on your website with ForgingBlock Payment Gateway.

Relevant Documentation

About ForgingBlock

ForgingBlock is a peer-to-peer cryptocurrency payment system that allows developers to provide infrastructure similar to that offered by the credit card payment industry

ForgingBlock offers API, libraries and Ecommerce plugins to help merchants/developers who are familiar with the credit payment process to adopt cryptocurrency as a payment method with minimal learning curve

Website | Twitter | Medium