Create the checkout session, attach the buyer's reference and verify signed webhooks from a Django, Flask or FastAPI server. Standard library only — nothing to audit, nothing to pin.
pip install esaalatfrom esaalat import EsaalatClient
# Reads ESAALAT_CLIENT_ID, ESAALAT_CLIENT_SECRET and ESAALAT_WEBHOOK_SECRET.
esaalat = EsaalatClient.from_env()
session = esaalat.create_session(order_id="order-12345", amount=5000)
session["session_token"] # → open the checkout from your page
session["portal_url"] # → or redirect the buyer straight to itfrom esaalat import EsaalatWebhookError
@app.post("/esaalat/webhooks")
def esaalat_webhook():
try:
event = esaalat.verify_webhook(
request.data, # the RAW body
request.headers["X-Esaalat-Signature"],
)
except EsaalatWebhookError:
return "", 400 # anything but 2xx retries
if event["event"] == "payment.verified":
release_order(event["order_id"]) # idempotent on intent_id
return "", 200exp a minute early, so an integration does not start returning 401s at the hour boundary.429 or a timeout cannot create the same order twice.429, 5xx and network failures, honouring Retry-After.| Argument | Environment variable | Default |
|---|---|---|
client_id | ESAALAT_CLIENT_ID | required |
client_secret | ESAALAT_CLIENT_SECRET | required |
webhook_secret | ESAALAT_WEBHOOK_SECRET | needed by verify_webhook |
base_url | ESAALAT_BASE_URL | https://api.esaalat.com/api/v1 |
timeout | — | 20 seconds |
max_retries | — | 2 |
urllib, hmac and json from the standard library.format_amount(5000.5) refuses before the request is sent.