Accept crypto payments in FastAPI
Add non-custodial crypto checkout to your FastAPI app: create an invoice, send the buyer to the hosted checkout, and fulfill on a signed webhook. Funds settle straight to your own wallet, $0 platform fees.
Install
pip install shieldz
Create an invoice and redirect to checkout
from shieldz import Shieldz
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)
Verify the webhook
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}
Full reference: API docs, SDKs, API reference.
Explore Shieldz
Accept a coin: Bitcoin, USDC, USDT, Zcash.
Compare: vs Coinbase Commerce, vs BTCPay Server, vs CryptAPI, vs NOWPayments, vs Cryptomus, vs BitPay, vs CoinGate, vs OpenNode, vs Plisio, vs BlockBee, vs CoinPayments.
Use cases: For freelancers, For creators, For open-source projects, For online stores, For SaaS, For VPN & hosting providers, For agencies, For nonprofits, For digital sellers.
Build: SDKs, API reference, quickstart. Learn: overview, blog, how it works, supported coins, pricing, is it safe, verify it yourself.