/xsolla-ai-kit:webhooks-implfrom xsolla-ai-kit
Builds and validates a backend endpoint that receives Xsolla webhooks for user_validation, order_paid, refunds, and cancellations. Covers signature verification, idempotency, retries, and testing.
Ships in xsolla-ai-kit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill is a draft authored by the webhooks SME (@e.chernykh).
Detailed material lives in references/:
references/events-and-payloads.md — delivery modes, event types, payload JSON, refund codesreferences/signature-verification.md — SHA-1 algorithm + Node/PHP examplesreferences/handler-and-reliability.md — responses, idempotency, retries, IP allowlist, fulfillment (ask how goods are granted), full handlerreferences/testing.md — fixture replay vs live tunnel; when payment vs order_paid arrivesfixtures/ — sample user_validation / order_paid / payment bodies (+ .raw.txt)Use this skill when the developer wants to receive and process Xsolla
webhooks on their own backend. The player pays in a payment UI such as
Headless Checkout or Pay Station. That UI does not receive webhooks. Starting
to pay makes Xsolla call the merchant or developer for user_validation. A
completed payment makes Xsolla call again so the merchant or developer can
grant the item. Trigger conditions:
INVALID_SIGNATUREuser_validation, payment / order_paid, refund /
order_canceled, or subscription eventsThis skill covers handler implementation and how to test it. Enabling
webhooks + creating the secret in Publisher Account is a manual step in
Prerequisites below (not done by merchant-setup). Setting the live URL is
covered in references/testing.md.
export XSOLLA_WEBHOOK_SECRET=<project webhook secret key> # server-side only, never client-side
export XSOLLA_ENV=sandbox # default; "production" for prod
The agent cannot create the secret in PA. Ask the developer to:
Open project webhooks (ids from .env per merchant-setup):
https://publisher.xsolla.com/{XSOLLA_MERCHANT_ID}/projects/{XSOLLA_PROJECT_ID}/edit/webhooks
Create / generate the webhook secret key (project secret used to sign notifications).
Enable webhooks for the project (Store / required notifications as shown in PA).
Put the secret in the backend .env (never the browser / never commit real values):
XSOLLA_WEBHOOK_SECRET=<the key from PA>
Later set the listener URL (HTTPS) — local tunnel or deployed host — under the
same webhooks settings (store path often
.../edit/webhooks/store). See references/testing.md.
Without the secret in .env, signature verification always fails. Without
webhooks enabled + a reachable HTTPS URL, Xsolla never delivers live events
(fixtures still work for local replay).
Also needed:
Know your delivery mode. Projects registered after 2025-01-22 get
combined webhooks (order_paid / order_canceled carry items + payment);
older projects get separate (payment + refund plus order_paid /
order_canceled). The JSON differs per mode — see
references/events-and-payloads.md.
Capture the raw body and verify the signature first. The authorization
header is Signature <40-hex>; recompute lowercase(sha1(rawBody + secret))
and compare in constant time. Reject mismatches with 400 INVALID_SIGNATURE.
Full Node/PHP examples: references/signature-verification.md.
Route by notification_type and fulfill:
user_validation → confirm the user exists; 204 if yes, 400 INVALID_USER if no.order_paid → grant purchased goods (idempotently). order_canceled → revoke
per the developer’s policy.payment / refund also arrive — treat them as financial
records only; do fulfillment on order_* to avoid double-granting.payment without a Store order — then fulfill
on payment if that is the only success signal (see testing.md).references/handler-and-reliability.md (Fulfillment).Make fulfillment idempotent. Dedupe by transaction id
(billing.transaction.id combined, transaction.id separate) using a unique
constraint; on a duplicate, return the prior 2xx without re-granting.
Respond correctly and keep it fast. 200/201/204 = success, 400 (+ error
code) = permanent reject, 5xx = transient (Xsolla retries). Target < 3s; do
heavy work async. Webhooks are delivered sequentially — a failing handler
blocks the rest of the flow.
Harden and test. Allowlist Xsolla's source IPs (still verify the signature).
Prefer fixture replay for signature / routing / idempotency; use a public
tunnel + sandbox purchase (developer sets the URL in PA) for live delivery.
See references/testing.md.
INVALID_SIGNATURE.200 on a bad signature — breaks Xsolla's setup test and hides
attacks. Return 400 INVALID_SIGNATURE.payment and order_paid in separate mode.
Dedupe by transaction id and fulfill only on order_*.5xx — it triggers up to 48h of retries for errors that will
never succeed. Use 400 for permanent problems, 5xx only for transient ones.user_validation — a failing/slow validation handler
blocks every downstream payment webhook; the user sees an error.Prompt: "Implement an Xsolla webhook handler that grants items after purchase. Use Node.js/Express."
Result: the agent discovered and applied this skill (read SKILL.md + references,
including testing.md / fixtures), asked how goods are granted in the product,
scaffolded a raw-body Express endpoint, and smoke-tested with fixture POSTs:
lowercase(sha1(rawBody + secret)) rejecting tampered bodies with
400 INVALID_SIGNATURE; user_validation returning 204/400 INVALID_USER;
idempotent order_paid granting (replay returned 2xx with no re-grant); no
double-grant in separate mode (payment recorded only); 5xx reserved for
transient errors. ✅
fixtures/order_paid.json (opens in a new tab)fixtures/order_paid.raw.txt (opens in a new tab)fixtures/payment.json (opens in a new tab)fixtures/payment.raw.txt (opens in a new tab)fixtures/user_validation.json (opens in a new tab)fixtures/user_validation.raw.txt (opens in a new tab)references/events-and-payloads.md (opens in a new tab)references/handler-and-reliability.md (opens in a new tab)references/signature-verification.md (opens in a new tab)references/testing.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub xsolla/xsolla-ai-kit --plugin xsolla-ai-kit15 skills in this plugin
/catalog-designSets up an Xsolla catalog: virtual items, virtual currency and its packages, bundles, game keys, item groups, regional prices and LiveOps offers, plus the client purchase flow (buy by SKU or cart, buy for virtual currency, order status). Use for "set up my Xsolla catalog", "create virtual items", "sell game keys", "regional prices"./description-to-shopTurns a game description or store listing (App Store, Google Play, Steam) into the shop brief that shop-builder-assembly builds from. Reached through nocode-shop-setup; not an entry point. Owns intake and inference only: presets, confirmation, CLI writes and preview belong to shop-builder-assembly./game-web-portalBuilds or resumes an unpublished Game Web Portal for a PC or mobile game: Home, News, Rewards, Web Shop, Community and an optional Launcher, on a site made from the Multi-page web portal template. Reached through nocode-shop-setup. Use for "continue my Game Web Portal" or "add the Community section". Never publishes; that stays with the human. Not for XLA Pages on x.la; use `xla-pages`./headless-checkout-integrationIntegrates Xsolla Headless Checkout — a fully customizable, client-controlled payment UI built on the @xsolla/pay-station-sdk JavaScript SDK, where payment data stays isolated in secure iframes and payments run through Xsolla without the standard Pay Station./login-setupIntegrates Xsolla Login (Xsolla ID, NewID): sign-up and sign-in by password, email or SMS code, social networks, Steam, Xbox, PSN, Epic, device or custom ID; Login Widget, API or SDK; JWT validation, server tokens, account linking, MFA, password reset. Use for "integrate Xsolla Login", "add sign-in", "validate a user JWT", or when a feature needs a signed-in user./login-stylingStyles the Xsolla Login widget (sign-in, sign-up, password reset): upload custom CSS through the API and attach it to the login project, or set colors, logo, background and social order through themeJSON. Use for "style the login", "brand the sign-in screen", "upload login CSS", "dark-mode login". Pairs with login-setup, which wires the auth flow.Other plugins' skills for the same job