bepaid
Python client for the bePaid payment API (bepaid.by).
Covers the Gateway API (card payments, tokenization, capture, void, refunds),
the hosted Checkout API, and the Direct/APM API (alternative payment methods).
Built on httpx and pydantic.
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,
),
)
)
Use the client as a context manager to close the underlying HTTP connection:
with BepaidClient("shop_id", "secret_key") as client:
payment = client.create_payment(...)
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)
API coverage
| Group | Operations |
|---|---|
| Gateway | create_payment, create_authorization, capture, void, refund, get_transaction |
| Tokens | create_token |
| Checkout | create_checkout, get_checkout_status, validate_apple_pay |
| Direct | create_apm_payment, apm_refund, apm_full_refund |
| Webhooks | verification + payload parsing |
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bepaid-0.1.0.tar.gz
(5.1 kB
view details)
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 bepaid-0.1.0.tar.gz.
File metadata
- Download URL: bepaid-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c801b4312b6b9e3ff98ce3d77fe60207612ae8b18231e5f95bed1cfc819b50e
|
|
| MD5 |
d2b75a68e8855222374f6351fdb59b23
|
|
| BLAKE2b-256 |
83ea198cabd338c1c338ffc732e1adbcd11e1d0a483200ba4886e521785e6192
|
File details
Details for the file bepaid-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bepaid-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4802cff9b6393f3a30b8cfb83bdb073eda6f8689c2da26f6732da1919667c7d7
|
|
| MD5 |
5955d1caf001246c0acc94cbb3df8ad5
|
|
| BLAKE2b-256 |
87de5208b021f2733d3170d5a1ab3b6ec67012a567420c2cbfabc537812a307c
|