oc · docs
docs / documentation

@orangecheck/me-client


@orangecheck/me-client / FireEventOptions

Interface: FireEventOptions

Defined in: me-client/src/event.ts:38

Properties

PropertyTypeDescriptionDefined in
<a id="property-action_label"></a> action_label?stringHuman-readable action label that appears on the envelope. Optional but encouraged — it's what the user sees in their /me/activity ledger.me-client/src/event.ts:47
<a id="property-bearertoken"></a> bearerToken?stringThe forwarded user oc_session JWT (the token from the sign-in popup result). Identifies which user earns the cashback when userAddress is not given. Pass it per-call for stateless, concurrency-safe server-side firing — preferred over the process-global setBearerToken when your backend serves many users. A same-origin family integrator (*.ochk.io) can omit it; the oc_session cookie rides automatically.me-client/src/event.ts:93
<a id="property-idempotencykey"></a> idempotencyKey?stringIdempotency key (e.g. a UUID v7 per logical event). A retry with the same key returns the prior event rather than double-billing.me-client/src/event.ts:96
<a id="property-is_agent"></a> is_agent?booleanPer OCHK-V3-PLAN §7 phase-1 · when true, the event was fired by an oc-agent delegation rather than a human acting under their own session. The integrator's IntegratorEventConfig.agent block applies the override (or refuses · 422 agent_refused). Set this when an autonomous agent (oc-agent kind 30084 action envelope) is the source of the event. Don't set it for events the human user clicked themselves.me-client/src/event.ts:62
<a id="property-metadata"></a> metadata?Record&lt;string, unknown>Free-form metadata stored on the envelope. Public — anyone who GETs /api/envelope/<id> sees it. Don't put secrets here.me-client/src/event.ts:53
<a id="property-payment_amount_sats"></a> payment_amount_sats?numberFor percent_of_amount-priced subtypes, the underlying amount the fee is computed against. Required for those subtypes.me-client/src/event.ts:50
<a id="property-project_key"></a> project_keystringYour project_key (e.g. pk_live_yourcompany). Required.me-client/src/event.ts:40
<a id="property-signingsecret"></a> signingSecret?stringThe project's HMAC signing secret. When provided, the SDK signs the request with X-OC-Signature, authenticating the call as the INTEGRATOR. REQUIRED in test mode as well as live — without it the server 401s, because a user session alone proves a user, never the paying project. The one exception is a session that owns the project (the CLI test-fire path), which is not a shape a backend should rely on. SERVER-SIDE ONLY: never ship this secret to a browser. Find/rotate it on the project Keys tab (/me/projects/<id>/keys).me-client/src/event.ts:72
<a id="property-subtype"></a> subtypeEventKeyBillable event key · a built-in subtype OR a custom key defined on your project catalog. Class + label are resolved server-side from the catalog.me-client/src/event.ts:43
<a id="property-useraddress"></a> userAddress?stringWho earns, as their did:oc — the value /api/auth/me returns as did_oc. This is the BACKEND path, and it is the one to prefer. Your server signs the request with signingSecret, the signature covers these bytes, and the earner rides inside them — so the signature is your project asserting "this identity did this on my site". No browser, no user cookie, and no reason for your backend to be holding your users' session tokens at all. REQUIRES signingSecret. A session alone may never name an earner: it proves a user, not a project, and that would let any signed-in caller credit anybody.me-client/src/event.ts:86