Coin Tunnel
Putting it all together
Here you can see that everything happens in 51 lines of code! To get started, just change the variables callback apikey verifac port hostname to the correct values! You also need to get the buyer's id, which you put in the buyerId variable.
const fetch = require('node-fetch');
const express = require('express');
const app = express();
var bodyParser = require('body-parser');
const callback = "";
const apikey = "your api key here";
const verifac = "Set your verifac in dashboard";
let port = 3000;
const hostname = "localhost"
app.use(bodyParser.urlencoded({ extended: false }));
app.set('port', port);"/create-transaction", async (req, res) => {
let data = {
buyerId:"Get this value from buyer",
callback: callback,
usd: 20,
expiry: 180000,
note: {
let headers = {
'Content-Type': 'application/json',
'Authorization': apikey
fetch('', {
method: 'POST',
body: JSON.stringify(data),
headers: headers
}).then(res => res.json())
.then(json => {
if (json.status === "failed"){
// handle this
res.send("Success! Check your emails")
})"/callback", async (req, res) => {
if (req.headers.verifac !== verifac) return res.status(401);
// now you are certain that the server is who it says it is (Coin Tunnel)
if (req.body.status !== "ok") console.log(req.body) // If something went wrong
let note = req.body.note;
// You can then give the user something based on the note that you set earlier!
return res.send("Wow thanks!")
app.listen(port, hostname, () =>`Listening at ${hostname}:${port}`));
Copy link