---
title: "Virtual currencies"
description: "Define in-app currencies in Adapty, link them to products to grant credits automatically, and track a balance for every user."
---

<CustomDocCardList ids={['virtual-currency-quickstart', 'create-virtual-currency', 'virtual-currency-balance']} />

Grant your users virtual currency — AI tokens, credits, or coins — when they buy products or renew subscriptions. Define a currency once, link it to the products that should award it, and Adapty credits each user automatically and keeps their balance. Your app reads and spends that balance through the [server-side API](getting-started-with-server-side-api) — for example, to charge tokens per generation.

## How it works

1. [Create a virtual currency](create-virtual-currency): Open **Products** and click the **Virtual currency** tab. Click **New virtual currency**. Define a currency with a code, a name, and an optional description.
2. **Link the currency to products**: Map the currency to one-time or subscription products and set how many credits each purchase grants.
3. **Credits are granted automatically**: When a user buys a linked one-time product or renews a linked subscription, Adapty adds the configured credits to their balance.
4. **Read and spend the balance**: Your app reads each user's balance and grants or spends credits through the server-side API.
5. **Track every change**: Each balance change is listed on the [user's profile](virtual-currency-balance).

For a complete walkthrough — from currency setup to spending credits through the API — follow the [Virtual currency quickstart](virtual-currency-quickstart).

## Use cases

| App type | How to use virtual currencies |
|----------|-------------------------------|
| **AI apps** (image, video, or text generation) | Charge credits per generation. Include a monthly credit allowance in the subscription and sell credit packs as one-time products. |
| **Short drama and video apps** | Charge coins to unlock an episode. Grant subscribers a recurring coin allowance and sell coin packs as one-time products. |
| **Language learning and education** | Give free users a limited allowance of hearts or lives through the server-side API. Grant a larger allowance, or skip the balance check entirely, on a paid plan. |
| **Mobile games** | Run a soft and a hard currency side by side: grant gold for gameplay through the server-side API, sell gems for money, and convert between them in a single atomic transaction. |
| **Productivity apps** | Meter expensive actions, such as OCR or exports, with credits. Give free users a small allowance, grant more with a subscription, and sell credit packs for batch work. |

:::tip
For subscription allowances, turn on [credit expiration](create-virtual-currency#link-products). When unused credits reset at each renewal, the allowance stays a reason to keep the subscription, and heavy users buy credit packs instead of spending down a stockpile.
:::

## Limitations

- **Cross-device access requires identification**: A balance belongs to one profile. An anonymous user keeps their balance on the device where they earned it, so identify users to make their balance available on every device. See [Balances, profiles, and devices](virtual-currency-balance#balances-profiles-and-devices).
- **Server-side only**: There is no SDK method to read or spend a balance yet, so your app needs a backend. It reads balances and grants or spends credits through the server-side API.
- **Up to 20 currencies per app**: You can create up to 20 virtual currencies in one app.