---
name: add-crypto-to-your-game
description: The end-to-end path for putting a game, app or site on crypto with Chain Daddy - pick or launch a token, sell items for it, sign players in with their wallet, verify purchases on your server, and run it all on a no-money test store first. Use when someone wants to add a token, sell in-game items for crypto, give holders perks, or "add crypto" to a game, app or dApp.
license: MIT
---

# Add crypto to your game or app

Chain Daddy gives a token a verified page and a **store**: items you sell for that token, a record of what
each wallet owns, and a signed receipt for every purchase. Your game reads what a player owns; it never
moves money.

## How it fits together

```
your token ── its page on chaindaddy.io ── its store (items, what each wallet owns, receipts)
                                               │
          your game client ── asks to buy ─────┤  the buyer's wallet pays your payout wallet on chain
                                               │
          your server ── store key ────────────┘  creates orders, verifies receipts, spends items
```

1. **Money never passes through your code.** The buyer's wallet pays the token's payout wallet directly,
   in one on-chain transaction. Chain Daddy then grants the item and signs a receipt.
2. **The client asks, the server decides.** Anything with value (spending credits, a ranked result, a
   prize) is decided on your server, with a store key only the server holds.
3. **Test first.** A test store runs the whole loop with no wallet, no chain and no money.

## What the human needs first

Check these before writing code, and stop with a clear next step if one is missing:

| Need | How to check | If missing |
|---|---|---|
| A token page they own or manage, and its **chain key** (`base`) and **crown id** (the registration id) | `find-and-check-a-token` skill | Import a token they made elsewhere, or `launch-a-token` |
| A plan that can open a store: Developer, Partner or Enterprise, or Developer Beta Program membership | `GET https://api.chaindaddy.io/api/v2/iap/eligibility` (signed in) | Any paid plan, then sign the agreement at https://chaindaddy.io/_developer |
| Signed in on this computer | `chaindaddy whoami` | They run `chaindaddy login` and approve in the browser (any wallet or email/social sign-in); the CLI and the local MCP server both use it. A server or CI job gets a `cd_live_…` key instead (`chaindaddy keys create`) |

Never ask the human to paste a key into the chat. Ask them to set it as an environment variable.

## The path

### 1. Pick the token

- **Their own token, made elsewhere:** they import it on chaindaddy.io (one fee, or free for established
  tokens). A store can only sell for a token whose page the wallet owns or manages.
- **A new token:** see `launch-a-token`. A token launched in a Chain Daddy launchpad pool pays **0%** on
  store sales; any other token pays **2.5%**, taken out of the price at checkout.

### 2. Decide where the game runs

| The game runs… | How it sells | Skill |
|---|---|---|
| On the token page, as a Crown App | Sends the `iap-purchase` action; the page shows its own purchase sheet and handles the wallet. No server or payment code needed | `build-a-crown-app` |
| In your own site, app or client | Your server creates an order; your client pays with the order's `payment` block | `sell-items-in-your-app` |
| Anywhere, with no code | A payment link: `https://chaindaddy.io/<symbol>/<chain>?buy=<sku>` | `sell-items-in-your-app` |

### 3. Design the catalog

| Type | Use it for |
|---|---|
| `non_consumable` | Owned for good, one per wallet: a skin, a badge, a level pack |
| `consumable` | Used up: credits, boosts. A bundle `grants` other items |
| `timed` | Access for a while: a season pass, a rental |
| `unlock` | Never sold. Held while a rule holds, e.g. "holds at least 1,000 tokens" |

Put what the game needs to apply an item in its `metadata`: that JSON is the contract between the store and
the game. Price in dollars (`priceUsdMicros`, with `minPrice` / `maxPrice` bounds) and take payment in the
token, so prices don't swing with the market.

### 4. Build against the test store

Open the test store beside the live one (`iap_open_test_store` / `chaindaddy iap store test <storeId>`), make
a `cd_iap_test_…` key on it, then run the whole loop: create an order, pay it with `iap_test_pay`, verify the
receipt (`livemode: false`), read and spend the items, and receive the webhook. Details in
`sell-items-in-your-app`.

### 5. Know who the player is

- In a Crown App: the `session-token` action gives a short-lived token your server verifies.
- On your own site or app: Sign in with Chain Daddy (standard OpenID Connect) - see `sign-in-with-chain-daddy`.

Both identify the player by wallet (`sub`). Key accounts by that wallet.

### 6. Verify on your server

Verify every receipt and session token on the server before acting on it - see `verify-receipts-and-sessions`.
Deliver on `confirmed`, credit each `orderId` once, and treat the store's item ledger
(`GET …/entitlements?wallet=`) as the source of truth.

### 7. Go live

Switch the server to the live store's key. Read the store id from the key (`GET /api/v2/iap/stores` with a
store key returns its own store) so nothing else changes. In production, check `storeId` is the live store and
`livemode` is `true`.

To pay out real tokens as prizes, see https://docs.chaindaddy.io/developer/token-prizes (live stores only).

## Mistakes to avoid

- Granting an item on `paid`. `paid` means the payment is on chain but still confirming. Deliver on `confirmed`.
- Trusting a receipt or session token because the client sent it. Verify it on the server, every time.
- Shipping a store key, account key or webhook secret in client code, a repo or a log.
- A new random idempotency key on each retry. Build it from something stable (`user-42-milestone-10`).
- Items with a random outcome (loot boxes, mystery boxes): not allowed.
- Describing items as money. They can't be transferred between wallets or exchanged for tokens or cash.
- Asking for a private key or seed phrase, or sending a transaction for the human. They sign in their own wallet.

## Docs

- Store and rewards: https://docs.chaindaddy.io/developer/store-and-rewards
- Test your integration: https://docs.chaindaddy.io/developer/test-your-integration
- Build a game: https://docs.chaindaddy.io/developer/build-a-game
- Everything, for an agent: https://docs.chaindaddy.io/llms.txt (raw pages at `/md/<path>.md`)
