[![Downloads](https://static.pepy.tech/badge/cashfree)](https://pepy.tech/project/cashfree)
# CashFree API Python Package
This Python package provides a simple interface to the CashFree APIs. It can be used to create orders, payment links, check the status of transactions, and refund orders etc
##### Note: Refer to the [cashfree api docs](https://docs.cashfree.com/reference/pg-new-apis-endpoint) for detailed payload instructions, API references, and examples.
## Installation
To install the package, run the following command:
```bash
pip install cashfree
```
## Usage
#### The following code shows how to create a CashFree Payment Session:
* Initiate Cashfree Object
```python
from cashfree import CashFree
# Instantiate CashFree object for the sandbox environment (TEST)
cashfree_client = CashFree(client_id, client_secret, environment="TEST", api_version='v3')
```
* Create A Customer Object
```python
from cashfree import CustomerDetails
customer = CustomerDetails(customer_id='CF_7768', customer_phone='7778989987')
```
* Create A Order Object
```python
from cashfree import CashFreeOrder
order = CashFreeOrder(order_id='your-order-id', order_amount=120.3)
```
### Now you can use the client to interact with CashFree APIs
* Create an order payment session
```python
# You can pass the order & customer object inside create_order method
order = cashfree_client.create_order(order, customer)
payment_session_id = order.get('payment_session_id')
```
* Get Payment Details Of A Single Order
```python
order_details = cashfree_client.get_payment_details('your_order_id')
```
* Webhook Signature validation
```python
# Get The raw Payload data
raw_payload = request.get_data(as_text=True)
timestamp = request.headers.get('x-webhook-timestamp')
received_signature = request.headers.get('x-webhook-signature')
is_valid_webhook = cashfree_client.validate_webhook_signature(raw_payload, timestamp, received_signature)
```
### Contributing:
Contributions are always welcome! If you find any issues or have suggestions, please open an issue or create a pull request on GitHub.
### License:
This project is licensed under the MIT License
### Support:
For api related support please contact support@cashfree.com.
Pending Feature:
* Easy Split Module
* Payouts Module
* Cashgram Module
* Verification Suite
Raw data
{
"_id": null,
"home_page": "https://github.com/devbijay/cashfree",
"name": "cashfree",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "cashfree payment-api cashfree-api",
"author": "Bijay Nayak",
"author_email": "bijay6779@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/40/96/584c1ef0749ed124471c7654d99081e2afefde13ad798b5b1b1ba0a3eb43/cashfree-1.0.1.tar.gz",
"platform": null,
"description": "\n[![Downloads](https://static.pepy.tech/badge/cashfree)](https://pepy.tech/project/cashfree)\n# CashFree API Python Package\n\nThis Python package provides a simple interface to the CashFree APIs. It can be used to create orders, payment links, check the status of transactions, and refund orders etc\n##### Note: Refer to the [cashfree api docs](https://docs.cashfree.com/reference/pg-new-apis-endpoint) for detailed payload instructions, API references, and examples.\n## Installation\n\nTo install the package, run the following command:\n\n```bash\npip install cashfree\n```\n\n## Usage\n\n#### The following code shows how to create a CashFree Payment Session:\n* Initiate Cashfree Object\n\n```python\nfrom cashfree import CashFree\n\n# Instantiate CashFree object for the sandbox environment (TEST)\ncashfree_client = CashFree(client_id, client_secret, environment=\"TEST\", api_version='v3')\n```\n\n* Create A Customer Object\n```python\nfrom cashfree import CustomerDetails\ncustomer = CustomerDetails(customer_id='CF_7768', customer_phone='7778989987')\n```\n* Create A Order Object\n```python\nfrom cashfree import CashFreeOrder\norder = CashFreeOrder(order_id='your-order-id', order_amount=120.3)\n```\n### Now you can use the client to interact with CashFree APIs\n\n* Create an order payment session\n```python\n# You can pass the order & customer object inside create_order method\norder = cashfree_client.create_order(order, customer)\npayment_session_id = order.get('payment_session_id')\n```\n* Get Payment Details Of A Single Order\n```python\norder_details = cashfree_client.get_payment_details('your_order_id')\n```\n\n* Webhook Signature validation\n```python\n# Get The raw Payload data\nraw_payload = request.get_data(as_text=True)\ntimestamp = request.headers.get('x-webhook-timestamp')\nreceived_signature = request.headers.get('x-webhook-signature')\nis_valid_webhook = cashfree_client.validate_webhook_signature(raw_payload, timestamp, received_signature)\n```\n\n### Contributing:\nContributions are always welcome! If you find any issues or have suggestions, please open an issue or create a pull request on GitHub.\n\n### License:\n\nThis project is licensed under the MIT License\n\n### Support:\nFor api related support please contact support@cashfree.com.\n\nPending Feature:\n* Easy Split Module\n* Payouts Module\n* Cashgram Module\n* Verification Suite\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for interacting with CashFree API.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/devbijay/cashfree"
},
"split_keywords": [
"cashfree",
"payment-api",
"cashfree-api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "94ec578eeeb7678409a30722279e4ca46797de1b6a8fd843f89ac227048a6ce1",
"md5": "515f99fb1db624218589a9ea4393a8e3",
"sha256": "2e35ab951e25f22ba2fe6faea5294dcec7936cd271d2eae3c5cbcb37837c0ffe"
},
"downloads": -1,
"filename": "cashfree-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "515f99fb1db624218589a9ea4393a8e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7622,
"upload_time": "2024-01-03T20:13:38",
"upload_time_iso_8601": "2024-01-03T20:13:38.049072Z",
"url": "https://files.pythonhosted.org/packages/94/ec/578eeeb7678409a30722279e4ca46797de1b6a8fd843f89ac227048a6ce1/cashfree-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4096584c1ef0749ed124471c7654d99081e2afefde13ad798b5b1b1ba0a3eb43",
"md5": "0df1a4d90a9a7d1339e8e50d4a9c7c63",
"sha256": "8df623cb624f565ca7288e838372dd6b4c1cc62622c2284b2dc4a5d53ac5e005"
},
"downloads": -1,
"filename": "cashfree-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "0df1a4d90a9a7d1339e8e50d4a9c7c63",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 8603,
"upload_time": "2024-01-03T20:13:39",
"upload_time_iso_8601": "2024-01-03T20:13:39.184763Z",
"url": "https://files.pythonhosted.org/packages/40/96/584c1ef0749ed124471c7654d99081e2afefde13ad798b5b1b1ba0a3eb43/cashfree-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-03 20:13:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "devbijay",
"github_project": "cashfree",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "setuptools",
"specs": [
[
"~=",
"69.0.3"
]
]
},
{
"name": "requests",
"specs": [
[
"~=",
"2.31.0"
]
]
},
{
"name": "pydantic",
"specs": [
[
"~=",
"2.5.3"
]
]
}
],
"lcname": "cashfree"
}