Pine Labs Online Offer Discovery SDK (Python)
Python SDK for Pine Labs Online's affordability/offer discovery API. It calls
Pinepg's POST /api/affordability/v2/offer/discovery endpoint in UAT or
PROD and returns normalized offer data.
Installation
pip install pinelabs-offer-discovery-sdk==1.0.0
Import module: pinelabs_offer_discovery. Requires Python 3.9 or newer.
Environments
env |
Endpoint |
|---|---|
OfferDiscoveryEnvironment.UAT |
https://pluraluat.v2.pinepg.in/api/affordability/v2/offer/discovery |
OfferDiscoveryEnvironment.PROD |
https://api.pluralpay.in/api/affordability/v2/offer/discovery |
Environment defaults:
| Env | Timeout | Retries | Initial retry delay |
|---|---|---|---|
UAT |
60000 ms | 3 | 500 ms |
PROD |
45000 ms | 3 | 500 ms |
Authentication
- Supply
merchantId,clientId, andclientSecret. The SDK exchanges the credentials at the selected environment'sPOST /api/auth/v1/token, caches the token per client instance, refreshes it before expiry, and sendsAuthorization: Bearer <accessToken>to offer discovery. You can supply a pre-mintedaccessTokeninstead.merchantIdis mandatory at client creation and has no SDK fallback or per-request override.
The SDK always adds "tenure": {"tenure_id": "7"} to the Pine Labs
request. Integrators do not need to provide a tenure value.
Quick Start
import os
from pinelabs_offer_discovery import (
Amount,
OfferDiscoveryClient,
OfferDiscoveryClientConfig,
OfferDiscoveryEnvironment,
OfferDiscoveryRequest,
ProductAmount,
ProductDetail,
)
client = OfferDiscoveryClient.create(OfferDiscoveryClientConfig(
env=OfferDiscoveryEnvironment.PROD,
merchantId=os.environ["OFFER_MERCHANT_ID"],
clientId=os.environ["OFFER_CLIENT_ID"],
clientSecret=os.environ["OFFER_CLIENT_SECRET"],
))
response = client.discover_offers(OfferDiscoveryRequest(
order_amount=Amount(currency="INR", value=14997000),
product_details=[
ProductDetail(
product_code="SAMSUNG_BRAND-3",
product_amount=ProductAmount(value=14997000, currency="INR"),
)
],
future_date="2026-09-09",
))
print(response.offers)
client.close()
Keep the client instance long-lived so the cached token is reused. A configured
or per-request accessToken takes precedence over client-credentials exchange.
Client secrets must only be used in a trusted server-side process.
Per-request overrides
OfferDiscoveryOptions lets you override Request-ID and accessToken per
call without mutating the shared client config:
from pinelabs_offer_discovery import OfferDiscoveryOptions
response = client.discover_offers(
request,
OfferDiscoveryOptions(
requestId="ORD-7783073127",
accessToken="<rotated_widget_token>",
),
)
The SDK auto-generates a UUID Request-ID and a X-Request-Id when none is
supplied. Curl-style Request-ID: ARELLI_Port Myrtice is supported verbatim.
Response shape
OfferDiscoveryResponse exposes:
offers: a list of normalizedOfferobjects with common fields (offer_id,tenure_id,monthly_installment,total_amount,product_code,bank_name, …).raw: the full response payload for any extra/forward-compatible fields.
The parser tolerates several response envelopes the discovery API may return:
top-level array, {"data": [...]}, {"offers": [...]}, or
{"data": {"offers": [...]}}.
Errors
OfferDiscoveryError— non-2xx API responses. Exposes.code,.http_status, and.details.OfferDiscoveryNetworkError— network/timeout errors. Exposes.cause.OfferDiscoveryValidationError— invalid request input raised before any HTTP call.
Context manager
with OfferDiscoveryClient.create(config) as client:
response = client.discover_offers(request)
The SDK closes any internal httpx.Client it created; externally supplied
http_client instances are left alone.
License
MIT
Metadata
Release files for pinelabs-offer-discovery-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pinelabs_offer_discovery_sdk-1.0.0.tar.gz | 16.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pinelabs_offer_discovery_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.2 kB
Release files / pinelabs_offer_discovery_sdk-1.0.0.tar.gz
| Download URL | pinelabs_offer_discovery_sdk-1.0.0.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8fbc6b0f14a16e9bdab84f4ae924aa59bdc07cd85f6a402addad5978b4d1d7a
|
|
BLAKE2b-256 checksum How to use checksums |
f8ebecf3d0644aa26f888017cd80d44469d9547981282886b94a3f88abd19c07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / pinelabs_offer_discovery_sdk-1.0.0-py3-none-any.whl
| Download URL | pinelabs_offer_discovery_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d734b77388781b6645f7b94cb3fd75c04e0bf7bd9faa1e6fe62392632502889
|
|
BLAKE2b-256 checksum How to use checksums |
6a641789a170cf374edee35813877ecc8dc05f7983ead3d3c6a4d0abede869c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|