bepaid
Python client for the bePaid payment API (bepaid.by).
Covers the Gateway API (card payments, tokenization, saved-card charges,
capture, void, refunds, payouts, recipient tokenization), the hosted Checkout
API (checkout, payment token, Apple Pay), pay-by-link, the Direct/APM API
(alternative payment methods, balance and currency queries, split payments),
and the Merchant API (reports, channel balances). Built on httpx,
pydantic and cryptography.
Install
uv add bepaid
# or
pip install bepaid
Requires Python 3.10+.
Usage
from bepaid import BepaidClient
from bepaid.models import PaymentRequest, CreditCardRaw
client = BepaidClient("shop_id", "secret_key")
# amounts are strings in minor units, e.g. "700" = 7.00 BYN
payment = client.create_payment(
PaymentRequest(
amount="700",
currency="BYN",
test=True,
description="Order #123",
tracking_id="order-123",
credit_card=CreditCardRaw(
number="4242424242424242",
verification_value="123",
holder="John Smith",
exp_month=10,
exp_year=2030,
save_card=True,
),
)
)
Async
AsyncBepaidClient mirrors the synchronous API and supports async with:
from bepaid import AsyncBepaidClient
async with AsyncBepaidClient("shop_id", "secret_key") as client:
payment = await client.create_payment(...)
# or without the context manager:
client = AsyncBepaidClient("shop_id", "secret_key")
try:
payment = await client.create_payment(...)
finally:
await client.aclose()
BepaidClient is a thin synchronous wrapper around AsyncBepaidClient
(each call runs on a fresh event loop, so it does not reuse connections);
prefer the async client inside an asyncio application.
Authorization with 3-D Secure
auth = client.create_authorization(AuthorizationRequest(amount=700, currency="BYN", ...))
# redirect the customer to auth.redirect_url, then poll for the result:
tx = client.get_transaction(auth.uid)
Hosted checkout
checkout = client.create_checkout(
CheckoutRequest(
transaction_type="payment",
order=CheckoutOrder(currency="BYN", amount=700, description="Order #123"),
settings=CheckoutSettings(
return_url="https://example.com/return",
notification_url="https://example.com/webhook",
),
)
)
# redirect the customer to checkout.redirect_url
Tokenization
token = client.create_token(
CreateTokenRequest(
number="4200000000000000",
holder="John Smith",
exp_month="05",
exp_year="2028",
contract=["recurring"],
)
)
# store token.token, use it later without re-entering card details
APM payments (Direct API)
apm = client.create_apm_payment(
ApmPaymentRequest(
amount=700,
currency="BYN",
payment_method={"type": "erip", "service_no": "0000000001"},
)
)
Webhooks
from bepaid.client import verify_webhook_auth
from bepaid.models import WebhookNotification
assert verify_webhook_auth(authorization_header, shop_id, secret_key)
notification = WebhookNotification.model_validate_json(raw_body)
Examples
Ready-to-run scripts under examples/:
| Example | Run |
|---|---|
payment.py |
SHOP_ID=363 SECRET_KEY=secret uv run python examples/payment.py |
subscriptions.py |
SHOP_ID=363 SECRET_KEY=secret uv run python examples/subscriptions.py |
API coverage
| Group | Operations |
|---|---|
| Gateway | create_payment, create_authorization, capture, void, refund, get_transaction, get_transaction_by_tracking_id, create_p2p, create_payout, charge_saved_card, tokenize_recipient_card |
| Tokens | create_token |
| Checkout | create_checkout, get_checkout_status, validate_apple_pay, create_payment_token, apple_pay_payment |
| Direct | create_apm_payment, apm_refund, apm_full_refund, confirm_apm_payment, get_balance, get_currencies, create_split_payment |
| Pay-by-link | create_product, list_products, get_product, update_product |
| Subscriptions | create_customer, get_customer, list_customers, create_plan, get_plan, list_plans, create_subscription, get_subscription, cancel_subscription, get_plan_payment_link |
| Merchant | get_reports, get_report_count, get_channel_balances |
| Webhooks | verification (Basic auth + RSA Content-Signature) + payload parsing (transaction & subscription) |
License
MIT
Metadata
Release files for bepaid 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bepaid-0.8.0.tar.gz | 16.5 kB | Without provenance | Details for bepaid-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bepaid-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for bepaid-0.8.0-py3-none-any.whl |
Total release size: 34.2 kB
Release files / bepaid-0.8.0.tar.gz
| Download URL | bepaid-0.8.0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d331cd59ad1d13f2678e4e71e3d317053d86d502ccd71a85f8372fb39c160b3
|
|
BLAKE2b-256 checksum How to use checksums |
6f22ef751049774c5731adb7dc3d613d6e259ef7df7526aeff319e39cf2c2c94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / bepaid-0.8.0-py3-none-any.whl
| Download URL | bepaid-0.8.0-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ec2f0558ade475050e34b5639ec9aee65b775a9bdc083570d8c06773d696f75
|
|
BLAKE2b-256 checksum How to use checksums |
660e2dfc5ed60b0e40790b876c9221878211d9ff5a5214c864c0e5c0dc87f0fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for bepaid 0.8.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.