Recently I've been learning about a couple of different cryptocurrencies such as Nano and Monero. As a software engineer I wanted to know what it would take to accept payments for these on a website. This post will go through what I looked for in a payment gateway, and how I landed on bitrequest, and a brief overview of how bitrequest works.
When thinking about cryptocurrency payment gateways, there are a couple of attributes that would describe my ideal solution:
- It would be open source
- It would be easy to integrate a basic version (i.e. not requiring self-hosting, but should be possible)
- It should support Nano and Monero, and ideally many top players such as BTC, LTC, DOGE and ETH
- It should be non-custodial, meaning customers are making payments directly into the merchants wallets without any payment processing fees taken out
There is one open source cryptocurrency gateway that has been around for a long time called BTCPay, however it's altcoin support is more limited, and doesn't include Nano as of today. The primary focus of BTCPay is Bitcoin and they rely on maintainers to take up the responsibility of implementing the required logic for each new coin.
The gateway I ended up finding that addressed all these requirements was a much newer one called bitrequest. It supports all of the above requirements, it just has a few small caveats:
- All checking is done client-side, so you need to manually validate transactions (or implement your own server-side checking)
- Multiple simultaneous transactions of the exact same amount of crypto is only possible by creating different addresses with xpub key derivations (supported for some cryptocurrencies but not others). For a small webshop with infrequent or differently priced transactions, a single wallet address will suffice.
The short of it is:
- Load the bitrequest scripts on your webpage
- Add an anchor tag with a specific class and url for the payment request details (amount, destination wallet, name of cryptocurrency requested)
- Bitrequest will intercept the anchor click and load up a payment request
- Receive the payment response info by defining a global function
You can then take the payment information you receive in the
result_callback and send it to your server to finalize the transaction.
There is a lot of customization provided by bitrequest, for example you can:
- Request either a specific crypto amount or a specific fiat amount that will be converted for you
- Specify how many blockchain confirmations you require (0 for instant transactions as soon as they hit the mempool)
- Specify if you want an exact amount (not allowing for multiple partial payments or overpaying). This is useful for use as a payment gateway to increase concurrency by requiring all customers pay in exact amounts to the same wallet.
On top of all this, bitrequest was primarily built with Point of Sale in mind. If you operate an in-person business, you can use the website provided at bitrequest.github.io to process transactions. You can also use the website to request crypto payments from friends by sharing them a link.
When Is Bitrequest Not Suited?
Although bitrequest is quite an awesome piece of software, there are still several use cases that may require merchants to look elsewhere.
1. Enterprise scale
If you are an enterprise that needs reliable software that is already battle-tested in production by many other users, bitrequest likely isn't the best option as of writing.
Also due to the current lack of server-side transaction confirmation, scaling to many transactions while manually verifying hashes could become time consuming.
2. Merchants wanting payment in fiat
There are customers who are willing to accept crypto from customers, but not wear the risk of actually receiving the cryptocurrencies and processing them into fiat themselves. There can also be tax implications in many regions with recieving the crypto directly.
Merchants wanting to receive fiat in exchange for customers crypto are likely better-suited using existing solutions such as coingate and bitpay. It is worth noting that these are not open source and take a cut of all of the transactions.
There are also other benefits that come with accepting crypto payments for a merchant, most importantly transactions cannot be reversed. Say goodbye to being on the hook for customer chargebacks or fraudulent transactions.
If you're in the market for a cryptocurrency payment gateway, consider using bitrequest. I integrated it personally on my Night Sky Crypto project and it's worked great so far.