Buy-Features
Buy-features allow players to purchase direct entry into a bonus feature (e.g., free spins) for a fixed price, bypassing the base game trigger.
How It Works
Buy-features are explicitly configured per game. The engine configuration specifies which features can be purchased, referencing the feature entries. At startup, the engine calculates:
- The buy price (calculated so buy-feature RTP matches total game RTP)
- Expected spin count including retriggers
Getting Available Buy-Features
Buy-features are included in the loadConfig response:
const response = await loadConfig({ backendURL, token: sessionToken });
if (response.success) {
const buyFeatures = response.result.config.buyFeatures;
if (buyFeatures?.length > 0) {
for (const feature of buyFeatures) {
console.log(`Feature: ${feature.id}`);
console.log(` Price: ${feature.price}x stake`);
console.log(` Initial spins: ${feature.initialSpins}`);
}
}
}Buy-Feature Option Type
Each entry in config.buyFeatures is IBuyFeatureOption & { id: string }:
// Base type
interface IBuyFeatureOption {
feature: string; // Feature name referencing the feature entries
price: number; // Buy price as multiplier of stake
featureRTP: number; // Feature RTP percentage
initialSpins: number; // Spins awarded on initial trigger
}
// In config.buyFeatures, each entry also has an `id` field:
// (IBuyFeatureOption & { id: string })[]| Field | Type | Description |
|---|---|---|
id | string | Feature identifier |
feature | string | Feature name that maps to the feature entries in the engine configuration |
price | number | Buy price as a multiplier of stake. A price of 100 means the feature costs 100x the stake amount |
featureRTP | number | The expected return percentage when buying this feature |
initialSpins | number | Number of spins awarded on initial trigger (before retriggers) |
Purchasing a Feature
To buy a feature, call placeBet with featureToBuy. The engine computes the price from the stake and the configured price multiplier, so clients only need to pass the feature ID:
const feature = buyFeatures[0]; // e.g. { id: 'freespin', price: 100 }
const currentStake = config.stakes[selectedStakeIndex];
const response = await placeBet({
backendURL,
token: sessionToken,
stake: currentStake,
featureToBuy: feature.id,
});
if (response.success) {
const gameResult = response.result.result;
// You're now in the feature - handle like any multi-step round
if (gameResult.engineData.inProgress) {
// Continue with placeBet({ backendURL, token: sessionToken })
}
}TIP
feature.price is a multiplier of stake — use it for UI display (feature.price * currentStake) when you need to show the total cost. You do not need to pass it back to the engine.
Next Steps
- Response Handling - Handle the multi-step round after purchasing.
- Gamble Features - Other post-win features.
- Endpoints -
placeBetparameter reference.