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]