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 docsRelated terms
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.