Skip to content

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 })[]
FieldTypeDescription
idstringFeature identifier
featurestringFeature name that maps to the feature entries in the engine configuration
pricenumberBuy price as a multiplier of stake. A price of 100 means the feature costs 100x the stake amount
featureRTPnumberThe expected return percentage when buying this feature
initialSpinsnumberNumber 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