Official PhonePe Payment Gateway Python SDK. NOT on PyPI — must install from PhonePe's private registry using a special pip command. TWO packages cause confusion: 'phonepe' on PyPI (1.0.1) is a community wrapper using old v1 API — NOT the official SDK. Official SDK is 'phonepe_sdk' from phonepe.mycloudrepo.io. Amount in paise (1 INR = 100 paise). Client must be initialized only ONCE — reinitializing raises PhonePeException. Mandatory status check polling after payment.
pip install --index-url https://phonepe.mycloudrepo.io/public/repositories/phonepe-pg-sdk-python --extra-index-url https://pypi.org/simple phonepe_sdkVerified import paths — ran on the pinned version, not inferred.
PhonePe Python SDK — payment creation and status check.
pip install --index-url https://phonepe.mycloudrepo.io/public/repositories/phonepe-pg-sdk-python --extra-index-url https://pypi.org/simple phonepe_sdk
Use official phonepe_sdk from PhonePe's registry, not 'pip install phonepe' from PyPI.
Initialize at app startup as a singleton. Use dependency injection or module-level variable.
amount_in_paise = amount_in_inr * 100
Always call client.get_order_status(merchant_order_id=order_id) after redirect to confirm payment state.
Use Env.SANDBOX with sandbox credentials for testing. Switch to Env.PRODUCTION with live credentials for deployment.
Ensure 'setuptools' is installed in your environment (e.g., by running `pip install setuptools`). In Docker environments based on minimal images like Alpine, you might need to explicitly add this to your Dockerfile.