PAYchat SDKOfficial Node.js SDK for PAYchat Partner API - Accept USDT payments via Telegram.
Features
💳 Payment Links - Generate USDT payment links
⚡ QR Payments - Instant QR code payments
🔒 Escrow - Secure buyer-seller transactions
💸 Withdrawals - Send USDT to any Telegram user
📊 Analytics - Track transactions and revenue
🔔 Webhooks - Real-time payment notifications
🔐 Secure - HMAC-SHA256 webhook verification
📝 TypeScript - Full type definitions included
Installation Quick Startimport PAYchatClient from 'paychat-sdk' ;
const client = new PAYchatClient ( 'pk_your_api_key' ) ;
const payment = await client. createPayment ( {
amount : 10 ,
description : 'Premium Subscription'
} ) ;
console. log ( payment. payment. payment_url) ;
Payment Types 1. Simple Payment LinksBest for: Online stores, subscriptions, invoices
const payment = await client. createPayment ( {
amount : 25.50 ,
description : 'Product Purchase' ,
metadata : { orderId : '12345' }
} ) ;
const paymentUrl = payment. payment. payment_url; 2. QR Payments (Instant)Best for: POS systems, in-person payments
const qr = await client. createQRPayment ( {
amount : 15.00 ,
description : 'Coffee Shop Order' ,
expiresIn : 300
} ) ;
console. log ( qr. qr_payment. qr_url) ;
const status = await client. getQRPayment ( qr. qr_payment. id) ;
if ( status. qr_payment. status === 'paid' ) {
console. log ( 'Payment received!' ) ;
} 3. Escrow PaymentsBest for: Marketplaces, freelance platforms, P2P trades
const escrow = await client. createEscrow ( {
amount : 100.00 ,
buyerTelegramId : '123456789' ,
sellerTelegramId : '987654321' ,
description : 'Freelance Project'
} ) ;
console. log ( escrow. escrow. payment_url) ;
await client. releaseEscrow ( escrow. escrow. id) ;
await client. cancelEscrow ( escrow. escrow. id, 'Buyer requested refund' ) ; Send USDT to Usersconst withdrawal = await client. createWithdrawal ( {
telegramId : '123456789' ,
amount : 5.00 ,
memo : 'Cashback reward'
} ) ;
console. log ( ` Sent ${ withdrawal. withdrawal. amount} USDT ` ) ; Check Balanceconst balance = await client. getBalance ( ) ;
console. log ( ` Available: ${ balance. balance. available} USDT ` ) ; PricingFor pricing details, visit our website .
Webhook VerificationVerify incoming webhooks to ensure they're from PAYchat:
import express from 'express' ;
import { PAYchatClient } from 'paychat-sdk' ;
const app = express ( ) ;
app. use ( express. json ( ) ) ;
app. post ( '/webhook' , ( req, res ) => {
const signature = req. headers[ 'x-paychat-signature' ] ;
const payload = req. body;
const isValid = PAYchatClient. verifyWebhook (
payload,
signature,
'sk_your_secret_key'
) ;
if ( ! isValid) {
return res. status ( 401 ) . json ( { error : 'Invalid signature' } ) ;
}
switch ( payload. event) {
case 'payment.completed' :
console. log ( 'Payment received:' , payload. data) ;
break ;
case 'escrow.paid' :
console. log ( 'Escrow funded:' , payload. data) ;
break ;
case 'escrow.released' :
console. log ( 'Escrow released:' , payload. data) ;
break ;
case 'qr.paid' :
console. log ( 'QR payment received:' , payload. data) ;
break ;
}
res. json ( { received : true } ) ;
} ) ; Webhook Events
Event
Description
payment.completed
Payment link has been paid
withdraw.completed
Withdrawal has been processed
escrow.created
New escrow created
escrow.paid
Buyer funded the escrow
escrow.released
Funds released to seller
escrow.cancelled
Escrow cancelled, buyer refunded
qr.created
QR payment created
qr.paid
QR payment completed
qr.expired
QR payment expired
test
Test webhook
API Reference Constructornew PAYchatClient ( apiKey, options? )
Option
Type
Default
Description
baseUrl
string
https://paychat.me
API base URL
timeout
number
10000
Request timeout (ms)
Methods Payments
Method
Description
createPayment(params)
Create a payment link
getPayment(id)
Get payment status
QR Payments
Method
Description
createQRPayment(params)
Create a QR payment
getQRPayment(id)
Get QR payment status
listQRPayments(params?)
List QR payments
cancelQRPayment(id)
Cancel a QR payment
Escrows
Method
Description
createEscrow(params)
Create an escrow
getEscrow(id)
Get escrow status
listEscrows(params?)
List escrows
releaseEscrow(id)
Release funds to seller
cancelEscrow(id, reason?)
Cancel and refund buyer
Withdrawals & Deposits
Method
Description
createWithdrawal(params)
Send USDT to a user
createDeposit(params)
Create deposit request
getDeposit(id)
Get deposit status
listDeposits(params?)
List deposits
cancelDeposit(id)
Cancel pending deposit
Balance & Transactions
Method
Description
getBalance()
Get partner balance
getDepositAddress()
Get deposit address
getTransactions(params?)
Get transaction history
Dashboard & Stats
Method
Description
getDashboard()
Get dashboard summary
getStats(period?)
Get detailed statistics
getPlans()
Get available plans
Webhooks
Method
Description
updateWebhook(url)
Set webhook URL
testWebhook()
Send test webhook
regenerateKeys()
Regenerate API keys
Static Methods
Method
Description
PAYchatClient.verifyWebhook(payload, signature, secretKey)
Verify webhook (Node.js)
PAYchatClient.verifyWebhookAsync(payload, signature, secretKey)
Verify webhook (Browser)
Error Handlingtry {
const payment = await client. createPayment ( { amount : 10 } ) ;
} catch ( error) {
console. error ( 'Error:' , error. message) ;
console. error ( 'Code:' , error. code) ;
console. error ( 'Status:' , error. status) ;
} Error Codes
Code
Description
INVALID_API_KEY
Invalid or missing API key
INVALID_AMOUNT
Invalid payment amount
INSUFFICIENT_BALANCE
Not enough balance
PAYMENT_NOT_FOUND
Payment not found
ESCROW_NOT_FOUND
Escrow not found
QR_NOT_FOUND
QR payment not found
ESCROW_ALREADY_PAID
Escrow already paid
ESCROW_ALREADY_COMPLETED
Escrow already completed
ESCROW_ALREADY_CANCELLED
Escrow already cancelled
CANNOT_WITHDRAW_TO_SELF
Cannot withdraw to yourself
RATE_LIMIT_EXCEEDED
Too many requests
TIMEOUT
Request timeout
Rate Limits
Plan
Limit
Founding Member
500 requests/min
Support
LicenseMIT © PAYchat