1.0.0 • Published 5 years ago

not-razorpayx v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

NOT-PAYOUTS

==========

A simple and reliable Node.js payment automation for paying the payout requests.

Getting Started with razorpayX

  • Post sign up, account activation and KYC verification you are eligible to make payouts. Complete the following three steps to create your first payout via APIs:

    • Create a Contact
    • Add a Fund Account to a contact
    • Create a Payout

Benefits

  • Does only one thing and does it well. Only the Contact, Fund Account and Payout API methods are implemented.
  • Good error handling:
    • Only "2xx" and "3xx" responses from razorpay are considered successful.
  • Tested and reliable. Includes test suite.

Synopsis

Start by creating a client object, and then call the createContact, createAccount, createPayoutmethod depending on your needs.

let NotPayout = require('not-payment')
, client = NotPayout.configPayout({ key: 'key', secret: 'secret' })

// Give razorpay the details and let it construct the payment for you.
 await client.createPayout({
        account_number: '<account_number_created_in fund_account>',
        details:{
            fund_account_id: "fa_E2i8yMbO5rag3Es",
            amount:10000, // amount in paisa 10000 => 100 rupee(rupee*100)
            currency:'INR',
            mode:'NEFT', // Possible mode ['NEFT', 'RTGS', 'IMPS', 'IFT', 'UPI']
            purpose:'payout', // Possible purpose ['refund','cashback','payout','salary','utility bill','vendor bill']
            queue_if_low_balance: true,  // [true, false]
            reference_id:'ref1234', // You can use this field to store your own transaction ID, if any. This field can have a maximum length of 40 characters.
            narration:'NextOnTop HI Tech Soft Solution', // Data type string. This is a custom note that also appears on the bank statement. This field can have a maximum length of 30 characters. Allowed characters are: a-z, A-Z, 0-9 and space.
            notes: { company: 'nextontop', processing: 'done' } // Additional details to store in the paout.
        },
    })

Installation

npm install not-payout --save

The module has one primary export:

createClient()

You'll probably only be using this method. It takes an options object with the following properties:

`key` -  your Razorpayx key .
`secret` - your Razorpayx secret.

To create your razorpayX account. Check RazorpayX to be sure the region you are in is supported.

let NotPayout = require('not-payment')
, client = NotPayout.configPayout({ key: 'key', secret: 'secret' })
  • Steps to follow.

    1. Create a Contact
    2. Add a Fund Account to a contact
    3. Create a Payout

Contact Methods

There are several important points to know about SendEmail:

  • First create the contect with the basic details.
 // create new contact
    client.createContact({
            name: 'ragav rvd', // (mandatory) 'String'
            email: 'ragavarvd@gmail.com', // (optional) 'String'
            contact: '9677822758', // (optional) 'String'
            type: 'customer', // (optional) 'String' ['vendor', 'customer', 'employee', 'self']
            reference_id:'contact_1234', // (optional) 'String' Can have a maximum length of 40 characters.
            notes: {} //(optional) 'object' Eg:{"note-key": "Beam me up Scotty"} 
    })

// Update Contact Details
    client.updateContact({
        id: 'cont_E3sSZ2ewjKGmcK', // (mandatory) The unique identifier linked to the contact.
        //The details need to update
        name: 'ragav',
        email: 'ragavarvd@gmail.com',
        contact: '9874563210',
    })
 
 // Get all contacts.
    config.getContacts()

 // Get get single contact.
    let contact_id = 'cont_E3sSZ2ewjKGmcK'
    config.getContacts(contact_id);


// Activate Contact
    config.enableContact({ id: 'cont_E3sSZ2ewjKGmcK' //Contact Id})
// Deactivate Contact
    config.disableContact({ id: 'cont_E3sSZ2ewjKGmcK' //Contact Id })

CreateContact receives an options object with the following properties:

`name` - string (required). User name to create the contact.
`email` - string. Email address of the contact.
`contact` - string. Phone number of the contact.
`type` - String. Available options are ['vendor', 'customer', 'employee', 'self']
`reference_id` - String. User-generated reference for the contact, This field can have a maximum length of 40 characters.
`notes` - Notes you can enter for the contact for future reference. This is a key-value pair Eg:{"note-key": "Beam me up Scotty"} 

The request you made in this method transports your message to the razorpayx service. If razzorpayx returns an HTTP status code that's less than 200 or greater than or equal to 400, we will catch with an err object that is a direct translation of the error razorpayx provides.

See Error Handling section below for details on the structure of returned errors.

Check for errors returned since a 400 status is not uncommon.

The data returned in the callback is the HTTP body returned by razorpayx as json object. See the Razorpayx API Response docs for details.

Error Handling

Example error response:

  • If you miss to send the required field values for any request yo will get the following error response.
{ 
    "err_code": "BAD_REQUEST_ERROR",
    "message": "No db records found." 
}

License

MIT

1.0.0

5 years ago