Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fastuptime/cryptomus_nodejs

A powerful Node.js integration for the Cryptomus payment system, enabling seamless cryptocurrency payments in your applications! ๐Ÿš€
https://github.com/fastuptime/cryptomus_nodejs

cryptomus cryptomus-api

Last synced: 22 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# ๐Ÿ’Ž 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

```bash
npm install axios crypto express body-parser multer
```

## โš™๏ธ Configuration

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

```env
MERCHANT_ID=your_merchant_id
PAYMENT_KEY=your_payment_key
```

## ๐Ÿ“˜ Usage

### ๐Ÿ”‘ Initialize Cryptomus

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

### ๐Ÿ’ฐ Create a Payment

```javascript
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

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

### ๐Ÿ“ก Handle Webhooks

```javascript
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

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

## ๐Ÿ“ฆ Webhook Payload Example

```javascript
{
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](https://github.com/fastuptime/Cryptomus_Nodejs/issues) page or create a new issue!

---
Made with โค๏ธ by [FastUptime & SpeedSMM % QuickPos]