Official AbsolutePay API client for Python — payments, payouts, invoices, conversions, off-ramp, gift cards, and signed webhooks.
Project description
absolutepay
Official AbsolutePay API client for Python. Server-side only — your API key and signing secret must never reach a browser.
Every request from an app key is HMAC-signed automatically. Inbound webhooks are verified with one call. Zero runtime dependencies — standard library only.
Install
pip install absolutepay
Requires Python 3.9+.
Environments
| Config | Base URL |
|---|---|
| default | https://api.absolutepay.io (production) |
sandbox=True |
https://sandbox-api.absolutepay.io |
base_url="https://…" |
your override (takes precedence over sandbox) |
Use a dedicated sandbox app (sign up at sandbox.absolutepay.io) with sandbox=True to test end-to-end without moving real funds.
Quickstart
import os
from absolutepay import AbsolutePay
ap = AbsolutePay(
api_key=os.environ["ABSOLUTEPAY_API_KEY"], # ap_live_… / ap_test_…
signing_secret=os.environ["ABSOLUTEPAY_SIGNING_SECRET"], # apisign_… (required for app keys)
# sandbox=True, # → https://sandbox-api.absolutepay.io (default is production)
# base_url="https://…", # optional: override the origin entirely (wins over sandbox)
)
balances = ap.balances.list()
preview = ap.fees.preview(amount="100", currency="USDT")
invoice = ap.invoices.create(
reference="order-123",
amount={"amount": "25.00", "currency": "USDT"},
chain="MATIC", # mint the deposit address up front; omit to let the payer pick
redirect_url="https://shop.example.com/thank-you", # payer returns here when done
)
print(invoice["token"])
Money
Amounts are plain dicts — a decimal string plus a currency code:
{"amount": "10.00", "currency": "USDT"}
Resources
balances · fees · payouts · refunds · conversions · invoices (+ invoices.public) · subscriptions · giftcards · offramp · transactions
# Hosted checkout link — the payer picks which asset/chain to pay with
checkout = ap.invoices.create_checkout(
reference="order-123",
amount={"amount": "25.00", "currency": "USDT"},
)
print(checkout["checkoutUrl"]) # send the payer here; confirm via the payment.succeeded webhook
# Batch payout (idempotent — a retry with the same key never pays twice)
ap.payouts.create(
[{"recipientAddress": "0xabc…", "chain": "MATIC", "amount": {"amount": "5.00", "currency": "USDT"}}],
idempotency_key="payroll-2026-07-01",
)
# Quote + execute a conversion in one call
order = ap.conversions.convert(sell_currency="USDT", buy_currency="ETH", sell_amount="100")
# Ledger, filtered by time range (epoch ms) and paginated
ledger = ap.transactions.list(from_=1_700_000_000_000, to=1_800_000_000_000, limit=50, offset=0)
Errors
Non-2xx responses raise AbsolutePayError:
from absolutepay import AbsolutePayError
try:
ap.invoices.list()
except AbsolutePayError as e:
print(e.status, e.code, e.detail, e.request_id)
if e.is_rate_limited: # 429 — back off and retry
...
if e.is_auth: # 401/403 — bad creds, missing scope, or bad signature
...
Webhooks
Verify the signature and parse the event in one call. Pass the raw request body (bytes or str), the request headers, and your app's callback secret (whsec_…):
from absolutepay import construct_event, WebhookSignatureError
# e.g. in a Flask handler
raw = request.get_data() # RAW bytes — do not re-serialize
try:
event = construct_event(raw, dict(request.headers), os.environ["ABSOLUTEPAY_WEBHOOK_SECRET"])
except WebhookSignatureError:
return "", 400
if event["type"] == "payment.succeeded":
fulfill(event["data"])
return "", 200
The freshness (replay) window defaults to 5 minutes; pass tolerance_ms=0 to disable it.
Security
- Server-side only. The API key + signing secret authenticate as your workspace — never ship them to a browser or mobile app.
- Requests are sent over HTTPS only (except
localhostfor local development). - The
Idempotency-Keyheader (on payouts) is intentionally not part of the signed canonical string.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file absolutepay-0.4.0.tar.gz.
File metadata
- Download URL: absolutepay-0.4.0.tar.gz
- Upload date:
- Size: 34.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ec07b30f4b8387fa900ce06f4cd64a64b625eee16672f5ebe273069ea9d7329
|
|
| MD5 |
302dbf9d07665730aea19bb9f67084b3
|
|
| BLAKE2b-256 |
4dfe78271eb4e5abf0e2db918c37f39c373d07f02578cc5b1a6812ed96a1c268
|
Provenance
The following attestation bundles were made for absolutepay-0.4.0.tar.gz:
Publisher:
release.yml on AbsolutePay/absolutepay-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
absolutepay-0.4.0.tar.gz -
Subject digest:
5ec07b30f4b8387fa900ce06f4cd64a64b625eee16672f5ebe273069ea9d7329 - Sigstore transparency entry: 2066307323
- Sigstore integration time:
-
Permalink:
AbsolutePay/absolutepay-python@675045e7dc89b02789e5feb5ef18ed97d98858d9 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/AbsolutePay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@675045e7dc89b02789e5feb5ef18ed97d98858d9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file absolutepay-0.4.0-py3-none-any.whl.
File metadata
- Download URL: absolutepay-0.4.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aab2c6660f02e1453adcbeb06c3814470bf2a125a53800638c3d665b7dabbd7b
|
|
| MD5 |
369bd499fa0ad7a17e2a9a10f665ff85
|
|
| BLAKE2b-256 |
7ae6cf377fb5c4bfddfd2517285314daab7389e6c4f178291babe19870aa7b8e
|
Provenance
The following attestation bundles were made for absolutepay-0.4.0-py3-none-any.whl:
Publisher:
release.yml on AbsolutePay/absolutepay-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
absolutepay-0.4.0-py3-none-any.whl -
Subject digest:
aab2c6660f02e1453adcbeb06c3814470bf2a125a53800638c3d665b7dabbd7b - Sigstore transparency entry: 2066307402
- Sigstore integration time:
-
Permalink:
AbsolutePay/absolutepay-python@675045e7dc89b02789e5feb5ef18ed97d98858d9 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/AbsolutePay
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@675045e7dc89b02789e5feb5ef18ed97d98858d9 -
Trigger Event:
release
-
Statement type: