---
title: "Create virtual currency"
description: "Create a virtual currency in Adapty, link it to products so purchases grant credits, and set whether those credits expire."
---

:::link
Main article: [Virtual currencies](virtual-currencies)
:::

To sell virtual currency credits, define a virtual currency once, then link it to your products.

You do this in two steps — both described in this article. Once you link a product, each purchase or renewal grants credits automatically.

## Create a virtual currency

In the Adapty Dashboard, open **Products** > [**Virtual currency**](https://app.adapty.io/virtual-currency).

To create a virtual currency:

1. Click **New virtual currency**. The drawer opens on the **General** step.
2. Fill in the currency details:
    - **Code**: The unique, **permanent** identifier for the currency within your app, such as `COINS`. Identifies the currency in the server-side API and tracks each user's balance.
    
        Use Latin letters, digits, and underscores, up to 32 characters. Lowercase letters are converted to uppercase automatically.
    - **Name**: The display name, such as `Gold`. You can change it later.
    - **Description**: An optional note about the currency.
3. Click **Continue** to move to the **Link Products** step.

:::important
You can't change the currency's **Code** after you create it. You can still edit the **Name** after the fact.
:::

When you introduce a new currency, the starting balance for every user profile is 0.

## Link products

Link a product to a virtual currency so that a purchase or renewal grants credits in that currency. You can link one product to several currencies, and one currency to several products. You can link products now, during the **Link Products** step, or add them later when you edit the currency.

During the **Link Products** step, the **Associated products** section lists the products that grant this currency. To add one, click **Add associated products**, then choose a product.

Each grant adds to the user's balance rather than replacing it, so credits from different products accumulate. The credit settings depend on the product type:

- **Subscription products** have three credit settings:
    - **Credit per cycle** (required): The credits granted at each renewal, including the renewal that converts a trial to paid.
    - **Credit on trial start** (optional): A separate, one-time amount granted when a free trial begins.
    - **Credits expire at the end of each billing cycle** (toggle): When on, Adapty resets unused credits to 0 at each renewal, before it grants the new cycle's credits. When off, credits accumulate across cycles and never expire.
- **One-time products**: Set **Credit amount**, the number of credits granted per purchase. One-time credits never expire.

Click **Save** to create the currency with its product links.

Product links only apply going forward. A newly linked product grants credits from its next purchase or renewal. Adapty does not automatically award the currency to current subscribers — they need to renew the subscription first. When you remove a link, future grants stop, but credits already granted stay.

When the expiry toggle is on, expiring credits follow the subscription lifecycle:

- During billing retry or grace period, Adapty grants no new credits.
- After a cancellation, credits stay until the end of the paid period.
- When the subscription expires, Adapty resets the remaining credits to 0.

## Next steps

After you create a currency and link products, purchases grant credits automatically. From here:

- Track each user's balance on the [Virtual currency balance](virtual-currency-balance) page.
- Grant, spend, and read balances at runtime through the server-side API: [Create virtual currency transaction](api-adapty/operations/createVirtualCurrencyTransaction) and [List virtual currency balances](api-adapty/operations/listVirtualCurrencyBalances). For a worked example, follow the [Virtual currency quickstart](virtual-currency-quickstart).