Virtual currencies
Quickstart
Thiết lập tiền tệ ảo từ đầu đến cuối: tạo tiền tệ token, cấp token kèm theo gói đăng ký, và tiêu token qua API phía máy chủ.
Create virtual currency
Create a virtual currency in Adapty, link it to products so purchases grant credits, and set whether those credits expire.
Virtual currency balance
See a user's virtual currency balances on their profile and review every balance change in the event history.
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 — for example, to charge tokens per generation.
How it works
- Create a 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.
- Link the currency to products: Map the currency to one-time or subscription products and set how many credits each purchase grants.
- 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.
- Read and spend the balance: Your app reads each user’s balance and grants or spends credits through the server-side API.
- Track every change: Each balance change is listed on the user’s profile.
For a complete walkthrough — from currency setup to spending credits through the API — follow the 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. |
For subscription allowances, turn on credit expiration. 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.
- 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.