Skip to content

Releases: BuildWithHussain/razorpay_frappe

v1.4 Payment Links!

13 Jun 18:20
Compare
Choose a tag to compare

You can now create Payment Links right from the desk!

rzp_payment_links.mp4
  • Both Standard & UPI type links
  • Status is synced every hour
  • Manual syncing using a button
  • Copy link to clipboard

v1.3 Bug Fix

14 May 14:50
Compare
Choose a tag to compare

Full Changelog: v1.2...v1.3

v1.2 Refactor Webhook Handler

14 May 14:29
Compare
Choose a tag to compare

Smaller things, simpler and more readable code: v1.1...v1.2

v1.1 - Workspace!

13 May 08:23
Compare
Choose a tag to compare

v1.0.0

13 May 07:54
Compare
Choose a tag to compare

Plug-n-play Razorpay Integration for your Frappe apps and sites.

Configuration

Open up Razorpay Settings and add your API keys:

CleanShot 2024-05-13 at 12 16 29@2x

You can also toggle guest checkout from here. If you disable guest checkout, the API endpoints for working with Razorpay orders (more soon) will need authentication.

Accepting Payments / Checkout from Frontend

CleanShot.2024-05-13.at.13.15.59.mp4

The backend is already ready ⚡. For the frontend, I have included 2 ready to go examples:

  1. Portal Page with VanillaJS (source)
  2. FrappeUI Page with Vue Headless component (source)

The nice thing about the second example is that you can just copy the RazorpayHeadlessCheckout (source) component to your FrappeUI based frontend and it will just work!

All of the payment tracking happens in the Razorpay Order DocType:

CleanShot 2024-05-13 at 12 31 26@2x

You can hook into document lifecycle events (before_insert, on_update, etc.) of this DocType to extend/add your own logic. Here is an example using doc_events hook in our custom app:

# hooks.py
#--------

doc_events = {
    "Razorpay Order": {
        "on_update": "path.to.method.process_payment_update"
    }
}

# method
def process_payment_update(doc, event):
    if doc.has_value_changed("status") and doc.status == "Paid":
        meta_data = frappe.parse_json(doc.meta_data)
        # create tickets, sales invoice, etc.
        # ...

You can do the same thing using Server Script (Document Event) as well.