A powerful Node.js integration for the Cryptomus payment system, enabling seamless cryptocurrency payments in your applications! ๐
- ๐ณ Create cryptocurrency payments with ease
- ๐ Real-time payment status tracking
- ๐ Secure webhook handling with signature verification
- ๐งช Built-in webhook testing functionality
- ๐ Support for multiple cryptocurrencies and networks
npm install axios crypto express body-parser multer
Create a .env
file in your project root and add your Cryptomus credentials:
MERCHANT_ID=your_merchant_id
PAYMENT_KEY=your_payment_key
const Cryptomus = require('./cryptomus');
const cryptomus = new Cryptomus(process.env.MERCHANT_ID, process.env.PAYMENT_KEY);
const payment = await cryptomus.createPayment({
orderId: 'unique_order_id',
amount: '100',
currency: 'USD',
network: 'ETH',
callbackUrl: 'https://your-domain.com/webhook',
returnUrl: 'https://your-domain.com/return'
});
const status = await cryptomus.getPaymentStatus('order_id');
app.post('/webhook', (req, res) => {
const isValid = cryptomus.verifyWebhook(req.body, req.body.sign);
if (isValid) {
// Handle the webhook
console.log('Valid webhook received:', req.body);
res.status(200).send('OK');
}
});
const webhook = await cryptomus.testWebhook({
uuid: 'test-uuid',
currency: 'ETH',
url_callback: 'https://your-domain.com/webhook',
network: 'eth',
status: 'paid'
});
{
type: 'payment',
uuid: 'payment-uuid',
order_id: 'order-id',
amount: '100',
payment_amount: '100',
payment_amount_usd: '100',
merchant_amount: '98',
commission: '2',
is_final: true,
status: 'paid',
network: 'eth',
currency: 'ETH',
payer_currency: 'ETH',
payer_amount: '0.05',
txid: 'transaction-id',
sign: 'webhook-signature'
}
- ๐ก๏ธ Always verify webhook signatures
- ๐ Store credentials in environment variables
- ๐ Use HTTPS for all callback URLs
โ ๏ธ Implement proper error handling and logging- ๐ Regularly monitor transaction status
We love your input! Here's how you can contribute:
- ๐ด Fork the repository
- ๐ฟ Create your feature branch (
git checkout -b feature/amazing-feature
) - โ๏ธ Commit your changes (
git commit -am 'Add some amazing feature'
) - ๐ค Push to the branch (
git push origin feature/amazing-feature
) - ๐ Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Like this project? Give it a โญ๏ธ to show your support!
Having troubles? Check out our issues page or create a new issue!
Made with โค๏ธ by [FastUptime & SpeedSMM % QuickPos]