Originally published on shieldz.cash.
Shieldz is a non-custodial crypto payment gateway: the buyer pays an address that belongs to you, funds settle straight to your own wallet, and there is no platform fee. Here is how to add it to a FastAPI app.
1. Create an invoice
from shieldz import Shieldz
from fastapi.responses import RedirectResponse
shieldz = Shieldz(os.environ["SHIELDZ_API_KEY"])
@app.post("/checkout")
def checkout():
invoice = shieldz.invoices.create(amount_usd_cents=5000, memo="Order")
return RedirectResponse(invoice["pay_url"], status_code=303)
The customer lands on a hosted checkout and pays with Bitcoin, USDC/USDT on five chains, or shielded Zcash.
2. Verify the webhook
Shieldz sends an HMAC-signed invoice.paid webhook. Verify the signature before fulfilling:
from shieldz import construct_event, SignatureVerificationError
@app.post("/webhooks/shieldz")
async def webhook(request: Request):
raw = await request.body()
try:
event = construct_event(
raw,
request.headers.get("x-shieldz-signature", ""),
os.environ["SHIELDZ_WEBHOOK_SECRET"],
)
except SignatureVerificationError:
raise HTTPException(400)
if event["type"] == "invoice.paid":
... # fulfill the order
return {"ok": True}
Why non-custodial
- $0 platform fee — you pay only network gas, never a percentage of sales.
- No custody — Shieldz only ever holds a public key, so there is nothing to freeze and nothing to skim. Verify it yourself.
- No KYC to start.
Full guide and API docs: Accept crypto in FastAPI and the API reference.
Top comments (0)