Skip to main content

Official Python SDK for Hilt Pay Workspace and Hilt Pay API.

Project description

hilt-sdk

Official Python SDK for Hilt Pay Workspace and Hilt Pay API.

Source: https://github.com/Hiltpay/hilt-sdk-python

Agent discovery contract:

  • Agent manifest: https://www.hilt.so/.well-known/hilt-agent.json
  • Agent Discovery Standard: https://docs.hilt.so/developers/agent-discovery-standard
  • OpenAPI: https://api.hilt.so/v1/openapi.json

This SDK wraps the same public merchant routes documented on docs.hilt.so:

  • products
  • hosted checkout
  • payments
  • memberships
  • receipts
  • support
  • webhooks
  • Hilt Pay API apps, products, entitlements, setup manifests, and agent bootstrap
  • native subscription state and cancellation helpers

Install

pip install hilt-sdk

Source and release history: https://github.com/Hiltpay/hilt-sdk-python

Example

Agent-first Hilt Pay API bootstrap

Public launch settlement is Solana USDC. The payment_protocol: "x402" field describes the protected-resource HTTP 402 flow.

from hilt_sdk import HiltClient

public_client = HiltClient()

setup = public_client.pay_api.agent_bootstrap(
    {
        "agent_name": "Acme API Builder",
        "agent_platform": "cursor",
        "requested_use_case": "Protect /ai/pro with Hilt Pay API",
        "contact_email": "founder@acme.test",
        "requested_permissions": ["access:read", "access:write", "access:webhooks"],
    }
)

manifest = public_client.pay_api.submit_agent_setup_manifest(
    setup["setup_intent_id"],
    {
        "setup_token": setup["setup_token"],
        "manifest": {
            "app": {"name": "Acme AI"},
            "product": {
                "external_product_id": "pro-api",
                "title": "Pro API access",
                "amount_minor_units": 79000000,
                "default_rail": "solana_usdc",
                "billing_model": "recurring",
                "renewal_mode": "solana_native_subscription",
                "billing_interval_days": 30,
                "cancel_at_period_end": True,
                "expected_monthly_payments": 120,
                "expected_monthly_volume_usd": 9480,
            },
            "payment_protocol": "x402",
            "settlement_rail": "solana_usdc",
            "protected_resource": {
                "url": "https://api.acme.test/ai/pro",
                "method": "POST",
                "customer_identity": "external_customer_id",
            },
            "webhook": {
                "url": "https://api.acme.test/webhooks/hilt",
                "subscribed_events": ["access.entitlement.activated", "payment.confirmed"],
            },
        },
    },
)

print(manifest["pricing_recommendation"]["recommended_plan"])  # starter, growth, or scale
print(setup["owner_approval_url"])  # send the owner here for the one-minute approval step

Merchant workspace product

from hilt_sdk import HiltClient

client = HiltClient(api_key="hk_live_...")

product = client.products.create(
    {
        "product_type": "PAYMENT_LINK",
        "title": "30-day members lounge",
        "amount_minor_units": 200000,
        "token_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "merchant_wallet": "So1anaMerchantWallet1111111111111111111111111",
        "delivery_type": "REDIRECT",
        "delivery_value": "https://example.com/welcome",
        "membership_config": {
            "enabled": True,
            "platform": "CUSTOM",
            "identity_type": "WALLET",
            "identity_required": False,
            "renewal_mode": "ONE_OFF",
            "billing_interval_days": 30,
            "grace_period_days": 3,
        },
    }
)

print(product["id"], product["slug"])

Native subscription state and cancellation

subscription = client.pay_api.get_native_subscription("AUTHORIZATION_ID")

cancel_intent = client.pay_api.create_native_subscription_cancel_intent(
    "AUTHORIZATION_ID",
    {
        "reason": "buyer_requested",
        "cancel_at_period_end": True,
    },
)

cancelled = client.pay_api.confirm_native_subscription_cancel(
    "AUTHORIZATION_ID",
    {
        "cancel_tx_signature": "SOLANA_CANCEL_TRANSACTION_SIGNATURE",
        "reason": "buyer_requested",
        "immediate_revoke": False,
    },
    idempotency_key="native-cancel-AUTHORIZATION_ID-001",
)

print(subscription["status"], cancel_intent["status"], cancelled["status"])

Quick start

  1. Create or approve a Hilt Pay API setup intent.
  2. Use the SDK to create an app, product, payment session, and webhook.
  3. Use sandbox sessions to validate object handling without live money.
  4. Use entitlement checks before serving paid work.
  5. For recurring access, create products with billing_model: "recurring" and renewal_mode: "solana_native_subscription".

Auth surfaces

For most merchant routes, configure either:

  • api_key for server-to-server merchant automation
  • bearer_token for dashboard-session tooling

Webhook endpoint management currently requires a dashboard session token, so the webhook resource uses the configured bearer_token.

What the SDK is best at

  • products and hosted checkout
  • payment confirmation and reads
  • membership lookup, renewal intelligence, and recovery
  • receipt proof, PDF access, and proof sending
  • support tickets and webhook endpoint operations

Build from source

python setup.py sdist bdist_wheel

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

hilt_sdk-1.0.3.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

hilt_sdk-1.0.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file hilt_sdk-1.0.3.tar.gz.

File metadata

  • Download URL: hilt_sdk-1.0.3.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for hilt_sdk-1.0.3.tar.gz
Algorithm Hash digest
SHA256 128f7eb74cad63deafe8a5b34bb6c54059595fd4cef4b041ed864bc28b4f98f8
MD5 daaff90c4a6f480a0a4fe8069e3c9e93
BLAKE2b-256 3ef97edf634922b362c37b936a7b0fd6a9f159d9b255811b237c12b10a4c261b

See more details on using hashes here.

File details

Details for the file hilt_sdk-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: hilt_sdk-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for hilt_sdk-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d0329be621a21be952a35810dc5f546fcec3be715533beac9291194ba367ab47
MD5 28bffedd8094ce3eb28e8c827c9f3e4b
BLAKE2b-256 0cd8989d57f96767abe51eccb26f9f2ae10b2f69bc22f724e15f6d081b049b24

See more details on using hashes here.

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