Skip to main content

Cashfree Payment Gateway APIs

Project description

Cashfree PG Python SDK

GitHub Discord GitHub last commit (branch) GitHub release (with filter) GitHub forks Order Create API Order Create API

The Cashfree PG Python SDK offers a convenient solution to access Cashfree PG APIs 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

Try out our interactive guides at Cashfree Dev Studio !

Getting Started

Installation

pip install cashfree_pg

Configuration

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

Basic Usage

Create Order

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

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

Supported Resources

Licence

Apache Licensed. See LICENSE.md for more details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cashfree_pg-5.0.5.tar.gz (195.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cashfree_pg-5.0.5-py3-none-any.whl (451.8 kB view details)

Uploaded Python 3

File details

Details for the file cashfree_pg-5.0.5.tar.gz.

File metadata

  • Download URL: cashfree_pg-5.0.5.tar.gz
  • Upload date:
  • Size: 195.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for cashfree_pg-5.0.5.tar.gz
Algorithm Hash digest
SHA256 77e3ec0a898625a317d4debb7175a7776490d7179c64e799ce7536499a039f34
MD5 4281fe5a7df84245183fa835c9cb1be7
BLAKE2b-256 bad7624e308946adedb0f7e0892a6f8a60cae9c440560879e9d614bd53ca1e55

See more details on using hashes here.

File details

Details for the file cashfree_pg-5.0.5-py3-none-any.whl.

File metadata

  • Download URL: cashfree_pg-5.0.5-py3-none-any.whl
  • Upload date:
  • Size: 451.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for cashfree_pg-5.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cdcac110c3ed3115f88840e241ab248bb3c0c95e17e2b01b0c73d1f297b95e8e
MD5 b1c81a0ba940c5577e6739165dd8b094
BLAKE2b-256 6da2fc1cbfba74059d7738b16b70b0d9da3b5a0272c5fc36db7225dd7e01d8f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page