Examples
This repository includes small runnable scripts and a Flask demo app to help you test common flows quickly.
Setup
python -m venv .venv
source .venv/bin/activate # Windows: .venv\\Scripts\\activate
python -m pip install -U pip
python -m pip install -e ".[dotenv]"
# Export env or create .env at project root
export UNIVAPAY_JWT=...
export UNIVAPAY_SECRET=...
export UNIVAPAY_STORE_ID=...
Scripts
examples/charge_one_time.py
: create a one-time chargeexamples/charge_recurring.py
: create a charge with a recurring tokenexamples/charge_capture.py
: capture a previously authorized chargeexamples/charge_cancel.py
: cancel/void a chargeexamples/refund_create.py
: create a refund (full or partial)examples/refund_list.py
: list refunds for a chargeexamples/subscription_create.py
: create a subscriptionexamples/subscription_get.py
: get a subscriptionexamples/subscription_cancel.py
: cancel a subscriptionexamples/token_check.py
: fetch a transaction token by idexamples/smoke_api.py
: quick connectivity check for APIexamples/smoke_widget.py
: show widget payloads on stdoutexamples/webhook_verify_sample.py
: verify a webhook signature from sample data
Each script supports basic CLI args (see examples/_common.py
).
Flask Demo
Path: examples/univapay_flask_demo/
app.py
: minimal backend with routes to render widget pages and handle server-side calls (charges/subscriptions).env.example
: sample env settings; copy to.env
and fill valuesstatic/
andtemplates/
: example frontend pages using the official widget
Run:
cd examples/univapay_flask_demo
python -m pip install -r requirements.txt
cp .env.example .env # then edit
flask --app app run --debug
Open http://127.0.0.1:5000 to try the demo.