Registry / payments / cashfree_pg

cashfree_pg

JSON →
library6.0.1pypypi✓ verified 25d ago

Official Cashfree Payment Gateway Python SDK. Current version: 5.0.6 (Mar 2026). THREE packages on PyPI causing confusion: 'cashfree-sdk' (0.1.3 — beta, NOT recommended for production by Cashfree), 'cashfree_pg' (5.0.6 — correct current PG SDK), 'cashfree' (1.0.1 — unrelated package). Use cashfree_pg. API version string must be passed to every API call. Supports SANDBOX and PRODUCTION environments. Amount in rupees (float) — unlike Razorpay which uses paise.

pip install cashfree_pg
INSTALL
IMPORT
SIG · CASHFREE_PG
C
cashfree_pg
paymentspythonv6.0.1
Install
4.5s avg
Import
Disk
35MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 36.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.5s · import 0.000s · 36MB
35MB installed
● package 35MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cashfree
from cashfree_pg import Cashfree
from cashfree_pg import Cashfree

Cashfree PG Python SDK — create and fetch order.

# pip install cashfree_pg from cashfree_pg.api_client import Cashfree from cashfree_pg.models.create_order_request import CreateOrderRequest from cashfree_pg.models.customer_details import CustomerDetails from cashfree_pg.models.order_meta import OrderMeta # Initialize — get keys from dashboard.cashfree.com cashfree = Cashfree( XEnvironment=Cashfree.SANDBOX, XClientId='TEST_APP_ID', XClientSecret='TEST_SECRET_KEY' ) x_api_version = '2023-08-01' # pass to every API call # Create order customer = CustomerDetails(customer_id='cust_001', customer_phone='9999999999') meta = OrderMeta(return_url='https://yourapp.com/callback?order_id={order_id}') request = CreateOrderRequest( order_amount=499.00, # rupees, not paise order_currency='INR', customer_details=customer, order_meta=meta ) try: response = cashfree.PGCreateOrder(x_api_version, request, None, None) print('Order ID:', response.data.order_id) print('Payment URL:', response.data.payment_link) except Exception as e: print('Error:', e) # Fetch order status try: order = cashfree.PGFetchOrder(x_api_version, response.data.order_id, None) print('Status:', order.data.order_status) except Exception as e: print('Error:', e)
Debug
Known issues
breakingThree packages on PyPI: cashfree-sdk (beta/not for production), cashfree_pg (correct SDK), cashfree (unrelated). LLMs and old tutorials reference cashfree-sdk which Cashfree explicitly says is not for production.
fix
pip install cashfree_pg — this is the official current SDK.
affects: all
breakingx_api_version string must be passed to every API call. Omitting it raises TypeError. Unlike Razorpay which doesn't require API version per call.
fix
x_api_version = '2023-08-01'; cashfree.PGCreateOrder(x_api_version, request, None, None)
affects: all
gotchaAmount is in RUPEES (float) — not paise. Unlike Razorpay which uses paise. 500 means ₹500. This is the opposite of Razorpay's convention.
fix
order_amount=500.00 means ₹500. No multiplication needed.
affects: all
gotchaSANDBOX environment uses TEST keys from Cashfree dashboard. Test client IDs start with 'TEST_'. Production keys are different — switch XEnvironment=Cashfree.PRODUCTION with live keys.
fix
Use Cashfree.SANDBOX for testing, Cashfree.PRODUCTION for live. Keys are different for each environment.
affects: all
gotchareturn_url in OrderMeta must include {order_id} placeholder — Cashfree replaces it with actual order ID. Missing placeholder means you can't identify which order was paid.
fix
return_url='https://yourapp.com/callback?order_id={order_id}'
affects: all
gotchaIP whitelisting required for production. Cashfree blocks API calls from non-whitelisted IPs in production. Add your server IP in Cashfree dashboard under Security settings.
fix
Whitelist server IP in Cashfree dashboard → Settings → IP Whitelist.
affects: all
Upgrade
Version history
6.0.1latest on PyPI · released May 18, 2026
Audit
Dependencies
requestsrequiredRequired. Installed automatically.
Agent activity
65 hits · last 30 days
node
54
OpenAI (training)
1
Resources
cashfree_pg — pip install cashfree_pg · libregistry