Python SDK

Official Declined.io client for Python. Source: Enoros/declined-sdk/declined-python

Install

bash
pip install declined

Initialize

python
from declined import Declined

client = Declined("decl_live_sk_...", base_url="https://api.declined.io/api")

Send a payment failed event

python
client.events.create(
    event_id="evt_123",
    type="payment_failed",
    customer_id="cus_123",
    invoice_id="inv_456",
    amount=24900,
    currency="usd",
    provider="stripe",
)

Mark payment as recovered

When a customer pays outside Declined, notify the platform using either approach below. See the full Recoveries guide.

Via event API

python
client.events.mark_payment_recovered(
    event_id="evt_124",
    customer_id="cus_123",
    invoice_id="inv_456",
    amount=24900,
    currency="usd",
    provider="stripe",
)

Via recovery attempt ID

python
client.recoveries.mark_recovered("ra_abc123")

List resources

All SDKs expose customers, recoveries, sequences, webhooks, incentives, and analytics list methods. See the REST API reference for response shapes.