Skip to main content

agentpay

The official AgentPay SDK for Python. Issue capped virtual cards and let your agent complete real checkouts. Card controls, 3DS, and fraud caps are handled for you. Zero dependencies.

Install

pip install agentpay-global

Requires Python 3.8+.

Quickstart

import os
from agentpay import AgentPay

agentpay = AgentPay(api_key=os.environ["AGENTPAY_API_KEY"])  # key looks like mk_live_...

# Issue a single-use card capped at $20
card = agentpay.cards.create(amount=20, merchant="namecheap", single_use=True)
print(card["id"], card["last4"], card["spend_limit"])

Get your API key from the AgentPay console (Developer -> API keys). Keep it server-side; never commit it.

Tools

Cards

card = agentpay.cards.create(amount=20, merchant="namecheap", single_use=True)
full = agentpay.cards.reveal(card["id"])   # {"number","cvc","exp",...}: use at the moment of purchase
closed = agentpay.cards.close(card["id"])  # release the unused reserve back to your wallet

Spend status

spend = agentpay.spend.get(card["spend_request_id"])
# spend["status"]: "not_started" | "authorized" | "cleared" | "declined"

Checkout (AgentPay drives the buy)

run = agentpay.checkout.create(
    task="buy the domain example.click for 1 year",
    merchant="namecheap",
    amount=20,
    confirm_pay=False,  # dry run: stops at the final review. True = pay up to the cap.
)

status = agentpay.checkout.get(run["checkout_id"])
# status["status"]: "queued" | "running" | "awaiting_approval" | "needs_login" | "submitted" | "blocked"

Connections (login-gated merchants)

conn = agentpay.connections.create(merchant="namecheap", user_ref="user-123")
# open conn["connect_url"] so the user signs in, then:
agentpay.connections.complete(conn["connection_id"])
# now pass connection_id to checkout.create to run signed-in

Errors

Any non-2xx response raises AgentPayError with the HTTP status, the AgentPay error code, and the request id.

from agentpay import AgentPay, AgentPayError

try:
    agentpay.cards.create(amount=999999, merchant="namecheap")
except AgentPayError as e:
    print(e.status, e.code, e.request_id)  # e.g. 402 insufficient_funds

Configuration

AgentPay(
    api_key=os.environ["AGENTPAY_API_KEY"],
    base_url="https://api.joomjoo.com",  # optional override
    timeout=60.0,
)

Docs

The wallet

w = agentpay.wallet.get()                                        # balance, available, reserved, pending, in dollars
s = agentpay.wallet.create_funding_session(amount=50, success_url="https://yourapp.example/funded")
# open s["url"] for the person; the wallet is credited when Stripe confirms (webhook event money.funded)
t = agentpay.wallet.declare_bank_transfer(amount=500, rail="wire_domestic")
# t["instructions"] holds the account to send to and t["reference_code"] goes in the memo

Full API reference: https://app.agentpay.global (Developer, Docs)

Metadata

Release files for agentpay-global 0.3.0

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

Source distribution (sdist)

Source distribution for agentpay-global 0.3.0
File Size Uploaded Provenance Actions
agentpay_global-0.3.0.tar.gz 4.1 kB Without provenance Details for agentpay_global-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentpay-global 0.3.0
File Interpreter ABI Platform Actions
agentpay_global-0.3.0-py3-none-any.whl Python 3 none any Details for agentpay_global-0.3.0-py3-none-any.whl

Total release size: 9.1 kB

Release files / agentpay_global-0.3.0.tar.gz

Download URL agentpay_global-0.3.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1fa0d3275b6a133fbdef51e773c0f57d76f1afddb2b14e52af11702020288998
BLAKE2b-256 checksum
How to use checksums
dd7411c2ca62b926b70145a2c88a6b8358372473156c2d554359d1eb94cd20f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / agentpay_global-0.3.0-py3-none-any.whl

Download URL agentpay_global-0.3.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eabe9fc29003c4cf7cf3ea8936f24f424966af2f27fbf2e17335e1ae41804c0b
BLAKE2b-256 checksum
How to use checksums
2e64295d8482c54e577a3efa624d2a82837b842fcaa7f3388cab7a25194e429f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Security for agentpay-global 0.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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