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",
    ),
)
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

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="1234"))

# 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="1234", service="AIRTIME", provider="mtn", account_number="08012345678", amount_ngn=1000)

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 1234
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.1.1

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.1.1
File Size Uploaded
abapay_sdk-0.1.1.tar.gz 10.7 kB Details

Built distribution (wheel)

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

Total release size: 22.3 kB

Release files / abapay_sdk-0.1.1.tar.gz

Download URL abapay_sdk-0.1.1.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4e4d40f589840e45bc433b3b5631a550605c13a0cc741147146176bf50fea0ab
BLAKE2b-256 checksum
How to use checksums
657d54ed11d09c32321addc9387fa1bbbdd68226c22b7559c47f786c7a8402dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

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

Download URL abapay_sdk-0.1.1-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1784274639e162b01183d9c627ad1874c41a09908b29f4a3d2c3c7768c64d0d4
BLAKE2b-256 checksum
How to use checksums
2fa9156879f7bfd72d2991e7722a9ed407c71a28211e61936fb8f77819ad54c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 20, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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