Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nippy.la/llms.txt

Use this file to discover all available pages before exploring further.

spin() runs an immediate spin for a user and returns the full result.

Usage

const result = await nippy.spin({
  userId: 'user-123',
  campaignId: 'camp-abc',
  idempotencyKey: 'checkout-789'
})

Parameters

userId
string
required
User identifier from your system. Example: user-123.
campaignId
string
required
Campaign ID. Example: camp-abc.
idempotencyKey
string
default:"generated by the SDK"
Key used to avoid duplicate spins during retries. Example: checkout-789.

Response

spinId
string
Unique spin ID.
outcome
string
Spin outcome. Common values: won_points, lost, won_digital, won_physical.
gift
object
Prize selected by the spin.
gift.giftId
string
Prize ID.
gift.name
string
Display name of the prize.
gift.pointsValue
number | null
Points awarded when outcome is won_points.
animation
object
Data for rendering a deterministic animation.
animation.seed
number
Seed used to reproduce the animation.
animation.durationMs
number
Recommended animation duration in milliseconds.
animation.targetAngle
number
Recommended target angle for the roulette.
inventory.remaining
number
Remaining prize stock. -1 means unlimited inventory.
prizeReservation
object | null
Prize reservation when the result requires claim().
prizeReservation.claimRequired
boolean
Whether you must call claim() to complete delivery.