Python
Latest commit 0ed97b6 Dec 12, 2016 @gaurav1068 gaurav1068 minor version bump
Permalink
Failed to load latest commit information.
razorpay
tests
.gitignore
.travis.yml
CHANGELOG.md
LICENSE Birth: Setup Project Skeleton Nov 12, 2015
MANIFEST.in Fixes setup.py to point to resources subdirectory Dec 19, 2015
README.md
setup.py minor version bump Dec 12, 2016

README.md

Razorpay Python Client

PyPI Version Build Status License

Python bindings for interacting with the Razorpay API.

This is primarily meant for merchants who wish to perform interactions with the Razorpay API programatically.

Installation

$ pip install razorpay

Usage

You need to setup your key and secret using the following: You can find your API keys at https://dashboard.razorpay.com/#/app/keys.

import razorpay
client = razorpay.Client(auth=("<YOUR_API_KEY>", "<YOUR_API_SECRET>"))

Payments

  • Fetch all payments

    client.payment.fetch_all()
  • Fetch a particular payment

    client.payment.fetch("<PAYMENT_ID>")
  • Capture a payment

    client.payment.capture("<PAYMENT_ID>", "<AMOUNT>")
    Note: <AMOUNT> should be same as the original amount while creating the payment
  • Refund a payment

    client.payment.refund("<PAYMENT_ID>", "<AMOUNT>") 
    # for full refund
    
    client.payment.refund("<PAYMENT_ID>", "<AMOUNT_TO_BE_REFUNDED>") 
    # for particular amount
    
    Note: <AMOUNT_TO_BE_REFUNDED> should be equal/less than the original amount

Refunds

  • fetch a particular refund

    client.refund.fetch("<payment_id>", "<refund_id>")
  • fetch all refunds for a particular payment(same as payment refund fetch all)

    client.refund.fetch_all("<payment_id>")

Orders

  • Create a new order

    client.order.create(data=DATA)
    DATA should contain these keys
        amount           : amount of order
        currency         : currency of order
        receipt          : receipt id of order
        payment_capture  : 1 if capture should be done automatically or else 0
        notes(optional)  : optional notes for order
  • fetch a particular order

    client.order.fetch("<ORDER_ID>")
  • fetch all orders

    client.order.fetch_all()
  • fetch Payments of order

    client.order.fetch_all_payments("<ORDER_ID>")

Invoices

Bugs? Feature requests? Pull requests?

All of those are welcome. You can file issues or submit pull requests in this repository.