Housepass

API

JSON over HTTPS. Amounts are whole cents. Make a key in Dashboard → Developers.

Authorization: Bearer hp_live_…
Idempotency-Key: order-1001      # required on every POST that moves money

Send the same Idempotency-Key again and you get the first result back. Nothing posts twice.

Program

GET /api/v1/program

Your load bonuses, tiers and limits.

Customers

POST /api/v1/customers

{"name": "Dana", "email": "dana@example.com"}   // or "phone"

Returns the customer with id, balance {paid, promo, total}, tier, scan_code and card_url. Send the card URL to the customer.

GET /api/v1/customers?email= | ?phone= | ?scan_code=

GET /api/v1/customers/{id}

GET /api/v1/customers/{id}/ledger

Reloads

POST /api/v1/customers/{id}/loads

{"amount": 5000, "ref": "order-1001"}

Record a reload you already took payment for on your own checkout. The load bonus for the customer's tier is added automatically and returned as bonus.

Purchases

POST /api/v1/customers/{id}/purchases

{"amount": 1250, "method": "wallet", "ref": "ticket-88"}

method: wallet spends the balance (bonus credit first). card, cash or other only records the sale. Both earn cashback at the tier's rate and count toward the next tier. Returns cashback, tier, tier_changed and the new balance.

Reversals

POST /api/v1/reversals

{"operation": "api:order-1001", "memo": "refunded"}

Undoes a whole operation with opposite entries. Nothing is ever edited or deleted. A reload can't be reversed once the customer has spent it.

Webhooks

Set a URL in Dashboard → Developers. We POST:

{"id": "evt_…", "type": "wallet.loaded", "created": 1764700000, "data": {…}}

Types: customer.created wallet.loaded wallet.spent purchase.recorded wallet.adjusted tier.changed operation.reversed ping

Check the Housepass-Signature header: t=<unix>,v1=<hex>, where hex is HMAC-SHA256 of "<t>." + raw body with your signing secret.

import hmac, hashlib, time
def valid(secret, header, body: bytes):
    p = dict(x.split("=", 1) for x in header.split(","))
    if abs(time.time() - int(p["t"])) > 300: return False
    mac = hmac.new(secret.encode(), p["t"].encode() + b"." + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(mac, p["v1"])

Website button

<script src="https://housepass.sophiaxt.com/embed.js" data-shop="your-shop" async></script>

Options: data-label="Reload card", data-position="left".

Errors

400 bad input · 401 bad key · 404 not found · 422 wallet refused (e.g. balance too low) · 429 over 600 requests a minute. Body: {"detail": "message"}.