Skip to main content

Python SDK for the Pvium API

Project description

Pvium Python SDK

Python SDK equivalent of the Pvium TypeScript SDK.

Project Structure

pvium-sdk/
  src/pvium_sdk/
    core/
      client.py
      types.py
      sdk.py
      async_sdk.py
    services/
      invoice/
        endpoints.py
      oauth/
        oauth.py
      invites/
        invites.py
      payout/
        payout.py
      webhooks/
        webhooks.py
      ...compatibility wrapper modules...
    crypto/
      signing.py
      invite_merkle.py
    __init__.py
    ...compatibility wrapper modules...
  tests/
    ...pytest suite...
  pyproject.toml
  README.md

Install

pip install -e .

For development and tests:

pip install -e '.[dev]'

Quick Start

from pvium_sdk import PviumSdk, PviumSdkConfig

pvium = PviumSdk.init(
    PviumSdkConfig(
        environment="sandbox",
        apiKey="your_api_key",
        clientId="your_client_id",
    )
)

invoices = pvium.endpoints.listInvoices()
print(invoices)

Async Usage

AsyncPviumSdk preserves the same service surface as PviumSdk and runs service calls in a worker thread.

from pvium_sdk import AsyncPviumSdk, PviumSdkConfig

sdk = AsyncPviumSdk.init(
  PviumSdkConfig(baseUrl="https://api-sandbox.pvium.com/v1", apiKey="your_api_key")
)

# await any service method
invoices = await sdk.endpoints.listInvoices()

Run Tests

pytest

Services

  • pvium.endpoints

    • createInvoice(body, options=None)
    • listInvoices(options=None)
    • getInvoiceStatus(code, options=None)
    • cancelInvoice(invoice_id, options=None)
    • getInstallmentPayments(installment_id, options=None)
  • pvium.oauth

    • exchangeCodeForToken(input, options=None)
    • refreshAccessToken(input, options=None)
    • getAccessTokenFromRefreshToken(input, options=None)
    • getUserInfo(options=None)
  • pvium.invites

    • createBundle(input)
    • signBundle(bundle, signer)
    • createSignedBundle(input, signer)
    • commitBundle(bundle, options=None)
    • createSignedAndCommit(input, signer, options=None)
  • pvium.payout

    • create(input, options=None)
    • createFinalized(input, signer, options=None, request_options=None)
    • list(query=None, options=None)
    • get(payout_id, options=None)
    • addPayments(payout, input, options=None)
    • addRecipients(payout_id, input, options=None)
    • resolveRecipients(payout_id, input, options=None)
    • removePayments(payout_id, input, options=None)
    • deletePayment(payout_id, payment_id, options=None)
    • updatePayment(payout_id, payment_id, input, options=None)
    • editPayment(payout_id, payment_id, input, options=None)
    • listPayments(payout_id, query=None, options=None)
    • listInvites(payout_id, options=None)
    • revokeInvite(payout_id, invite_id, options=None)
    • revokeInviteRoot(payout_id, invite_root_id, options=None)
    • delete(payout_id, options=None)
    • finalize(payout_input, signer, options=None, request_options=None)

Single-payout responses are payout intent objects. They keep dictionary compatibility with ["meta"] and ["data"], and expose payout fields and proxy methods directly:

payout_intent = pvium.payout.create({
    "type": "Instant",
    "chain": "base",
    "name": "Creator payroll",
    "payments": [
        {
            "receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
            "amount": 100,
            "token": "usdc",
        }
    ],
})

finalized = payout_intent.finalize("your_signer_private_key")
print(finalized.fundingUrl)

Batch detail responses include up to 250 embedded payments. If the payout has more, the response meta/data includes truncation fields such as paymentsTruncated, paymentsLimit, and paymentCount. Use the paginated payment list for larger payouts:

payments = payout_intent.listPayments({"page": 1, "perPage": 100})

for payment in payments["data"]:
    print(payment["id"], payment["amount"])

You can manage a payout intent and its payments through the intent object:

payout_intent.editPayment(payment_id, {"memo": "Updated memo"})
payout_intent.deletePayment(payment_id)
payout_intent.revokeInvite(invite_id)
payout_intent.delete()

For funded escrow payouts, use the intent proxy instead of passing the batch back into the service:

funded_escrow = pvium.payout.get("escrow_batch_id")

funded_escrow.addPayments({
    "payments": [
        {
            "receiver": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
            "amount": 100,
            "memo": "Approved payout",
        }
    ],
    "signer": "your_signer_private_key",
    "finalizeOptions": {"claimDate": 1777488000},
})

Utilities

The package exports signing helpers, webhook verification helpers, invite merkle helpers, and payout hash helpers similar to the TypeScript SDK.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pvium-0.1.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pvium-0.1.0-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file pvium-0.1.0.tar.gz.

File metadata

  • Download URL: pvium-0.1.0.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pvium-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee7f781241e4ab165a5d13a1986079933f13b779da0bd1739e73d451c2ae4528
MD5 15e04453c2cda4b6943739a1e46aac40
BLAKE2b-256 142919b73d9f072846b6911494eccfde0146cbf3996ecb57bc2429c04ae20608

See more details on using hashes here.

Provenance

The following attestation bundles were made for pvium-0.1.0.tar.gz:

Publisher: python-sdk-publish.yml on pvium/sdks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pvium-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pvium-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pvium-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bd52246d00774d1f05446c8aa30681ea28d23e697dd78582e7cf8ef2901045c
MD5 04caf733eff54f79973cd4c1a223ade4
BLAKE2b-256 5f4e60bb0e111d3d88739aa80e72e09f4327b691e8f12bd122bb04015e18f433

See more details on using hashes here.

Provenance

The following attestation bundles were made for pvium-0.1.0-py3-none-any.whl:

Publisher: python-sdk-publish.yml on pvium/sdks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page