Skip to main content

Installation

Initialization

You can also use the client as a context manager:

Retries and idempotency (3.3.0)

Only GET requests are automatically retried after connection errors or HTTP 500/502/503/504 responses, up to max_retries times (default: 2). Set max_retries=0 to disable retries. POST, PATCH, and DELETE requests are sent once, even when a caller supplies an idempotency key. Every POST, PATCH, and DELETE sends an Idempotency-Key header. By default it is a fresh UUID for each method call. All resource methods using these verbs accept an optional keyword-only idempotency_key:
Persist a key per business operation and reuse it with the same request when retrying manually. A new method call without a supplied key generates a new UUID; it does not reuse the previous call’s key. Replay protection is endpoint-specific: sending a key does not guarantee deduplication on every route. If a write fails with an unknown outcome, check its status before retrying.

paybridgenp.checkout

checkout.create(params)

Creates a checkout session.
Parameters:

checkout.expire(id)

Marks a session as expired so it can no longer accept payment. Use this when you mint a fresh session for a logical purchase that already had one outstanding (e.g. a customer requesting a new payment link), so the old URL stops being payable immediately rather than waiting for its 30-minute TTL.
Idempotent: calling on an already-terminal session is a no-op that returns the current row state without error. If an active eSewa Intent booking cannot be confirmed cancelled, this returns a 409 error with code: "provider_cancel_unconfirmed"; retry before creating another payable session.

paybridgenp.payments

payments.list(**kwargs)

payments.retrieve(id)


paybridgenp.webhooks

webhooks.create(**kwargs)

webhooks.list()

webhooks.delete(id)

WebhooksResource.construct_event(body, signature, secret) (static)

Verifies a webhook signature and returns the parsed event. Use this in your webhook handler.
Raises SignatureVerificationError if:
  • The signature header is missing or malformed
  • The HMAC doesn’t match
  • The timestamp is more than 5 minutes old (replay attack protection)

paybridgenp.billing

The billing methods provide access to plans, customers, subscriptions, and invoices. Live-mode Billing API access requires Growth or higher; sandbox Billing is available on every plan.

Plans

Customers

Subscriptions

Invoices


Not in the Python SDK yet

account, analytics, providers and sms have no resource on the Python client — calling paybridgenp.account.get() raises AttributeError. Use the TypeScript SDK for those, or call the endpoints directly: GET /v1/account, GET /v1/analytics/overview, GET /v1/providers, POST /v1/sms/notify-pending-payment.

Error handling

All SDK methods raise typed exceptions you can catch and inspect:

Exception classes


Type hints

The SDK ships with a py.typed marker and full type annotations. All parameter types are exported as TypedDict classes:

Framework examples