Appearance
Buy-Features
A buy-feature lets a player pay a fixed price for direct entry into a bonus feature (for example, free spins). The player does not need to trigger the feature in the base game.
How It Works
You configure buy-features separately for each game. The engine configuration specifies which features a player can buy. Each entry references a feature entry. At startup, the engine calculates:
- The buy price. The engine calculates this so the buy-feature RTP (return to player) matches the total game RTP.
- The expected spin count, including retriggers.
Getting Available Buy-Features
The loadConfig response includes the buy-features:
typescript
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 }:
typescript
// 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 the engine awards on the 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. The client only needs to pass the feature ID:
typescript
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,
config,
});
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) to show the total cost. You do not need to send it back to the engine.
TIP
response.result.engineData.buyFeatureId echoes back feature.id on this reply. It also echoes on every later reply for the round, including continuations and collect. See Endpoints for the full field reference.
Next Steps
- Response Handling - Handle the multi-step round after purchasing.
- Gamble Features - Other post-win features.
- Freeplays - Spending an operator-granted ticket instead of buying a feature.
- Endpoints -
placeBetparameter reference.