The short version
xtrade lets players swap in-game currency between browser games. A player in Game A who has coins can trade them for gems held by a player in Game B, at a price the two players agree on. xtrade does not hold anyone's currency. It only passes signed messages between the games and keeps a record of what happened. Each game keeps every balance.
For players
- Open xtrade from your game. A player is let in from inside a game (usually a VIP feature there). The game vouches for who you are with a one-time, short-lived signed link, so xtrade never asks for a password.
- Link your accounts. A swap pays each side in the other game, so you need an account in both. You link them once: press Link in xtrade, sign in to the other game when it asks, and press Confirm. Both games vouch for you, which proves you control both accounts. (A game that has not set up one-click linking uses a short code instead.)
- List an offer. Say what you are selling, what you want in return, and how long the offer stays open (5 minutes to 7 days, 24 hours by default). The amount you are selling is set aside in your game straight away: you cannot spend it elsewhere while the offer is open.
- Someone accepts it. Offers are all-or-nothing, with no part-fills. When another player accepts your offer, their side is set aside in their game too.
- Both sides lock, then settle. Once both amounts are set aside, xtrade tells each game to confirm what it was holding and give it to the other player. You see your new balance in your own game.
- Changed your mind? You can cancel an open offer at any time before it is taken. An expired offer is cancelled automatically and your currency is released.
What if the other player has not linked their account yet?
If either player is missing an account in the other game, nothing is paid out. Both amounts stay safely held for up to 48 hours while they link. If they do, the trade completes. If they do not, both holds are released and everyone gets their own currency back.
The life of a trade
- Offer open
- Taken
- Both sides held
- Confirmed
- Credited
- Done
If anything goes wrong before the confirmation, the holds are released and nobody loses anything. After the confirmation, the trade only moves forward: credits are retried until they are delivered. In the rare case a game definitively refuses a credit, the trade is parked for a human to resolve rather than lost.
Worked example
| Step | Game A | Game B |
|---|---|---|
| Player 1 lists 1,000 coins for 20 gems | 1,000 coins held (not spendable) | – |
| Player 2 accepts the offer | – | 20 gems held |
| Both held: confirm | 1,000 coins confirmed out of Player 1's balance | 20 gems confirmed out of Player 2's balance |
| Credit the other side | Player 2 receives 1,000 coins | Player 1 receives 20 gems |
| Net change in supply | 0 | 0 |
For game owners
Your game stays the source of truth. To take part you do two things.
1. Issue launch tokens
When a player you allow to trade opens xtrade, your server hands their browser a signed token (HS256 JWT, valid for minutes, usable once). It carries your game's name, the player's id in your game, and a display name. You decide who may trade: xtrade does no eligibility checks of its own, so a VIP-only rule is simply "only issue tokens to VIPs".
2. Answer four signed webhooks
| Webhook | What your game does |
|---|---|
reserve | Hold an amount from a player: not spendable, not yet given away. Holds must never expire on their own. |
commit | Confirm the hold: the held amount is final and leaves the player's balance. |
release | Give a held amount back. A refund must never fail. |
credit | Add an amount to a player. Repeating the same key never credits twice. |
Every request is signed with your shared secret (HMAC-SHA256 over a timestamp, a nonce, the path and a hash of the exact body), and your game rejects anything stale or unsigned. Every call is idempotent: retrying the same call is always safe, which is what lets xtrade recover cleanly from timeouts and crashes. A reply only counts as an acknowledgement if it is 200 with {"ok": true}, so a catch-all web page can never accidentally approve a trade.
Controls you keep
- Only currencies you register can be traded. Premium or real-money currencies simply are never registered.
- Caps: a maximum size per offer and a daily total per player, set per currency.
- Pause or freeze: one currency can be paused, or your whole game frozen, at any time.
- Audit trail: every step is written to an append-only, hash-chained ledger that cannot be edited or deleted, so any trade can be reconstructed and any tampering shows.
Getting your game on xtrade
Step 1ApplyFill in the short form with your game, its webhook address and the currency you would like to make tradeable. We approve each game by hand.
Step 2BuildCopy the starter code for the launch token and the four webhooks (Node.js or PHP) and fill in four functions.
Step 3Go livePress one button to run the automatic checks. When they pass, trading switches on.