Promise based Instamojo NodeJs integrator
Promise based Instamojo payment gateway integrator for NodeJS based projects
- No callback hell ✅
- Clean, readable code with async-await 💖
If you face any problems using this package, please create an issue on this repo OR even better, create a PR! 🙂
Installation
npm i instamojo-payment-nodejs // OR yarn add instamojo-payment-nodejs
APIs Available
- Setup keys
- Create a new payment request
- Get single payment request details
- Get single payment details
- Get all payment requests
- Initiate refund
- Get all refund requests
- Get single refund details with
refundId
Setup keys
const Instamojo = ; Instamojo; // For testing Instamojo;
Create new payment request
const options = purpose: "Product name" // REQUIRED amount: 20 // REQUIRED and must be > ₹3 (3 INR) currency: "INR" buyer_name: "" email: "" phone: null send_email: false send_sms: false allow_repeated_payments: false webhook: "" redirect_url: ""; const paymentData = Instamojo; const response = await Instamojo;
Response from createNewPaymentRequest
Get single payment request details
const PAYMENT_REQUEST_ID = "0cb066f9d3764c2fab6da469d8f613ss";const status = await Instamojo;
Status from getPaymentRequestStatus
Get single payment details
const PAYMENT_REQUEST_ID = "0cb066f9d3764c2fab6da469d8f613ss";const PAYMENT_ID = "MOJO0816705N15845280";const paymentDetails = await Instamojo;
paymentDetails from getOnePayedPaymentDetails
Get all payment requests
const response = await Instamojo;
Response from getAllPaymentRequests
Initiate refund
const refundInstance = payment_id: "MOJO0816705N15845280" type: "RFD" // Refer below section body: "Reason for refund"; refundInstance; const refundResponse = await Instamojo;
Valid values for type parameter:
RFD
: Duplicate/delayed payment.TNR
: Product/service no longer available.QFL
: Customer not satisfied.QNR
: Product lost/damaged.EWN
: Digital download issue.TAN
: Event was canceled/changed.PTH
: Problem not described above.
For more, refer: https://docs.instamojo.com/docs/creating-a-refund,
Response from initiateRefund
Get all refund requests
const response = await Instamojo;
Response from getAllRefunds
Get single refund details with refundId
const response = await Instamojo;
Response from getRefundDetails
Road map:
-
Create package with:
- ✅ Implement Sandbox mode for developers
- ✅ Create a payment request
- ✅ Write an easy-to-follow docs for package consumers
- ✅ Get Single payment request details
- ✅ Get Single payment details
- ✅ Get all payment requests
- ✅ Get all payments
-
Refund
- ✅ Initiate refund
- ✅ Get all refund requests
- ✅ Get single refund details with refundId
-
✅ Reach code test coverage threshold 60%
-
✅ Reach code test coverage threshold 100%
Far
- Create GH Pages for usage Docs
- Implement TypeScript
- Build SWAGGER Docs for API testing or quick preview