1.0.2 • Published 5 months ago

opengig-razorpay v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

opengig-razorpay

A TypeScript wrapper for Razorpay payment integration that provides a clean and type-safe interface for handling payments, subscriptions, and refunds.

Installation

npm install opengig-razorpay
# or
yarn add opengig-razorpay

Usage

import { RazorpayCheckout } from 'opengig-razorpay';

const razorpay = new Razorpay({
    key_id: 'your_key_id',
    key_secret: 'your_key_secret'
  });

// Initialize the checkout
const razorpayCheckout = new RazorpayCheckout(
  razorpay
);

// Create an order
const order = await checkout.createOrder({
  amount: 1000, // amount in INR
  currency: 'INR',
  receipt: 'order_receipt_1',
  notes: {
    customerName: 'John Doe'
  }
});

// Verify payment
const isValid = checkout.verifyPayment({
  orderId: 'order_id',
  paymentId: 'payment_id',
  signature: 'signature'
});

// Create subscription
const subscription = await checkout.createSubscription({
  planId: 'plan_id',
  customerId: 'customer_id',
  totalCount: 12,
  notes: {
    planType: 'premium'
  }
});

// Refund payment
const refund = await checkout.refundPayment({
  paymentId: 'payment_id',
  amount: 1000,
  notes: {
    reason: 'customer request'
  }
});

Features

  • Type-safe interfaces for all Razorpay operations
  • Easy initialization and configuration
  • Support for:
    • Order creation
    • Payment verification
    • Subscription management
    • Payment refunds
    • Order and payment fetching

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago