Skip to content

Events

Events record what happens to passes — field changes, transactions, engagement, loyalty changes, and pass-lifecycle moments. They power analytics, segment behavioral filters, and campaign results.

Auth: All event endpoints require a Bearer token (authentication is enforced inline). Authorization is workspace-scoped: each event is tied to a pass, and the service derives the pass's workspace and verifies the caller's membership.

bash
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

Event Categories

Every event has an event_category and a category-specific event_type:

Categoryevent_type values
field_changefield_updated, field_increment, field_decrement
transactionpurchase, refund (carry amount + currency)
engagementcheck_in, check_out, visit, scan
loyaltytier_promoted, tier_demoted, reward_redeemed, reward_cancelled, reward_used, points_earned, points_spent, points_expired, points_adjusted
pass_lifecyclepass_installed, pass_uninstalled, pass_registered, template_changed

Event Structure

typescript
interface BaseEvent {
  id: string;
  workspace_id: string;
  client_id?: string;
  pass_id?: string;
  project_id?: string;
  pass_template_id?: string;
  event_category: 'field_change' | 'transaction' | 'engagement' | 'loyalty' | 'pass_lifecycle';
  event_type: string;
  event_timestamp: string;
  external_id?: string;   // your dedupe key
  source?: string;
  metadata?: Record<string, unknown>;
}

Category-specific fields: transaction adds amount + currency; field_change adds field_name + old_value/new_value; loyalty may carry amount.

Reference Pages

  • Create — record a single event
  • Batch — create or delete many events
  • Query — list, get-by-id, per-pass, distinct types/sources
  • Aggregate — count/sum/avg/min/max, optionally grouped

Endpoint Index

MethodEndpointPage
POST/wallethero-api/eventscreate
POST/wallethero-api/events/batchbatch
DELETE/wallethero-api/events/batchbatch
POST/wallethero-api/events/aggregateaggregate
GET/wallethero-api/eventsquery
GET/wallethero-api/events/:idquery
GET/wallethero-api/passes/:passId/eventsquery
GET/wallethero-api/events/typesquery
GET/wallethero-api/events/sourcesquery

SDK Example

typescript
import { WalletHero } from "@wallethero/sdk";
const wh = new WalletHero({ apiToken: "YOUR_TOKEN" });

// Record a purchase
await wh.events.recordPurchase("PASS_ID", 49.99, "USD", {
  source: "pos-terminal-1",
  metadata: { order_id: "ORD-12345" },
});

// Query and aggregate
const events = await wh.events.list({ workspace_id: "WORKSPACE_ID", event_category: "transaction", limit: 50 });
const total = await wh.events.getTotalTransactionAmount("WORKSPACE_ID", { time_window: "year" });

WalletHero Documentation