ripllo.discount_code.created.v1

Fires when a new discount code is created — either via the API, the dashboard, or as a side-effect of a referral fulfilment.

Reserved — not currently emitted in v1. Ripllo creates discount codes synchronously and exposes them through GET /api/v1/discount-codes, but the outbox event isn't wired up yet. Subscribe defensively; for now, poll the list endpoint or trigger off your own create-call return value.

When it will fire

When a new DiscountCode row is committed, regardless of origin:

  • POST /api/v1/discount-codes — merchant or partner-platform API call.
  • Dashboard "Create code" form — routes through the same API.
  • Referral fulfilment — mints a reward code as a side-effect. The event fires for the reward code creation alongside referral.fulfilled.

The event fires once per code, in the same transaction as the insert.

Anticipated payload

{
  "id": "evt_01HX...",
  "type": "ripllo.discount_code.created.v1",
  "createdAt": "2026-05-13T10:43:22.187Z",
  "accountId": "acc_01HX...",
  "data": {
    "code": {
      "id": "dc_01HX...",
      "accountId": "acc_01HX...",
      "code": "WELCOME10",
      "type": "percent",
      "value": 1000,
      "currency": "IDR",
      "scope": "cart",
      "minPurchaseAmount": null,
      "maxUsesTotal": null,
      "maxUsesPerCustomer": 1,
      "startsAt": null,
      "expiresAt": "2026-06-30T23:59:59.000Z",
      "active": true,
      "public": true,
      "createdAt": "2026-05-13T10:42:00.000Z"
    },
    "source": {
      "kind": "api",
      "actor": "akey_01HX..."
    }
  }
}

The source block is the planned-but-not-final differentiator: it tells you whether the code came from a regular API call (kind: "api"), the dashboard (kind: "dashboard"), or referral fulfilment (kind: "referral_fulfilment", with attributionId populated). The exact shape may change before emission ships.

What to do (when it ships)

  • Index for search. Mirror to your own search service so the dashboard's code-finder has a fast index.
  • Audit. Pair with source to track who created what.
  • Auto-tag in your CRM. When the source is referral_fulfilment, tag the referrer with "earned a reward" attribute.

Until then

The list endpoint with a createdAfter filter (planned for v1.1) is the closest available substitute. For now, the only way to detect new codes asynchronously is to poll GET /api/v1/discount-codes and diff against your local store. Inefficient at scale; mostly only matters if you have parallel automations creating codes outside your own integration.

If you're the only one creating codes (typical for a single-integration deployment), just track creation on your side at the point you call POST /discount-codes — no event needed.

Next