1.0.0 • Published 7 months ago

cxpay-me-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

CXPay.me JavaScript/TypeScript SDK

A lightweight JavaScript/TypeScript SDK for integrating CXPay.me payment QR codes into your web applications.

Installation

npm install cxpay-me-sdk

Quick Start

import CXPay from "cxpay-me-sdk";

// Initialize the library
CXPay.init({
    apiBaseUrl: "https://api.cxpay.me"  // Replace with your backend URL
});

// Generate a QR code
CXPay.generateQRCode({
    merchant_id: "YOUR_MERCHANT_ID",
    order_id: "ORDER_123",
    amount: 100,
    currency: "USD",
    container: "#qrCodeContainer",
    size: 300,  // Optional: QR code size in pixels (default: 300)
    onSuccess: (qrUrl) => console.log("QR Code URL:", qrUrl),
    onError: (error) => console.error("Error:", error)
});

Features

  • 🚀 Lightweight and easy to integrate
  • 📱 Responsive QR code generation
  • 🔒 Secure hash verification
  • 💻 TypeScript support
  • 🛠️ Customizable QR code size
  • 🔄 Success and error callbacks

Development Mode

When running on localhost, the SDK automatically enters development mode, using mock data instead of making actual API calls. This makes it easy to test your integration without needing a backend server.

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

License

MIT

1.0.0

7 months ago