Embed in 5 steps
The whole Embed integration is five points of contact. Inside the frame Parity draws the markets, the ticket and the positions; you build these five.
1. Mint a session on your server
Your server exchanges your API key for a short-lived token a browser may hold. The API key never leaves your server.
POST /api/v1/embed-sessions
Authorization: Bearer <your Parity API key>
Content-Type: application/json
{
"externalUserId": "acme-user-1234",
"returnOrigin": "https://acme.example"
}2. Mount the iframe and hand it the token
The frame carries no credential. It asks your page for one, and your page answers with the token from step 1. Never put the token in the URL.
<iframe
src="https://<your-parity-host>/embed/predictions?operator=acme-casino"
title="Predictions"
style="width:100%;height:100%;border:0"
></iframe>3. Reserve, confirm or release in your ledger
When the player buys, your server records the order and receives the exact amount to reserve. Hold it in your own ledger, then confirm. If it does not fit, cancel the order and release.
POST /api/v1/orders record the intent
reserve authorizationAmount in YOUR ledger
POST /api/v1/orders/{orderId}/confirm-reserve "the funds are held"
POST /api/v1/orders/{orderId}/cancel or release and decline4. Credit settlements
When a market resolves, each settlement record carries the exact amount to credit. Apply it once, keyed on the settlement id, and page until there is no more.
GET /api/v1/settlements
Authorization: Bearer <your Parity API key>
credit operatorMoney.settlementCredit (a winner)
or operatorMoney.voidCredit (a cancelled market)
stop on hasMore: false, never on the cursor5. Listen to webhooks
Signed events tell you as orders fill, cancel and settle. Verify the signature on every delivery, and never let a webhook be the only way you learn about money.
content-type: application/json
parity-signature: t=1755751331,v1=<hex hmac-sha256 of "<t>.<body>">
parity-event-type: position.settled