# In-person quests with Solana Pay (/docs/build/solana-pay)



Print a QR code at each station of an event, such as a booth, a door or a stage. A member scans it with their mobile wallet and signs one transaction, and the quest completes for that station. The transaction moves no funds: the member pays only Solana's network fee.

The code points at your app, which serves each station as a [Solana Pay](https://launch.solana.com/docs/solana-pay) transaction request. Domino adds the quest's memo and checks the quest once the transaction lands. Domino doesn't host station URLs for you.

This is experimental: a minor release can change it.

## What members see [#what-members-see]

1. The member opens their wallet's QR scanner and scans the station's code.
2. The wallet shows your app's name and icon, and a message: "Checks you in at North gate for "Check in at our booth"", with a note to sign in to your app first if the wallet isn't linked yet.
3. The member signs. The transaction sends 0 SOL from their wallet to itself and carries the quest's memo.
4. Within about a minute, the quest shows as complete for that station in your app.

```mermaid
sequenceDiagram
    participant M as Member's wallet
    participant A as Your app
    participant S as Solana
    participant D as Domino
    M->>A: GET the station's URL
    A->>D: Read the quest
    A-->>M: Label and icon
    M->>A: POST the member's address
    A-->>M: Transaction with the station's memo
    M->>S: Sign and send
    A->>S: Look for the transaction
    A->>D: Submit it
    D->>S: Read it when final
    D-->>D: Complete the station
```

Solana Pay gives your app no callback after the member signs. Each transaction names a one-time reference account, and your app looks it up on Solana for about 90 seconds after it answers, then hands the transaction to Domino.

## Set it up [#set-it-up]

### 1. Declare the stations [#1-declare-the-stations]

List the stations on the quest, each with a key and a label, and optional opening and closing times. [Check-in stations](/docs/build/wallets#check-in-stations) shows the quest and each rule. Deploy it.

> [!DEV]
> The quest must be one a signed transaction completes: `trigger: manual()`, without input. Use `completion: perStation()` so each member completes each station once. A station's key is what its QR code names, so keep it once the code is printed.

### 2. Serve the stations from your app [#2-serve-the-stations-from-your-app]

Your app needs a server key with **Read** and **Ingest**, as for [blinks](/docs/build/blinks#1-give-the-server-a-key), and a Solana RPC endpoint for the quest's cluster.

> [!DEV]
> `defineStationAction()` from `@domino-sdk/relay/server` returns one handler for the station URL's `GET`, `POST` and `OPTIONS`. In a Next.js app:
>
> ```ts
> // app/api/stations/booth/route.ts
> import { after } from "next/server"
> import { createManagementClient, defineStationAction } from "@domino-sdk/relay/server"
>
> // Covers the lookup (90 s) and Domino taking the transaction (up to 60 s).
> export const maxDuration = 180
>
> const station = defineStationAction({
>   quest: "booth-check-in",
>   rpcUrl: process.env.SOLANA_RPC_URL!,
>   linkUrl: "/quests", // where a member signs in, which links their wallet
>   waitUntil: after, // keeps the lookup running after the response
>   management: createManagementClient({
>     baseUrl: "https://relay.domino.run",
>     getToken: async () => process.env.DOMINO_MANAGEMENT_KEY!,
>   }),
> })
>
> export { station as GET, station as POST, station as OPTIONS }
> ```
>
> In a Worker, call `station(request, env, ctx)`: the handler builds its client from a hosted app's bindings and keeps the lookup running with `ctx.waitUntil`. Cloudflare stops that work 30 seconds after the response, so on a Worker, a [hosted app](/docs/build/hosted-app) included, the lookup and the submission stop after 28 seconds. A member who signs within about 10 seconds checks in; a slower one isn't found and scans again. For an event, serve the stations from a server without that limit, such as a Next.js route with `after`.
>
> | Option | What it does |
> | --- | --- |
> | `rpcUrl` | Reads the latest blockhash and looks up the reference. Each scan makes up to about 45 lookups, every 2 seconds, so use your own endpoint for a busy event: public endpoints limit requests. |
> | `chain` | `"solana"` (mainnet, the default) or the devnet CAIP-2 ID. |
> | `label`, `icon` | What the wallet shows. They default to the quest's title and image. Solana Pay wallets take only an SVG, PNG or WebP icon, so set `icon` when the quest's image is a JPEG. It's a URL or a path on your app. |
> | `instructions` | Instructions to run before Domino's, such as a call to your program. They default to none. Throw `QuestActionRefusal` to refuse the member with a message. |
> | `findTimeout` | How long the lookup runs, in milliseconds. Defaults to 90 seconds. |
>
> `GET` answers `{ label, icon }`. `POST { account }` answers `{ transaction, message }`: a legacy transaction with the member as fee payer, your instructions, a 0-lamport System transfer from the member to themselves that names the reference as a read-only account, and the SPL Memo `domino:quest:<quest key>:<station key>`. Failures answer `{ message }`. Once it finds the signature, the handler submits it with `management.attempts.submitSolanaTransaction()` and sends it again while it isn't final. It logs what fails with `console.error`.

The handler refuses before the member signs when:

| Refusal                                           | Status |
| ------------------------------------------------- | ------ |
| The URL names no station                          | 400    |
| The quest has no station with that key            | 404    |
| The station isn't open now, or you revoked it     | 409    |
| The quest has no stations, is paused or has ended | 422    |

The station URL must be public HTTPS. A hosted app on `*.domino.page` needs [transparent routing](/docs/build/hosted-app#choose-a-routing-mode), since legacy routing refuses `POST`.

### 3. Print the codes [#3-print-the-codes]

In Console, open the quest. Its **Check-in stations** section lists each station. Enter your app's station URL in **App action URL**, then use **Download QR** on a station for an SVG to print or a PNG. Console remembers the URL in your browser for that quest and environment. A station a code proves gets its QR code from Domino instead, linked to your app's scan page: see [stations a code proves](/docs/build/wallets#stations-a-code-proves).

Or write one code per station with the CLI, pointing at the URL your app serves:

```sh
domino quests stations qr booth-check-in --url https://your-app.example/api/stations/booth
```

It writes `<station key>.svg` per station into `booth-check-in-stations/`, with the station's label printed under the code. Each code encodes `solana:` and your URL with `?station=<key>`. Pass `--out` to write elsewhere and `--force` to overwrite. With `--json`, it lists the files and what each encodes. Console and the CLI draw the same code for the same station and URL. When the quest also has [stations a code proves](/docs/build/wallets#stations-a-code-proves), add `--page-url` with your scan page, and the same command writes their files too.

### 4. Test it [#4-test-it]

1. Open the station URL with `?station=<key>` in a browser. It answers the label and icon as JSON.
2. Scan a code with a wallet a member linked, on the quest's cluster, and sign. Check the quest shows as complete for that station in your app.
3. Scan the same code again: the quest stays complete once for that station.
4. Scan with a wallet no member linked to see what an unlinked member sees.

## At the event [#at-the-event]

**Time windows.** A station takes a transaction whose block time falls in its window, between `opensAt` and `closesAt`. A member who signs just before closing still checks in. Your app also refuses to build a transaction for a station that is closed when the member scans, so nobody pays a fee for nothing.

**Once per member per station.** With `perStation()`, a member who scans the same station twice completes it once. A quest with several stations completes once for each.

**Unlinked wallets.** Domino completes the quest only for a wallet a member linked. The wallet's message asks the member to sign in to your app first. If they signed before linking, the check-in doesn't count: they sign in to your app with that wallet, which links it, then scan the code again.

**A check-in that didn't count.** On a quest with stations, only a transaction that names a station completes it, so the quest's **Check** button in your app can't. If your app missed the transaction, for example because it wasn't found within 90 seconds, the member scans again. A station already completed stays completed once.

**A leaked code.** If a station's code is photographed and shared, open the quest in Console and choose **Revoke** on the station, with a reason. From then on Domino refuses every transaction for that station in that environment, even one a member signed before you revoked it, and your app refuses to build one. Completions the station already gave stay. Revoking is not a change to the quest, so it takes effect in live at once, without a promotion, and a promotion never undoes it. **Restore** makes the station take check-ins again. Revoking and restoring need the publish permission, as pausing a quest does, and the audit log records both with their reasons.

> [!DEV]
> `management.quests.stations.revoke(quest, station, { reason })` and `restore(...)` (`POST /management/v1/quests/<quest>/stations/<station>/revoke` and `/restore`, permission `publish`) take the quest's key or ID, a `reason` and an `actionId` (the SDK makes one when you pass none; the routes require it); a retry with the same one answers the first result. They answer `{ quest, station, revoked, reason, actor, changedAt, changed }`, where `changed` is false when the station already was in that state; restoring a station never revoked answers null `reason`, `actor` and `changedAt`. Revoking a key the quest's current release lacks is refused with `404 not-found`; restoring a revoked station that a later release dropped still works. `management.quests.stations.list(quest)` (`GET /management/v1/quests/<quest>/stations`, permission `read`) answers each station of the current release with `status` (`open`, `closed` or `revoked`; read it as open to new values), its last `revocation` or null, and `completions`, the completions check-ins at it earned that still count: a member's repeat check-in counts once, and a revoked completion not at all. A transaction for a revoked station is refused with `409 station-revoked`. In `operations.list()`, a revocation is the operation with `target` `station:<quest ID>:<station key>` and `paused: true`. `defineStationAction` reads it there and answers 409 for a revoked station; it caches the quest for up to a minute, so Domino's own refusal is what takes effect at once. These are experimental: a minor release can change them.

**Replacing a code.** To retire a printed code for good, add a station with a new key and give the old one a `closesAt`, or revoke it. Then print the new code.

## Which wallets work [#which-wallets-work]

The member's wallet must support Solana Pay **transaction requests**, where the wallet asks your app for the transaction. Some wallets support only transfer requests, which send a fixed payment.

| Wallet   | Transaction requests                                                                                                                   |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| Phantom  | Listed as a Solana Pay wallet in [Solana's documentation](https://solana.com/docs/tools/solana-pay). Not tested by Domino on a device. |
| Solflare | Listed as a Solana Pay wallet in Solana's documentation. Not tested by Domino on a device.                                             |
| Backpack | Listed as a Solana Pay wallet in Solana's documentation. Not tested by Domino on a device.                                             |

We found no page in these wallets' own documentation that says whether they take transaction requests, or a transaction that moves no funds. Scan a code with each wallet your members use before the event.

## Guard against farming [#guard-against-farming]

Anyone who knows the station URL can ask for its transaction without being at the event, and a code can be photographed and shared. Domino checks the station's window and completes each station once per member, so the window is your main guard: open each station only while the event runs. Revoke a station whose code leaks, then rotate it.

Each request also costs your RPC endpoint up to about 45 lookups, and anyone can send one. Use an endpoint whose rate limit or plan covers a scripted burst, or put your own rate limit in front of the route.

## Where next [#where-next]

- [Check-in stations](/docs/build/wallets#check-in-stations) — Declaring stations, their windows and what Domino refuses.
- [In-person check-ins with a code](/docs/build/station-codes) — The same stations without a wallet: members scan a QR code that carries the station's code, and your app's scan page checks them in.
- [Quests as blinks](/docs/build/blinks) — The same quest from a Solana Action in an X post or a wallet.
- [Build on Solana](/docs/build/solana) — Every Solana guide in one place.
