Credit swap

    A credit swap exchanges one credit type for another at a set rate, debiting one balance and crediting the other in a single atomic operation. Either both sides happen or neither does.

    How it works

    A swap pair defines the source type, the destination type, the exchange rate, and optionally a fee. When a user swaps, the system checks the source balance, deducts it, and issues the converted amount minus the fee, all in one transaction so a failure cannot leave credits deducted but not received.

    Swaps let products connect separate economies, for example letting loyalty points be turned into paid credits at a discount, or converting a legacy credit type into a new one during a pricing change, while keeping the two types' balances and rules distinct.

    Example

    A pair converts "points" to "credits" at 10:1 with a 5% fee. A user swaps 1,000 points: 1,000 points are deducted, 1,000 ÷ 10 = 100 credits are produced, and 5 go to the fee, so the user receives 95 credits.

    Credit swap in Cred

    Swap pairs define the exchange rate and an optional fee between two credit types in your project; a swap either completes fully or not at all and is recorded in the ledger on both sides.

    Credit Swaps docs

    Questions

    Is a credit swap a financial swap?
    No. It is a conversion between two in-app units in your product, unrelated to financial swap contracts.
    Can swaps run in both directions?
    Only if you create a pair for each direction. Allowing one direction only, such as points to credits, keeps paid credits from being converted into something cheaper.
    How should a swap fee be set?
    Set it high enough to discourage people from cycling credits back and forth for a profit, and low enough that a genuine conversion still feels fair. A one-way conversion may need no fee at all.
    All glossary terms

    Your first credit is
    one request away.

    No card needed to start.

    ai-studio · tokens · last 30 days+146k issued