Developers

Built for developers who don't want to build prize infrastructure

LuckLogic exposes campaign infrastructure through a straightforward API and SDKs. Use it from your existing backend.

Node.jsPHPREST API

Additional SDKs can be added over time.

Quickstart

Run your first promotion in minutes

Create a test campaign, generate codes and redeem one through the Sandbox environment.

1Install

bash
$ npm install @lucklogic/node

Configure your secret key:

bash.env
$ export LUCKLOGIC_SECRET_KEY=sk_test_...

Secret keys must only be used from your backend. Never expose a LuckLogic secret key directly in a browser or mobile application.

2Create a campaign

TypeScriptcampaigns.create
const campaign = await luck.campaigns.create({
  name: 'Summer 2027',
  window: {
    start: '2027-06-01T00:00:00Z',
    end: '2027-08-31T23:59:59Z'
  },

  mechanic: {
    type: 'winning_moments',
    distribution: 'uniform'
  },

  prizes: [
    {
      tier: 'main',
      name: 'Trip for two',
      quantity: 1
    },
    {
      tier: 'secondary',
      name: 'Festival weekend pass',
      quantity: 500
    }
  ]
});

The campaign initially remains in draft status.

Campaign lifecycle

LuckLogic campaigns can move through a controlled lifecycle.

draft test scheduled live ended archived paused

A live campaign may also be temporarily paused.

Campaign settings that affect production codes or prize allocation can become locked after publication.

3Generate a test batch

TypeScriptbatches.create
const batch = await luck.batches.create(campaign.id, {
  count: 5000,
  length: 10,
  charset: 'anti-smudge'
});

Example:

JSONresponse
{
  "id": "bat_3kq9",
  "status": "ready",
  "count": 5000
}

Test codes behave like production codes but never interact with production prize inventory.

4Redeem a code

TypeScriptredemptions.create
const redemption = await luck.redemptions.create(
  {
    campaignId: campaign.id,
    code: '74KXRP9CQ2',
    participantReference: 'customer-123'
  },
  {
    idempotencyKey: 'entry-239482'
  }
);

Example response:

JSONresponse
{
  "id": "rdm_82jd91",
  "outcome": "win",
  "prize": {
    "id": "prz_2kd91",
    "tier": "secondary",
    "name": "Festival weekend pass"
  },
  "claimToken": "clm_392kd",
  "redeemedAt": "2027-07-14T09:21:04Z"
}

Redemption outcomes

winThe code is valid and the campaign mechanic allocated a prize. A claim is created.
no_winThe code is valid but did not receive a prize.
already_redeemedThe code has already been consumed. No second prize is issued.
invalidThe code does not belong to a valid production or test batch for the campaign.
outside_windowThe campaign is not currently accepting redemptions.
campaign_pausedThe campaign has temporarily stopped accepting redemptions.

Safe retries

Redemption requests support an Idempotency-Key.

Retrying the same operation with the same key returns the original operation result rather than creating another redemption. Code redemption rules are enforced independently. This means:

  • Network retries are safe.
  • The same operation does not generate multiple results.
  • A single-use promotion code cannot create multiple winning redemptions.

Webhooks

Use webhooks to connect LuckLogic with fulfilment systems, CRMs and campaign workflows. Example events:

redemption.winredemption.no_winclaim.createdclaim.approvedclaim.fulfilledclaim.expiredcampaign.pausedbatch.readybatch.revoked

Webhook deliveries are signed and can be retried if your endpoint is temporarily unavailable.

Next steps