https://github.com/chetanppatil/pay-instamojo
Library to connect Instamojo in your Node application
https://github.com/chetanppatil/pay-instamojo
instamojo library nodejs npm payment payment-gateway
Last synced: 3 months ago
JSON representation
Library to connect Instamojo in your Node application
- Host: GitHub
- URL: https://github.com/chetanppatil/pay-instamojo
- Owner: chetanppatil
- License: mit
- Created: 2018-04-29T14:33:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T02:13:50.000Z (over 2 years ago)
- Last Synced: 2025-02-16T09:49:02.489Z (4 months ago)
- Topics: instamojo, library, nodejs, npm, payment, payment-gateway
- Language: JavaScript
- Size: 2.73 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NPM Package For Instamojo Payment Gateway REST API
[](http://hits.dwyl.io/chetan07j/pay-instamojo)
[](https://standardjs.com)
[](https://github.com/Chetan07j/pay-instamojo/blob/master/LICENSE)
[](https://github.com/Chetan07j/pay-instamojo/graphs/contributors/)
[](https://github.com/Chetan07j/pay-instamojo/issues/)
[](https://github.com/Chetan07j/pay-instamojo/issues?q=is%3Aissue+is%3Aclosed)[](https://nodei.co/npm/pay-instamojo/)
A node.js module, which provides an object oriented wrapper for the Instamojo REST API.
This library is built to support version `1.1` of the Instamojo API.
Instamojo API documentation can be found [here](https://docs.instamojo.com/docs/create-a-request)
[All About Instamojo](https://docs.instamojo.com/v1.1/docs)
## Installation
Install with the node package manager [npm](http://npmjs.org):
```shell
$ npm install pay-instamojo
```## How To Use?
### Create the Instamojo client
```javascript
const InstamojoApi = require('pay-instamojo').instamojo;const instamojo = new InstamojoApi({
host: ,
apiKey: ,
authToken:
});
```### Get List of All Payment Requests
```javascript
/* For getRequestLists input is not required, hence first parameter is null in this call. */instamojo.getRequestLists(null, (error, body) => {
console.log('RESPONSE: ', error, body);
});
```### Create Payment Request
```javascript
let input = {
allowRepeatedPayment: , // true or false (boolean)
amount: , // e.g., 10
buyerName: ,
purpose: ,
redirectUrl: ,
phone: , // 10 digit valid phone number if any
sendSMS: , // true or false (if true then phone is mandatory)
email: , // valid email if any
sendEmail: , // true or false (if true then email is mandatory)
webhook:
}
instamojo.createRequest(input, function (error, body) {
console.log('RESPONSE:', error, body)
})
```### Get Payment Request By Id
```javascript
let input = {
paymentRequestId:
}
instamojo.getPaymentRequestById(input, function (error, body) {
console.log('RESPONSE:', error, body)
})
```### Create A Refund Request
Find input parameter values definition [here](https://docs.instamojo.com/docs/creating-a-refund)```javascript
let input = {
paymentId: , // Id you got as payment acknowledgment
type: ,
refundAmount: , // not mandatory (if preset then valid amount)
body: // not mandatory
}
instamojo.createRefund(input, function (error, body) {
console.log('RESPONSE:', error, body)
})
```### Get List of Refunds
```javascript
/* For getListOfRefunds input is not required, hence first parameter is null in this call. */instamojo.getListOfRefunds(null, (error, body) => {
console.log('RESPONSE: ', error, body);
});
```### Get Refund Details By Id
```javascript
let input = {
refundId:
}
instamojo.getRefundDetailsById(input, function (error, body) {
console.log('RESPONSE:', error, body)
})
```### Get Payment Details By Id
```javascript
let input = {
paymentId:
}
instamojo.getPaymentDetailsById(input, function (error, body) {
console.log('RESPONSE:', error, body)
})
```### Disable Payment Request By Id
```javascript
let input = {
paymentRequestId:
}
instamojo.disablePaymentRequest(input, function (error, body) {
console.log('RESPONSE:', error, body)
})
```### Enable Payment Request By Id
```javascript
let input = {
paymentRequestId:
}
instamojo.enablePaymentRequest(input, function (error, body) {
console.log('RESPONSE:', error, body)
})
```## Options
InstamojoApi options:
- `host`: The hostname for instamojo
- `apiKey`: Instamojo X-Api-Key
- `authToken`: Instamojo X-Auth-Token## Implemented APIs
- Get List of All Payment Requests
- Create Payment Request
- Get Payment Request By Id
- Create Refund
- Get List Of Refunds
- Get Refund Details By Id
- Get Payment Details By Id
- Disable Payment Request By Id
- Enable Payment Request By Id## Changelog
- _1.0.3 getListOfRefunds, getRefundDetailsById, getPaymentDetailsById, disablePaymentRequest, enablePaymentRequest functions added_
- _1.0.2 get payment request by id, create refund function added_
- _1.0.1 request dependency missing (added in package.json)_
- _1.0.0 Initial version_