Skip to content

Request Types

Request types are exported from @wallethero/sdk. Prefer importing them over maintaining local copies.

Client requests

typescript
import type { CreateClientRequest, UpdateClientRequest } from "@wallethero/sdk";

const customer: CreateClientRequest = {
  workspace_id: "workspace-uuid",
  first_name: "Jane",
  email: "[email protected]",
  marketing_consent: true,
  marketing_consent_text: "I agree to receive loyalty updates.",
  loyalty_program_enabled: true,
  custom_fields: { member_number: "M-1042" },
};

Consent timestamps and consent source are server-stamped. A client may be enrolled with a current or backdated loyalty_program_registration_date.

Pass requests

Passes do not own identity or custom fields.

typescript
import type { CreatePassRequest, UpdatePassRequest } from "@wallethero/sdk";

const withExistingClient: CreatePassRequest = {
  workspace_id: "workspace-uuid",
  project_id: "project-uuid",
  pass_template_id: "template-uuid",
  client_id: "client-uuid",
};

const withInlineIdentity: CreatePassRequest = {
  workspace_id: "workspace-uuid",
  project_id: "project-uuid",
  pass_template_id: "template-uuid",
  client_identity: {
    email: "[email protected]",
    first_name: "Alex",
    phone: "+48123456789",
    marketing_consent: true,
    custom_fields: { member_number: "M-1043" },
  },
  enroll_loyalty_program: true,
};

Pass-template requests

CreatePassTemplateRequest includes all writable PassTemplate fields and requires the core entity fields:

typescript
import type { CreatePassTemplateRequest } from "@wallethero/sdk";

const template: CreatePassTemplateRequest = {
  uuid: crypto.randomUUID(),
  name: "Coffee Rewards",
  pass_type: "LOYALTY",
  apple_pass_type_identifier: "pass.com.example.coffee",
  workspace_id: "workspace-uuid",
  project_id: "project-uuid",
  barcode_type: "qr",
  barcode_id: "${client.id}",
  top_field_label: "POINTS",
  top_field_value: "${wallet.points}",
  front_fields: [
    { label: "Member", value: "${client.first_name}" },
  ],
};

Campaign requests

typescript
import type {
  CreateCampaignActionRequest,
  CreateCampaignRequest,
} from "@wallethero/sdk";

const campaign: CreateCampaignRequest = {
  workspace_id: "workspace-uuid",
  name: "Gold member offer",
  segment_id: "segment-uuid",
};

const temporaryTier: CreateCampaignActionRequest = {
  action_type: "assign_tier",
  action_config: {
    tier_id: "tier-uuid",
    duration_days: 30,
  },
};

Campaigns accept either segment_id or manual_client_ids. The supported actions are push notification, template switch, custom-field update, reward grant, and tier assignment.

Transactions

typescript
import type { CreateTransactionRequest } from "@wallethero/sdk";

const transaction: CreateTransactionRequest = {
  workspace_id: "workspace-uuid",
  client_id: "client-uuid",
  amount: 25,
  currency: "PLN",
  external_id: "receipt-1842",
  source: "pos",
  transaction_timestamp: new Date().toISOString(),
  line_items: [],
  metadata: { store: "Downtown" },
};

Public enrollment

typescript
import type { DistributionEnrollInput } from "@wallethero/sdk";

const enrollment: DistributionEnrollInput = {
  email: "[email protected]",
  first_name: "Jane",
  phone: "+48123456789",
  marketing_consent: true,
  custom_fields: { member_number: "M-1042" },
  referral_code: "FRIEND42",
};

See the exported declarations in your installed SDK for the full request surface, including loyalty, rewards, tiers, referrals, integrations, webhooks, mobile app, and automation rules.

WalletHero Documentation