Skip to content

A powerful Node.js integration for the Cryptomus payment system, enabling seamless cryptocurrency payments in your applications! πŸš€

Notifications You must be signed in to change notification settings

fastuptime/Cryptomus_Nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Ž Cryptomus NodeJS Integration

A powerful Node.js integration for the Cryptomus payment system, enabling seamless cryptocurrency payments in your applications! πŸš€

✨ Features

  • πŸ’³ 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

πŸš€ Installation

npm install axios crypto express body-parser multer

βš™οΈ Configuration

Create a .env file in your project root and add your Cryptomus credentials:

MERCHANT_ID=your_merchant_id
PAYMENT_KEY=your_payment_key

πŸ“˜ Usage

πŸ”‘ Initialize Cryptomus

const Cryptomus = require('./cryptomus');
const cryptomus = new Cryptomus(process.env.MERCHANT_ID, process.env.PAYMENT_KEY);

πŸ’° Create a Payment

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'
});

πŸ” Check Payment Status

const status = await cryptomus.getPaymentStatus('order_id');

πŸ“‘ Handle Webhooks

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');
    }
});

πŸ§ͺ Test Webhook

const webhook = await cryptomus.testWebhook({
    uuid: 'test-uuid',
    currency: 'ETH',
    url_callback: 'https://your-domain.com/webhook',
    network: 'eth',
    status: 'paid'
});

πŸ“¦ Webhook Payload Example

{
    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'
}

πŸ”’ Security Best Practices

  • πŸ›‘οΈ 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

🀝 Contributing

We love your input! Here's how you can contribute:

  1. 🍴 Fork the repository
  2. 🌿 Create your feature branch (git checkout -b feature/amazing-feature)
  3. ✍️ Commit your changes (git commit -am 'Add some amazing feature')
  4. πŸ“€ Push to the branch (git push origin feature/amazing-feature)
  5. πŸŽ‰ Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Support

Like this project? Give it a ⭐️ to show your support!

πŸ€” Questions?

Having troubles? Check out our issues page or create a new issue!


Made with ❀️ by [FastUptime & SpeedSMM % QuickPos]

About

A powerful Node.js integration for the Cryptomus payment system, enabling seamless cryptocurrency payments in your applications! πŸš€

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published