Skip to content

Payments

Tokens are the in-room currency. You start a charge from a visual slot and react to the confirmed payment in the background slot. In the snippets, ext is your createExtHelper() instance.

Charge a viewer for an action

Start the spend in a visual slot, then handle the confirmation in the background slot.

ts
// visual slot (mainGameFun) — only starts the payment
button.onclick = () => {
  ext.makeRequest('v1.payment.tokens.spend', {
    tokensAmount: 50,
    tokensSpendData: { type: 'SPIN' },
  });
};
ts
// background slot — reacts to the confirmed payment
ext.subscribe('v1.payment.tokens.spend.succeeded', async ({ paymentHash, tokensSpendData }) => {
  if (tokensSpendData.type !== 'SPIN') return;
  // ... do something with the confirmed payment
});

TIP

Start the spend in the visual slot, but handle succeeded in the background slot — the visual slot may already be unmounted by the time the payment confirms. The paymentHash you receive here is what authorizes a room-wide broadcast (see Activity and Chat).

What you can unlock after a payment

Once a payment confirms, react to it:

  • Play an overlay reaction for the whole room — see Activity.
  • Announce it in chat — see Chat.
  • Let the viewer join a shared game — see Long-term sessions.

Free action for the model

The broadcaster does not pay. Trigger the same effect directly, without a tokens.spend — there is no payment step for the model. The effect itself (the broadcast + overlay) is the same; see Activity for the model (free) variant.