PayNode starter kit for Node.js - setup guide

Deposits and automatic withdrawals for websites built with Node.js: Express, Next.js, or plain Node. About 15-30 minutes. Needs Node 18 or newer, no extra packages.

What is in the folder
FileWhat it doesEdit it?
paynode-settings.jsYour keys, and three small connections to your siteYes - the only one
paynode-core.jsThe deposit page, the automatic withdraw page and the webhookNo
paynode-express.jsConnects the kit to an Express site (one line)No
nextjs/app/paynode/Connects the kit to a Next.js site (copy the folder)No
run-alone.jsRuns the kit on its own (plain Node, or to try it out)No
paynode-demo.jsTest balances for demo modeNo

Step 1 - Put the folder in your project

  1. Unzip paynode-kit-node.zip. You get a folder called paynode.
  2. Copy the whole paynode folder into your project's main folder (next to package.json).
  3. Connect it - pick the one that matches your site:
Your site is built withDo this
ExpressIn your main server file (e.g. app.js or server.js), add this line near the top, before app.use(express.json()) if you have it:
require("./paynode/paynode-express")(app);
Next.js (App Router)Copy the folder paynode/nextjs/app/paynode into your project's app folder, so you get app/paynode/deposit/route.js and the others.
If your project uses src/app, copy it there instead and change "../../../paynode/paynode-core" to "../../../../paynode/paynode-core" in the three route.js files.
Rebuild and restart your site.
Plain Node, or another frameworkRun node paynode/run-alone.js (port 3001) and send yourwebsite.com/paynode/... to it from your web server - or call require("./paynode/paynode-core").handle(...) from your own routes.

Check it works: open https://yourwebsite.com/paynode/deposit. You should see a Deposit page.

Hosting that can't save files (Vercel, Netlify and other "serverless" hosts): the kit keeps small records in a paynode-data folder. Those hosts wipe files, so use a normal server (a VPS, or a cPanel Node.js app) - or set PAYNODE_DATA_DIR to a folder that is kept.

Step 2 - Get your values from PayNode

Log in to your PayNode dashboard:

  1. Website integration → add your website's domain, e.g. yourwebsite.com.
  2. Website integration → set the webhook URL to https://yourwebsite.com/paynode/webhook and press Save.
  3. Website integration → press Create or replace secret, then click the box to copy it. Keep it ready - it is shown only once.
  4. Website integration → press Create API key and copy it.
  5. Only if you want automatic withdrawals: Settings → Create payout key and copy it.

Step 3 - Paste them into paynode-settings.js

  1. Open paynode/paynode-settings.js.
  2. Near the top you will see:
    const PAYNODE_API_KEY        = process.env.PAYNODE_API_KEY        || "PASTE_YOUR_API_KEY_HERE";
    const PAYNODE_WEBHOOK_SECRET = process.env.PAYNODE_WEBHOOK_SECRET || "PASTE_YOUR_WEBHOOK_SECRET_HERE";
    const PAYNODE_PAYOUT_KEY     = process.env.PAYNODE_PAYOUT_KEY     || "";
  3. Either replace the text between the quote marks with your values, or (better) leave the file as it is and add them to your .env file:
    PAYNODE_API_KEY=sk_live_AbC123...
    PAYNODE_WEBHOOK_SECRET=whsec_XyZ789...
    PAYNODE_PAYOUT_KEY=sk_payout_QrS456...
    PAYNODE_KIT_URL=https://yourwebsite.com/paynode
    No withdrawals? Leave the payout key empty.
  4. Set PAYNODE_KIT_URL to the address of the kit's pages, e.g. https://yourwebsite.com/paynode (no slash at the end).
  5. Save, and restart your site.
Keep these values private. Never put them in a web page, browser code, an app, a chat or a public code repository. If your project is on GitHub, use the .env way and make sure .env is not uploaded.

Step 4 - Test in demo mode

Until you do Step 5 the kit uses one test user with its own balance, so you can try it safely.

  1. Open /paynode/deposit, deposit 1 USDT and pay it. Within a minute or two the page shows Added and the balance goes up.
  2. For withdrawals: in your PayNode dashboard press Deposit funds and send a little USDT plus about $1 of BNB (for network fees) to the address shown. Then open /paynode/withdraw, withdraw 1 USDT to your own wallet and watch it change to Sent.

Step 5 - Connect it to your users and balances

In paynode-settings.js, Part 2, there are three marked spots (CONNECT THIS 1, 2, 3). Each has examples for common setups. A developer usually needs about 10 minutes.

Smallest deposit and withdrawal
Set these in your PayNode dashboard under Settings → Smallest amounts. The kit picks up changes by itself within 5 minutes - no file to edit.
SpotWhat it must do
1 - who is logged inReturn the logged-in user's id, e.g. req.session.userId
2 - add to balanceAdd the amount to that user's balance in your database
3 - take from balanceTake the amount off if they have enough, in one database statement, and say whether it worked

Then link your site's Deposit button to /paynode/deposit and your Withdraw button to /paynode/withdraw.

If something does not work

You seeDo this
"Not found" on /paynode/depositStep 1 isn't connected yet: check the Express line or the Next.js folder, then restart (Next.js: rebuild).
"Could not start the payment"Check the API key in Step 3, and that your domain is added in Website integration.
Deposit stays "Waiting for payment" after payingCheck the webhook URL (Step 2) and the webhook secret (Step 3). Your PayNode dashboard shows each webhook delivery and the reply from your site. Express: the PayNode line must come before express.json().
"The withdrawal could not be sent right now"Your PayNode wallet needs more USDT, or a little BNB for network fees. The user's balance has been given back.
"Withdrawals are not switched on yet"Add a payout key in Step 3.

Questions: Telegram @paynodespace · Full API docs: https://paynode.space/docs