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

# Currency

Manages an in-game currency balance (wallet) and the store products that sell it.




**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

The page shows an in-game currency wallet and two buttons that deposit into it. GS2-Money2 keeps currency granted for free and currency the player paid for as separate balances, so you can see which balance moves depending on the button you press. Every reading and button on the page is a UI component generated from the package; no demo-specific script is involved.

## How to try it

1. **Your coins** shows **Free balance**, **Paid balance**, and **Total balance**.
1. Press **Deposit** under **Get coins** (labeled **Deposit 100 free coins**); **Free balance** and **Total balance** go up by 100.
1. Press **Deposit** under **Get paid coins** (labeled **Deposit 50 paid coins**); **Paid balance** and **Total balance** go up by 50. This deposit is recorded as a purchase for 120 JPY.

The wallet is shared by every showroom demo, so currency spent in other demos such as the shop is reflected in the balances here.

## GS2 services used

- [GS2-Money2](/microservices/money2/): A GS2-Money2 wallet holds the free and paid balances separately. A paid deposit is recorded with a price and a currency code, which keeps it apart from free deposits.
- [GS2-Exchange](/microservices/exchange/): Two GS2-Exchange rates define the transactions each **Deposit** button runs to deposit into GS2-Money2, executed server-side automatically.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Currency** 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/foundation-economy-currency/packages/foundation-economy-currency
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `foundation-economy-currency/packages/foundation-economy-currency`

## Source code

- Demo project: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-currency/live-demo>
- Feature package: <https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-currency>



