Code Monkey home page Code Monkey logo

razorpay_integration's Introduction

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"

from razorpay_integration.api import get_razorpay_checkout_url

@frappe.whitelist(allow_guest=True)
def 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

frappe.call({
	method: 'my_app.api.make_payment',
	args: data,
	callback: function(r) {
		// redirect to razor pay url
		window.location.href = r.message;
	}
});

Controller

class ConferenceParticipant(Document):
	def on_payment_authorized(self):
		self.db_set('paid', 1)

License

MIT

razorpay_integration's People

Contributors

saurabh6790 avatar anandpdoshi avatar nabinhait avatar rmehta avatar codingcoffee avatar sahil28297 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.