frappe/razorpay_integration

Name: razorpay_integration

Owner: Frappe

Description: Rajorpay integration with Frappe/ERPNext

Created: 2016-04-20 06:14:35.0

Updated: 2018-05-04 13:38:12.0

Pushed: 2018-05-04 13:38:11.0

Homepage: null

Size: 31

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Razorpay Integration

Razorpay Payment Gateway Integration with Frappe/ERPNext

Usage

To get url for payment

  1. Make a DocType for Order
  2. On “pay now” button, redirect to razorpay_checkout page
  3. When payment is authorized on_payment_authorized is called on the Order
Example
“API”
 razorpay_integration.api import get_razorpay_checkout_url

ppe.whitelist(allow_guest=True)
make_payment(full_name, email, company, amount, workshop=None, conference=None):
# make order
participant = frappe.get_doc({
    'doctype': 'Conference Participant',
    'full_name': full_name,
    'email_id': email,
    'company_name': company,
    'workshop': workshop,
    'conference': conference,
    'amount': amount
}).insert()

# get razorpay url
url = get_razorpay_checkout_url(**{
    'amount': amount,
    'title': 'ERPNext Conference Tickets',
    'description': '{0} passes for conference, {1} passes for workshop'.format(int(conference), int(workshop)),
    'payer_name': full_name,
    'payer_email': email,
    'doctype': participant.doctype,
    'name': participant.name,
    'order_id': participant.name
})

return url
when “Pay Now” is clicked
pe.call({
method: 'my_app.api.make_payment',
args: data,
callback: function(r) {
    // redirect to razor pay url
    window.location.href = r.message;
}

Controller
s ConferenceParticipant(Document):
def on_payment_authorized(self):
    self.db_set('paid', 1)
License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.