Skip to main content
# Razorpay Python Client

[![PyPI Version](https://img.shields.io/pypi/v/razorpay.svg?style=flat-square)](https://pypi.python.org/pypi/razorpay) [![Build Status](https://travis-ci.org/razorpay/razorpay-python.svg?branch=master)](https://travis-ci.org/razorpay/razorpay-python) [![License](https://img.shields.io/:license-mit-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)

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

```sh
$ 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>.

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

### Payments

- Fetch all payments

```py
client.payment.fetch_all()
```

- Fetch a particular payment

```py
client.payment.fetch("<PAYMENT_ID>")
```

- Capture a payment

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

- Refund a payment

```py
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

```py
client.refund.fetch("<payment_id>", "<refund_id>")
```

- fetch all refunds for a particular payment(same as payment refund fetch all)

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

### Orders

- Create a new order

```py
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

```py
client.order.fetch("<ORDER_ID>")
```

- fetch all orders

```py
client.order.fetch_all()
```

- fetch Payments of order

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

### Invoices

- Create a new invoice

```py
client.invoice.create(data=DATA)
```
For List of params refer to this :-
https://docs.razorpay.com/v1/page/invoices#v1invoices


- fetch a particular invoice

```py
client.invoice.fetch("<INVOICE_ID>")
```

- fetch all invoices

```py
client.invoice.fetch_all()
```

## Bugs? Feature requests? Pull requests?

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

[issues]: https://github.com/razorpay/razorpay-python/issues
[pulls]: https://github.com/razorpay/razorpay-python/pulls

Metadata

Release files for razorpay 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for razorpay 0.2.2
File Size Uploaded
razorpay-0.2.2.tar.gz 153.9 kB Details

Release files / razorpay-0.2.2.tar.gz

Download URL razorpay-0.2.2.tar.gz
Size 153.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4f2139baf8a0cfd543866d61924cdfa33736a9029beb59b7c032ab2aea9e07fe
BLAKE2b-256 checksum
How to use checksums
8606649321b833e834b825fcf1e1d1d850cc9cb178c59057390e84aaed08803d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.0.1

2 release files

2.0.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.3.1

2 release files

1.3.0

1 release file

1.2.0

2 release files

1.1.1

1 release file

1.1.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.3.0

1 release file

This release

0.2.2 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.1.0a0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page