> For the complete documentation index, see [llms.txt](/llms.txt)

# Serial Codes

Redeems serial codes you hand out, organized into campaigns.




**About this demo**

The demo signs in automatically with an anonymous account. The account is shared across every demo in the showroom, so items and currency you get in one demo carry over to the others. Loading takes a moment. If the frame is too small, open the demo in a new tab.

## Overview

Type a campaign code and get a reward. Enter `WELCOME2026` in the field under **Redeem a campaign code** and press **Redeem**; 100 coins land in the wallet under **Where the coins land**. Each visitor can redeem once, and a second try or a wrong code is refused with the reason.

## How to try it

1. Read the rule under **Redeem a campaign code** and the redemption status ("You have not redeemed a code yet.").
1. Type `WELCOME2026` into the field (**Type a code**) and press **Redeem**; **Free balance** under **Where the coins land** goes up by 100.
1. Press **Redeem** again; it is refused with "You have already redeemed a code; each visitor can redeem once." and no coins are added.
1. Press **Start over** to clear your redemption so you can redeem again.
1. Type a wrong code such as `welcome2026` and press **Redeem**; it is refused because GS2 does not know the code (codes are case sensitive).

## GS2 services used

- [GS2-SerialKey](/microservices/serial_key/): The GS2-SerialKey campaign `WELCOME2026` is registered as a campaign code, and the redemption transaction checks the typed code against it.
- [GS2-Exchange](/microservices/exchange/): A GS2-Exchange rate bundles the code use, the redemption count and the coin deposit into one transaction that commits only if all succeed; **Start over** is another exchange rate.
- [GS2-Limit](/microservices/limit/): A GS2-Limit counter (maximum 1, never resets) counts the redemption and refuses a second one; **Start over** deletes that counter.
- [GS2-Money2](/microservices/money2/): The 100-coin reward is deposited into the GS2-Money2 wallet as free currency.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Serial Codes** to bring this feature into your own project. To point at the package directly, choose **Add from GitHub** and enter the package below.

```text
https://github.com/gs2io/gs2-studio-package/tree/main/micro-liveops-serial-code/packages/micro-liveops-serial-code
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `micro-liveops-serial-code/packages/micro-liveops-serial-code`

## Source code

- Demo project: <https://github.com/gs2io/gs2-studio-package/tree/main/micro-liveops-serial-code/live-demo>
- Feature package: <https://github.com/gs2io/gs2-studio-package/tree/main/micro-liveops-serial-code>



