Skip to main content

abapay-sdk (Python)

Pay real-world bills — airtime, mobile data, electricity, cable TV — from an agent's own Celo wallet. Mirrors abapay-sdk (npm) field-for-field. Two ways in, matching agents.abapays.com:

  • pay_bill_via_x402 — zero setup. No account, no API key, no PIN, no visit to abapays.com. Your agent's wallet signs one EIP-3009 authorization and the bill is paid.
  • AbaPayAgent — a linked-wallet client for the fuller MCP tool catalog (balances, history, schedules). One on-chain signature to link, then an API key + PIN per payment.

Full protocol details: docs.abapays.com. Celo mainnet only.

Install

pip install abapay-sdk

eth-account is the only runtime dependency — used for EIP-712/personal_sign signing, the Python-ecosystem equivalent of what viem does for the TypeScript SDK.

Zero setup: pay a bill via x402

from eth_account import Account
from abapay import pay_bill_via_x402, BillDetails

account = Account.from_key("0x...")  # PRIVATE_KEY env var, not committed

result = pay_bill_via_x402(
    account,
    BillDetails(
        serviceID="mtn", serviceCategory="AIRTIME", network="MTN",
        billersCode="08012345678", nairaAmount=1000, token="USDT",  # or "USDC", "USAT" (USA₮)
    ),
)
print(result.status, result.tx_hash)

That's the whole integration. account never touches abapays.com beyond this one HTTP call — no account creation, no API key, no PIN. Full wire format: agents.abapays.com/x402 — nothing here is hidden, read src/abapay/x402.py to see or port it to another language yourself.

Linked wallet: the fuller tool catalog

import uuid
from eth_account import Account
from abapay import AbaPayAgent, LinkParams

account = Account.from_key("0x...")

# One-time: prove wallet ownership, mint an Agent Hub api_key. Save agent.api_key somewhere —
# there is no recovery flow other than linking again.
agent = AbaPayAgent.link(LinkParams(signer=account, pin="123456"))

# Elsewhere, an on-chain approve() + setSpendingAllowance() grants AbaPay a bounded, revocable
# allowance — see examples/agent-quickstart.mjs in the main repo for the two calls. Nothing in
# this SDK can raise that allowance on your behalf; only your own wallet can.

print(agent.check_balance())

agent.pay_bill(pin="123456", service="AIRTIME", provider="mtn", account_number="08012345678", amount_ngn=1000, idempotency_key=str(uuid.uuid4()))

Reattach to a previously-minted key without signing again:

agent = AbaPayAgent.from_api_key(saved_api_key, wallet_address)

CLI

pip install abapay-sdk

PRIVATE_KEY=0x... abapay pay --service AIRTIME --provider mtn --to 08012345678 --amount 1000
PRIVATE_KEY=0x... abapay link --pin 123456
abapay balance --api-key aba_mcp_xxxxx
abapay history --api-key aba_mcp_xxxxx --limit 5

Errors

Every failure throws AbaPayError (.message, and .response carrying whatever AbaPay's API returned, when there was one). Full error code reference: agents.abapays.com/errors.

Development

pip install -e ".[dev]"
pytest

Tests run against a real local HTTP server (pytest-httpserver), not a patched urlopen — test_x402.py specifically recovers the signer's address from the signed EIP-712 typed data and asserts it matches, the same correctness guarantee the TypeScript SDK's own test suite makes.

License

MIT

Metadata

Release files for abapay-sdk 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abapay-sdk 0.3.2
File Size Uploaded Provenance Actions
abapay_sdk-0.3.2.tar.gz 13.9 kB With provenance Details for abapay_sdk-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for abapay-sdk 0.3.2
File Interpreter ABI Platform Actions
abapay_sdk-0.3.2-py3-none-any.whl Python 3 none any Details for abapay_sdk-0.3.2-py3-none-any.whl

Total release size: 27.2 kB

Release files / abapay_sdk-0.3.2.tar.gz

Download URL abapay_sdk-0.3.2.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dab0fa5447d67c1d2561b4aa3ccd3a22242e10d23d7cddc155e9bf05e95412e9
BLAKE2b-256 checksum
How to use checksums
1cd136dba692f855b4e3004bf7520c6f4a2fe38b03b1a3fded04de736abe5c29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / abapay_sdk-0.3.2-py3-none-any.whl

Download URL abapay_sdk-0.3.2-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
119a3e421f48512c8df4e14c07f8e3091a24025bee319eae00e3fb016030a2c4
BLAKE2b-256 checksum
How to use checksums
5df0242e2add28e31ed24811bb56fbe9f4f760bb69db5fdd44cfbe174ed3266f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for abapay-sdk 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for abapay_sdk-0.3.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page