Python backend
Download zwipe_client.py into your backend project. It requires Python 3.10+ and uses the standard library. There is no pip install zwipe step and no published Python SDK.
The example caches a token, uses a request timeout, refuses redirects, and retries authentication once after 401. It does not automatically replay a timed-out or failed financial request. Use one instance per worker; add synchronized token storage if sharing across threads.
Read a saved card and balance
Section titled “Read a saved card and balance”import osfrom zwipe_client import ZwipeClient, ZwipeError
zwipe = ZwipeClient( client_id=os.environ["ZWIPE_CLIENT_ID"], client_secret=os.environ["ZWIPE_CLIENT_SECRET"],)
def read_authorized_card(saved_card_id): # First resolve ownership through your application's customer session/database. card = zwipe.get_card(saved_card_id) if card["status"] != "issued": return {"card_id": card["card_id"], "status": card["status"]} balance = zwipe.get_balance(saved_card_id) return {"status": "issued", **balance}Email flow
Section titled “Email flow”def email_is_ready(persisted_email): registration = zwipe.request( "/v1/cardholders/email/check", "POST", {"email": persisted_email} ) if registration["registered"]: return True status = zwipe.request( "/v1/cardholders/email/verification/status", "POST", {"email": persisted_email} ) return status["verified"]If false, let the customer request and enter a code using the email verification flow. Do not start issuance based on sent: true.
Submit a persisted purchase
Section titled “Submit a persisted purchase”def submit_prepared_request(persisted_request): # Caller must authorize/lock the order and persist its submission marker first. # persisted_request contains the complete CardRequest, including its stable external_ref. try: card = zwipe.issue_card(persisted_request) except ZwipeError as error: # Record code/status/request_id, not credentials or the full response. # Reconcile this same order after an unknown outcome. Do not generate a new reference. raise # Save card_id/status durably before acknowledging success to your frontend. return {"card_id": card["card_id"], "status": card["status"]}Implement persistence and background processing as described in the backend guide. A framework request timeout must not discard the order reference. Poll status with a bounded wait and retain pending or in_doubt for later recovery.

