This is the payment processing backend for StakeReloadXS website. It handles cryptocurrency payments via NOWPayments and sends notifications to Telegram when payments are received.
- Express.js backend server
- NOWPayments integration for cryptocurrency payments
- Telegram notifications for successful payments
- IPN (Instant Payment Notification) callback handling
- Node.js (v14 or higher)
- NPM (v6 or higher)
- NOWPayments account and API key
- Telegram bot token and chat ID
-
Install dependencies:
npm install -
Configure environment variables:
- Copy
.env.exampleto.env - Fill in the required values:
PORT: Server port (default: 3000)NOWPAYMENTS_API_KEY: Your NOWPayments API keyNOWPAYMENTS_IPN_SECRET: Your NOWPayments IPN secretTELEGRAM_BOT_TOKEN: Your Telegram bot tokenTELEGRAM_CHAT_ID: Your Telegram chat ID for notifications
- Copy
- Create an account at NOWPayments
- Generate an API key in your account dashboard
- Set up IPN (Instant Payment Notification) in your NOWPayments dashboard:
- IPN callback URL:
https://your-domain.com/api/payments/ipn-callback - Generate an IPN secret key
- IPN callback URL:
- Create a new Telegram bot using BotFather
- Get the bot token from BotFather
- Create a group and add your bot to it
- Get the chat ID (you can use the
@get_id_botor send a message to the group and check the chat ID via the Telegram API)
npm run dev
npm start
- URL:
/api/payments/create - Method:
POST - Body:
{ "packageId": "xs-credits-50k", "telegramUsername": "@username" } - Response:
{ "success": true, "data": { "invoice_url": "https://nowpayments.io/invoice/...", "invoice_id": "...", "order_id": "..." } }
- URL:
/api/payments/ipn-callback - Method:
POST - Headers:
x-nowpayments-sig: HMAC signature for verification
- Body: NOWPayments payment data
new-xsid: New XSID setup ($5.00)xs-credits-50k: 50,000 XS Credits ($50.00)xs-credits-100k: 100,000 XS Credits ($100.00)xs-credits-200k: 200,000 XS Credits ($200.00)xs-credits-1m: 1,000,000 XS Credits ($1,000.00)