Pine Labs Online P3P Buyer SDK (Python)
Python SDK for Pine Labs Online P3P buyer clients. It mirrors
@pine-labs-online/p3p-buyer-sdk, intercepts HTTP 402 Payment Required
responses, creates customer-scoped P3P payment credentials, and retries paid
requests.
Installation
pip install pinelabs-p3p-buyer-sdk
Import module: pinelabs_p3p_buyer. Requires Python 3.9 or newer.
Quick Start
from pinelabs_p3p_buyer import (
BuyerRuntimeContext,
P3PEnvironment,
PaymentGateway,
PaymentMethod,
PluralBuyer,
PluralBuyerConfig,
)
buyer = PluralBuyer.create(PluralBuyerConfig(
env=P3PEnvironment.SANDBOX,
paymentGateway=PaymentGateway.PineLabsOnline,
selectedPaymentMethod=PaymentMethod.UpiSbmd,
))
response = buyer.get(
"https://seller.example.com/api/premium",
context=BuyerRuntimeContext(
customerKey="customer-api-token",
customerReference="9876543210",
mobileNumber="9876543210",
),
)
print(response.json())
buyer.close()
Customer identity is runtime context, not static SDK config. This lets one buyer instance safely serve many customers.
402 Flow
- Your code calls
buyer.get(url, context=...). - The seller returns
HTTP 402withWWW-Authenticate: Payment <challenge>. - The SDK decodes the challenge and validates
paymentGateway == "PINE LABS ONLINE". - The SDK calls
POST /api/v1/customer/mpp/tokenwith:X-Customer-Key: <context.customerKey>customer.mobile_numberchallenge_idpayment_amount.valuein minor units
- The SDK retries the seller with
P3P-Credential: Payment <credential>. - The seller captures the payment and may return
Payment-Receipt.
Direct Token API
from pinelabs_p3p_buyer import Amount, CreateTokenOptions, PaymentMethod
token = buyer.methods.create_token(CreateTokenOptions(
customerKey="customer-api-token",
customerReference="9876543210",
mobileNumber="9876543210",
challengeId="ch_...",
paymentAmount=Amount(value=50000, currency="INR"),
paymentMethod=PaymentMethod.UpiSbmd,
))
The buyer SDK no longer creates mandates. Mandate/pre-authorization creation is handled by the seller SDK.
Supported Methods
PaymentMethod.UpiSbmd->"SBMD"/ UPI ReservePayPaymentMethod.Crypto->"CRYPTO"
Error Handling
from pinelabs_p3p_buyer import P3PChallengeError, P3PError, P3PNetworkError
try:
response = buyer.get(url, context=runtime_context)
except P3PChallengeError as err:
...
except P3PNetworkError as err:
...
except P3PError as err:
print(err.code, err.http_status, err.details)
License
MIT
Metadata
Release files for pinelabs-online-mpp-client-sdk 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pinelabs_online_mpp_client_sdk-0.1.3.tar.gz | 19.1 kB | Without provenance | Details for pinelabs_online_mpp_client_sdk-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pinelabs_online_mpp_client_sdk-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pinelabs_online_mpp_client_sdk-0.1.3-py3-none-any.whl |
Total release size: 41.7 kB
Release files / pinelabs_online_mpp_client_sdk-0.1.3.tar.gz
| Download URL | pinelabs_online_mpp_client_sdk-0.1.3.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
346b0b2aa9380673bfc433165d463e6e38c14765dc0283e16dd0cbc3b213aad5
|
|
BLAKE2b-256 checksum How to use checksums |
38fb5f9b01644d2335a07a46b8fd212025cd4842fb432bca6ee8bc7c151137b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / pinelabs_online_mpp_client_sdk-0.1.3-py3-none-any.whl
| Download URL | pinelabs_online_mpp_client_sdk-0.1.3-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a995acedf3b4c754f7869e481e63f86ef84fbb088dc500a7a72e3f80541cd80
|
|
BLAKE2b-256 checksum How to use checksums |
b769beabc75fe04e758e53483b07c8812212d35d8a1d47be066cda67bc437e75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for pinelabs-online-mpp-client-sdk 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.