Metadata-Version: 2.4
Name: cashfree_pg
Version: 5.0.6
Summary: Cashfree Payment Gateway APIs
Home-page: https://cashfree.com
Author: Cashfree Payments
Author-email: developers@cashfree.com
License: Apache 2.0
Keywords: Payment Gateway,Cashfree,SDK,Payments,Cashfree Payment Gateway APIs
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: urllib3<2.1.0,>=1.25.3
Requires-Dist: python-dateutil
Requires-Dist: pydantic>=2.11.7
Requires-Dist: aenum
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# Cashfree PG Python SDK
![GitHub](https://img.shields.io/github/license/cashfree/cashfree-pg-sdk-python) ![Discord](https://img.shields.io/discord/931125665669972018?label=discord) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/cashfree/cashfree-pg-sdk-python/master) ![GitHub release (with filter)](https://img.shields.io/github/v/release/cashfree/cashfree-pg-sdk-python?label=latest) ![GitHub forks](https://img.shields.io/github/forks/cashfree/cashfree-pg-sdk-python) ![Order Create API Order Create API](https://statuspage.cashfree.com/badge/pg-create-order-api/status)

The Cashfree PG Python SDK offers a convenient solution to access [Cashfree PG APIs](https://docs.cashfree.com/reference/pg-new-apis-endpoint) from a server-side Go  applications. 



## Documentation

Cashfree's PG API Documentation - https://docs.cashfree.com/reference/pg-new-apis-endpoint

Learn and understand payment gateway workflows at Cashfree Payments [here](https://docs.cashfree.com/docs/payment-gateway)

Try out our interactive guides at [Cashfree Dev Studio](https://www.cashfree.com/devstudio) !

## Getting Started

### Installation
```bash
pip install cashfree_pg
```
### Configuration

```python
from cashfree_pg.models.create_order_request import CreateOrderRequest
from cashfree_pg.api_client import Cashfree
from cashfree_pg.models.customer_details import CustomerDetails
from cashfree_pg.models.order_meta import OrderMeta

cashfree_instance = Cashfree(
    XEnvironment=Cashfree.SANDBOX,
    XClientId="<x-client-id>",
    XClientSecret="<x-client-secret>",
    XPartnerKey="<x-partner-key>",
    XClientSignature="<x-client-signature>",
    XPartnerMerchantId="<x-partner-merchant-id>"
)
```

Generate your API keys (x-client-id , x-client-secret) from [Cashfree Merchant Dashboard](https://merchant.cashfree.com/merchants/login)

### Basic Usage
Create Order
```python
customerDetails = CustomerDetails(customer_id="walterwNrcMi", customer_phone="9999999999")
orderMeta = OrderMeta(return_url="https://www.cashfree.com/devstudio/preview/pg/web/checkout?order_id={order_id}")
createOrderRequest = CreateOrderRequest(order_amount=1, order_currency="INR", customer_details=customerDetails, order_meta=orderMeta)
try:
    api_response = cashfree_instance.PGCreateOrder(x_api_version, createOrderRequest, None, None)
    print(api_response.data)
except Exception as e:
    print(e)
```

Get Order
```python
try:
    api_response = cashfree_instance.PGFetchOrder(x_api_version, "order_3242X4jQ5f0S9KYxZO9mtDL1Kx2Y7u", None)
    print(api_response.data)
except Exception as e:
    print(e)
```

## Supported Resources

- [Order](docs/Orders.md)

- [Payment](docs/Payments.md)

- [Refund](docs/Refunds.md)

- [Token Vault](docs/TokenVault.md)

- [Eligiblity](docs/Eligibility.md)

- [PaymentLink](docs/PaymentLink.md)

- [Settlements](docs/Settlements.md)

- [Reconciliation](docs/Reconciliation.md)

- [Webhook](docs/Webhook.md)


## Licence

Apache Licensed. See [LICENSE.md](LICENSE.md) for more details
