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.
| File | What it does | Edit it? |
|---|---|---|
paynode-settings.js | Your keys, and three small connections to your site | Yes - the only one |
paynode-core.js | The deposit page, the automatic withdraw page and the webhook | No |
paynode-express.js | Connects 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.js | Runs the kit on its own (plain Node, or to try it out) | No |
paynode-demo.js | Test balances for demo mode | No |
paynode-kit-node.zip. You get a folder called paynode.paynode folder into your project's main folder (next to package.json).| Your site is built with | Do this |
|---|---|
| Express | In 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 framework | Run 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.
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.Log in to your PayNode dashboard:
yourwebsite.com.https://yourwebsite.com/paynode/webhook and press Save.paynode/paynode-settings.js.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 || "";
.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/paynodeNo withdrawals? Leave the payout key empty.
PAYNODE_KIT_URL to the address of the kit's pages, e.g. https://yourwebsite.com/paynode (no slash at the end)..env way and make sure .env is not uploaded.Until you do Step 5 the kit uses one test user with its own balance, so you can try it safely.
/paynode/deposit, deposit 1 USDT and pay it. Within a minute or two the page shows Added and the balance goes up./paynode/withdraw, withdraw 1 USDT to your own wallet and watch it change to Sent.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.
| Spot | What it must do |
|---|---|
| 1 - who is logged in | Return the logged-in user's id, e.g. req.session.userId |
| 2 - add to balance | Add the amount to that user's balance in your database |
| 3 - take from balance | Take 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.
| You see | Do this |
|---|---|
| "Not found" on /paynode/deposit | Step 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 paying | Check 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