Skip to content
Developer docs
⌘ K
Dashboard ↗

Reference

@grizzlee/sdk

Keep this entry point on your server. It imports Node cryptography for webhook verification. @grizzlee/sdk/server exports the same client and types.

GrizzleeApiError

ts
class GrizzleeApiError {
  constructor(status: number, code: string, message: string, details?: Record<string, unknown> | undefined);
}

Adds a referral to a destination as ?ref=KARL7Q, plus program and channel when given. Pass the program unless the code and destination identify it on their own. Partner summary links already make that choice.

ts
declare const createReferralLink: (options: ReferralLink & { destination: string; }) => string;

Reads a referral from an absolute link, such as https://shop.example/join?ref=KARL7Q or myapp://open?.... Reads grizzlee_ref, grizzlee_program and grizzlee_channel from older links, then ref, program and channel. Returns null without a code, or when ref holds something that cannot be a partner code.

ts
declare const readReferralLink: (link: string) => ReferralLink | null;

INSTALL_CLAIM_PARAM

The query parameter that carries an install claim code in a Play Store referrer.

ts
declare const INSTALL_CLAIM_PARAM: "grizzlee_claim";

createPlayStoreUrl

Builds a Play Store link whose install referrer carries an install claim code or a referral. The Play Store hands the referrer to the app after install, with no matching on device or IP. extra adds more referrer pairs, such as utm_source.

ts
declare const createPlayStoreUrl: (options: { packageName: string; installClaim?: string | undefined; referral?: ReferralLink | undefined; extra?: Record<string, string> | undefined; }) => string;

isInstallClaimCode

True when the value looks like an install claim code, such as K7Q2-M9XD-4HPA.

ts
declare const isInstallClaimCode: (value: string) => boolean;

normalizeInstallClaimCode

An install claim code in canonical form: uppercase, without spaces or hyphens. Null when the value cannot be one. Codes are 12 characters of Crockford base32, which has no I, L, O or U.

ts
declare const normalizeInstallClaimCode: (value: string) => string | null;

readAppsFlyerReferral

Reads a referral from an AppsFlyer payload. Pass the result of onDeepLink or onInstallConversionData, or its data or deepLink. A JSON string, which Android can deliver, works too. Looks for grizzlee_ref, grizzlee_program and grizzlee_channel, or ref, program and channel, then a referral link in deep_link_value, then deep_link_sub1 (code), deep_link_sub2 (program) and deep_link_sub3 (channel). The program can be left out when the code is a partner code. Deferred deep links for new installs carry only deep_link_value and deep_link_sub1 to deep_link_sub10, so use those in OneLink. Change the sub keys with keys.

Returns null when the deep link was not found, for organic installs, and for conversion data whose is_first_launch is false, so a cached payload is not captured again on every launch.

ts
declare const readAppsFlyerReferral: (payload: unknown, options?: { keys?: Partial<AppsFlyerReferralKeys> | undefined; }) => ReferralLink | null;

readBranchReferral

Reads a referral from a Branch deep link payload. Pass the event from branch.subscribe ({ error, params, uri }) or its params. Looks for grizzlee_ref, grizzlee_program and grizzlee_channel, or ref, program and channel, in the link data first, then in the query of +non_branch_link, ~referring_link, +url, $canonical_url and $deeplink_path. Returns null when Branch reports an error or +clicked_branch_link is false.

ts
declare const readBranchReferral: (payload: unknown) => ReferralLink | null;

readInstallReferrer

Reads the install referrer string from the Play Install Referrer API, such as grizzlee_claim=K7Q2M9XD4HPA&utm_source=store. Returns the claim code when there is one, otherwise a referral from grizzlee_ref and grizzlee_program or from ref, otherwise null.

ts
declare const readInstallReferrer: (referrer: string | null | undefined) => InstallReferrer | null;

AppsFlyerReferralKeys

Where an AppsFlyer payload carries each referral field when the grizzlee_ keys are absent.

ts
type AppsFlyerReferralKeys = AppsFlyerReferralKeys;

InstallReferrer

What a Play Store install referrer carried: an install claim code, or a referral to capture.

ts
type InstallReferrer = ReferralLink | { installClaim: string; };

computeIncentiveCents

Discount for one order in minor units, for your checkout to apply and report as incentiveAppliedCents. baseCents is the amount your checkout discounts. It returns 0 below minOrderCents. A percentage rounds half up and stops at maxDiscountCents. A fixed amount never exceeds baseCents. It does not check eligibility. Ask your backend for that.

ts
declare const computeIncentiveCents: (terms: IncentivePricingTerms, baseCents: number) => number;

fraudRuleIds

Fraud rules beyond self-referral. Each compares hashed identity signals, never raw values. duplicate_accounts: several customers the same partner referred share a card or device (or an IP address, when enabled) seen within the window. rapid_repeats: the partner received several referrals within minutes from customers on the same device (or IP address, when enabled). repeat_customer: the customer shares a phone, card or device with a different customer who already earned a reward in the same program. disposable_email: the customer's email uses a disposable email domain.

ts
declare const fraudRuleIds: readonly ["duplicate_accounts", "rapid_repeats", "repeat_customer", "disposable_email"];

FRAUD_THRESHOLD_MAX

Highest threshold a velocity rule accepts. A lookup reads this many other customers per signal, so any accepted threshold can be reached.

ts
declare const FRAUD_THRESHOLD_MAX: 200;

MAX_ORDER_CATEGORIES

Most categories one order or checkout can carry.

ts
declare const MAX_ORDER_CATEGORIES: 20;

MAX_CATEGORY_RULES

Most categories one include or exclude list can name.

ts
declare const MAX_CATEGORY_RULES: 50;

orderCategoryMismatch

Why an order's categories fail the rules, or undefined when they pass. excluded names the first excluded category the order has. not_included means include is set and the order has none of its categories, which covers an order without categories.

ts
declare const orderCategoryMismatch: (rules: { include?: string[] | undefined; exclude?: string[] | undefined; } | null | undefined, categories: readonly string[] | null | undefined) => { reason: "excluded"; category: string; } | { reason: "not_included"; } | undefined;

normalizeOrderCategory

How every category slug is compared: trimmed and lowercased.

ts
declare const normalizeOrderCategory: (value: string) => string;

IncentivePricingTerms

The pricing part of a friend incentive. IncentiveOffer and FriendIncentive both fit.

ts
type IncentivePricingTerms = { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; };
ts
type ReferralLink = ReferralLink;

ReferralChannel

ts
type ReferralChannel = "link" | "qr" | "coupon" | "in_app";

TrackingMethods

ts
type TrackingMethods = { links: boolean; qrCodes: boolean; attributionCodes: boolean; providerPromoCodes: boolean; };

ProviderPromoCode

Provider discounts keep their original offer when a program changes.

ts
type ProviderPromoCode = ProviderPromoCode;

ProviderPromoCodeInput

ts
type ProviderPromoCodeInput = { code: string; programId: string; integrationId: string; };

RenameProviderPromoCodeInput

ts
type RenameProviderPromoCodeInput = { code: string; };

ClaimReferralInput

ts
type ClaimReferralInput = { candidates: ({ type: "receipt"; receipt: string; } | { type: "code"; referralCode: string; programId?: string | undefined; providerPromoCodeId?: string | undefined; enteredAt?: string | undefined; })[]; customerId: string; customerDisplayName?: string | undefined; orderId?: string | undefined; expectedProgramId?: string | undefined; signals?: { email?: string | undefined; phone?: string | undefined; phoneHash?: string | undefined; paymentFingerprint?: string | undefined; deviceId?: string | undefined; ipAddress?: string | undefined; } | undefined; };

ClaimReferralResult

ts
type ClaimReferralResult = ClaimReferralResult;

ReferralCandidate

ts
type ReferralCandidate = { type: "receipt"; receipt: string; } | { type: "code"; referralCode: string; programId?: string | undefined; providerPromoCodeId?: string | undefined; enteredAt?: string | undefined; };

ReferralSelection

ts
type ReferralSelection = { winner: { programId: string; partnerId: string; occurredAt: string; type?: "code" | "receipt" | undefined; providerPromoCodeId?: string | undefined; index?: number | undefined; } | null; skipped: { index: number; reason: "expired" | "invalid" | "self_referral" | "wrong_program" | "program_inactive" | "partner_inactive" | "fraud" | "customer_already_referred" | "older"; }[]; };

ReferralSkipReason

ts
type ReferralSkipReason = "expired" | "invalid" | "self_referral" | "wrong_program" | "program_inactive" | "partner_inactive" | "fraud" | "customer_already_referred" | "older";

AttachReferralCodeInput

ts
type AttachReferralCodeInput = { referralCode: string; customerId: string; programId?: string | undefined; customerDisplayName?: string | undefined; orderId?: string | undefined; signals?: { email?: string | undefined; phone?: string | undefined; phoneHash?: string | undefined; paymentFingerprint?: string | undefined; deviceId?: string | undefined; ipAddress?: string | undefined; } | undefined; channel?: "link" | "qr" | "coupon" | "in_app" | undefined; };

AttachReferralCodeResponse

ts
type AttachReferralCodeResponse = AttachReferralCodeResponse;

Attribution

ts
type Attribution = Attribution;

CaptureReferralResponse

Response of the public capture endpoint.

ts
type CaptureReferralResponse = CaptureReferralResponse;

InstallClaim

A single-use code that carries a web capture into a freshly installed app. The landing page puts it in the Play Store referrer or shows it to the visitor, and the app redeems it at first launch.

ts
type InstallClaim = InstallClaim;

FixedRefundMode

ts
type FixedRefundMode = "prorate" | "full_refund_only";

FriendIncentive

ts
type FriendIncentive = { type: "percent"; rateBps: number; orders: number; newCustomersOnly: boolean; expiresAfterDays: number | null; returnOnFullRefund: boolean; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; orders: number; newCustomersOnly: boolean; expiresAfterDays: number | null; returnOnFullRefund: boolean; amountCents: number; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; };

FriendIncentiveInput

ts
type FriendIncentiveInput = { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; };

PartnerOffer

ts
type PartnerOffer = { type: "percent"; rateBps: number; orders: number; expiresAfterDays: number | null; returnOnFullRefund: boolean; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; orders: number; expiresAfterDays: number | null; returnOnFullRefund: boolean; amountCents: number; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; };

PartnerOfferInput

ts
type PartnerOfferInput = { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; };

EarnedOfferTerms

ts
type EarnedOfferTerms = ({ type: "percent"; rateBps: number; orders: number; expiresAfterDays: number | null; returnOnFullRefund: boolean; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; orders: number; expiresAfterDays: number | null; returnOnFullRefund: boolean; amountCents: number; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; }) & { currency: "CAD" | "USD" | "EUR" | "GBP"; };

OfferTerms

Terms a checkout prices.

ts
type OfferTerms = EarnedOfferTerms | IncentiveOffer;

IncentiveKind

ts
type IncentiveKind = "friend" | "earned";

EarnedOfferStatus

ts
type EarnedOfferStatus = "expired" | "pending" | "available" | "used" | "voided";

CustomerImportInput

ts
type CustomerImportInput = { customers: { customerId: string; priorOrderCount: number; }[]; };

IdentitySignals

ts
type IdentitySignals = { email?: string | undefined; phone?: string | undefined; phoneHash?: string | undefined; paymentFingerprint?: string | undefined; deviceId?: string | undefined; ipAddress?: string | undefined; };

IdentitySignalType

ts
type IdentitySignalType = "email" | "phone" | "card" | "device" | "ip";

IncentiveFlag

Recorded on an order Grizzlee accepted with an incentive that did not match the terms.

ts
type IncentiveFlag = IncentiveFlag;

IncentiveFlagReason

ts
type IncentiveFlagReason = "no_reservation" | "reservation_expired" | "reservation_released" | "reservation_consumed" | "reservation_locked" | "no_referral" | "exceeds_terms" | "category_not_eligible";

IncentiveIneligibleReason

no_incentive: the program has no friend incentive. program_inactive: the program is paused. partner_inactive: the partner is paused or left the program. self_referral: the customer is the partner through a customer link, or shares a strong identity signal in a program that blocks matches. fraud: a fraud rule set to block fired on a phone, card or device match. expired: the incentive's days after the referral have passed. not_new_customer: the program requires a new customer and the merchant said false, or the recorded purchase number is past its order count. order_limit_reached: the customer already placed that many orders since the referral. uses_exhausted: the customer already used the incentive on that many orders. reservation_open: another order holds the remaining uses in an open reservation. category_not_eligible: the categories sent have an excluded one, or none of the included ones. offer_voided: the held earned offer was rejected or its earning order was fully refunded.

ts
type IncentiveIneligibleReason = "expired" | "self_referral" | "program_inactive" | "partner_inactive" | "fraud" | "no_referral" | "category_not_eligible" | "no_incentive" | "not_new_customer" | "order_limit_reached" | "uses_exhausted" | "reservation_open" | "offer_voided";

IncentiveOffer

A program's friend incentive with the program currency. Public responses use this shape.

ts
type IncentiveOffer = ({ type: "percent"; rateBps: number; orders: number; newCustomersOnly: boolean; expiresAfterDays: number | null; returnOnFullRefund: boolean; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; orders: number; newCustomersOnly: boolean; expiresAfterDays: number | null; returnOnFullRefund: boolean; amountCents: number; minOrderCents?: number | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; }) & { currency: "CAD" | "USD" | "EUR" | "GBP"; };

IncentiveReservation

An order's hold on an offer. Terms are copied when the reservation is made.

ts
type IncentiveReservation = IncentiveReservation;

IncentiveReservationResult

Response of POST /referrals/incentive/reservations.

ts
type IncentiveReservationResult = IncentiveReservationResult;

IncentiveReservationStatus

Open holds end only when their order completes or the merchant releases them.

ts
type IncentiveReservationStatus = "open" | "consumed" | "released";

ReserveIncentiveInput

ts
type ReserveIncentiveInput = { customerId: string; orderId: string; programId?: string | undefined; candidates?: ({ type: "receipt"; receipt: string; } | { type: "code"; referralCode: string; programId?: string | undefined; providerPromoCodeId?: string | undefined; enteredAt?: string | undefined; })[] | undefined; signals?: { email?: string | undefined; phone?: string | undefined; phoneHash?: string | undefined; paymentFingerprint?: string | undefined; deviceId?: string | undefined; ipAddress?: string | undefined; } | undefined; newCustomer?: boolean | undefined; baseCents?: number | undefined; categories?: string[] | undefined; };

ReferralIncentive

Response of POST /referrals/incentive.

ts
type ReferralIncentive = ReferralIncentive;

ReferralIncentiveInput

ts
type ReferralIncentiveInput = { customerId: string; programId?: string | undefined; candidates?: ({ type: "receipt"; receipt: string; } | { type: "code"; referralCode: string; programId?: string | undefined; providerPromoCodeId?: string | undefined; enteredAt?: string | undefined; })[] | undefined; orderId?: string | undefined; signals?: { email?: string | undefined; phone?: string | undefined; phoneHash?: string | undefined; paymentFingerprint?: string | undefined; deviceId?: string | undefined; ipAddress?: string | undefined; } | undefined; newCustomer?: boolean | undefined; categories?: string[] | undefined; customerOrderNumber?: number | undefined; };

Program

ts
type Program = Program;

ProgramTrigger

ts
type ProgramTrigger = { type: "order"; } | { type: "milestone"; milestone: string; };

Duration

ts
type Duration = { type: "only_order"; } | { type: "first_order"; } | { type: "first_n_orders"; count: number; } | { type: "days"; days: number; } | { type: "months"; months: number; } | { type: "lifetime"; };

Compensation

ts
type Compensation = { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; };

LocalizedText

Text in every supported language: en, fr-CA, hy and ru.

ts
type LocalizedText = { en: string; "fr-CA": string; hy: string; ru: string; };

ProgramRewardTerms

A program's reward terms for one partner. The structured fields are the source of truth. The text is a short generic summary for screens that do not format their own.

ts
type ProgramRewardTerms = ProgramRewardTerms;

ProgramVersion

One saved version of a program. Versions never change. programSnapshot holds every rule as it was when the version was saved. A rename alone adds no version, so the name is the one the program had when this version was saved.

ts
type ProgramVersion = ProgramVersion;

ProgramVersionDetail

Response of GET /programs/:id/versions/:version and each item of the list.

ts
type ProgramVersionDetail = ProgramVersionDetail;

ProgramVersionList

Response of GET /programs/:id/versions. Newest first.

ts
type ProgramVersionList = ProgramVersionList;

TermsCompensation

Compensation in readable terms. Percentage terms carry the rate and its schedule.

ts
type TermsCompensation = { type: "percentage"; rateBps: number; phases: { afterMonths: number; rateBps: number; }[]; } | { type: "fixed"; amountCents: number; };

MilestoneResult

Response of POST /milestones, POST /milestones/revoke, POST /milestones/reinstate and POST /milestones/reverse.

ts
type MilestoneResult = MilestoneResult;

MilestoneStatus

recorded: Grizzlee processed the report. decisions say which programs rewarded it. revoked: the milestone is revoked for this person. A report still counts but earns nothing until a reinstatement. Revocations always return revoked. reinstated: reinstatements always return it, including one that found the milestone not revoked and changed nothing. reversed: reversals always return it, including one for a report that was already reversed.

ts
type MilestoneStatus = "recorded" | "revoked" | "reinstated" | "reversed";

MilestoneRewards

ts
type MilestoneRewards = { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; };

ReinstateMilestoneInput

ts
type ReinstateMilestoneInput = { customerId: string; milestone: string; eventId: string; reason?: string | undefined; };

ReportMilestoneInput

ts
type ReportMilestoneInput = { customerId: string; occurredAt: string; milestone: string; eventId: string; valueCents?: number | undefined; };

ReverseMilestoneReportInput

ts
type ReverseMilestoneReportInput = { eventId: string; reportEventId: string; reason?: string | undefined; };

RevokeMilestoneInput

ts
type RevokeMilestoneInput = { customerId: string; reason: string; milestone: string; eventId: string; };

RejectRewardInput

ts
type RejectRewardInput = { reason?: string | undefined; };

Reward

ts
type Reward = Reward;

TextPart

One sentence of text Grizzlee writes in English, as a stable code and the values it names, so a client can show it in another language. Amounts are minor units of params.currency, rates are basis points and lists are arrays. The English field next to the parts keeps its wording.

ts
type TextPart = TextPart<Code>;

RewardTextCode

Sentences of a reward explanation. fixed, percentage, offer, report, report_percentage and milestone_bonus say how the amount was worked out. The rest follow it and adjust it. An offer names no terms: they are in the reward's offer, or the program's partner offer.

ts
type RewardTextCode = "fixed" | "percentage" | "offer" | "report" | "report_percentage" | "milestone_bonus" | "schedule_month" | "tier_bonus" | "custom_partner_terms" | "custom_customer_terms" | "capped";

DecisionTextCode

Why a program rewarded or skipped. A rewarded decision uses the reward's explanation codes. self_referral_blocked and fraud_blocked name no values: the decision's selfReferral and fraud hold them.

ts
type DecisionTextCode = "no_referral" | RewardTextCode | "no_order_referral" | "no_customer_referral" | "partner_not_in_program" | "self_referral_blocked" | "fraud_blocked" | "milestone_before_referral" | "order_before_referral" | "report_value_missing" | "milestone_window_expired" | "order_window_expired" | "milestone_progress" | "report_limit_reached" | "milestone_already_rewarded" | "report_value_no_reward" | "customer_cap_reached" | "partner_cap_reached" | "category_excluded" | "categories_missing" | "categories_required" | "first_order_only" | "first_order_after_referral_only" | "first_orders_only" | "first_orders_after_referral_only" | "duration_ended" | "rate_no_reward" | "order_no_reward";

PayoutTextCode

Sentences of a Stripe payout's lastError. payout_changed and delivery_failed carry the error Grizzlee hit as errorCode and detail, its English message.

ts
type PayoutTextCode = "retries_stopped" | "connection_disabled" | "connection_unavailable" | "debt_settled" | "payout_changed" | "delivery_failed" | "no_transfer_sent" | "rewards_payable" | "refund_reduced_earnings" | "rewards_not_marked" | "contact_support" | "transfer_unmatched" | "stripe_key_rejected" | "stripe_key_permission" | "stripe_insufficient_funds" | "partner_onboarding" | "partner_account_missing" | "stripe_rejected" | "stripe_rejected_code" | "answer_kept" | "search_failed" | "not_confirmed" | "rewards_kept" | "earnings_reserved" | "transfer_conflict" | "transfers_conflict" | "check_transfer_group" | "check_transfer_metadata" | "cancelled_no_transfer";

RefundEvent

ts
type RefundEvent = { type: "order.refunded"; orderId: string; occurredAt: string; eventId: string; refundedTotalCents?: number | undefined; refundedCommissionableCents?: number | undefined; fullRefund?: boolean | undefined; };

OrderAdjustmentEvent

ts
type OrderAdjustmentEvent = { type: "order.adjusted"; orderId: string; occurredAt: string; eventId: string; reason?: string | undefined; totalCents?: number | undefined; commissionableCents?: number | undefined; };

OrderAdjustment

One applied order adjustment, with the totals it replaced.

ts
type OrderAdjustment = OrderAdjustment;

SelfReferralAction

ts
type SelfReferralAction = "blocked" | "review" | "flagged";

SelfReferralSignalType

ts
type SelfReferralSignalType = "email" | "phone" | "card" | "device" | "ip" | "customer_id";

SelfReferralMatch

A block stops the reward and incentive. Review holds the reward. A flag records the match.

ts
type SelfReferralMatch = SelfReferralMatch;

FraudChecks

ts
type FraudChecks = { selfReferral: { action: "review" | "block" | "flag" | "off"; }; duplicateAccounts: { action: "review" | "block" | "flag" | "off"; accounts: number; windowDays: number; ipAccounts: number | null; }; rapidRepeats: { action: "review" | "block" | "flag" | "off"; referrals: number; windowMinutes: number; ipReferrals: number | null; }; repeatCustomer: { action: "review" | "block" | "flag" | "off"; }; disposableEmail: { action: "review" | "flag" | "off"; }; };

FraudChecksInput

ts
type FraudChecksInput = { selfReferral?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; duplicateAccounts?: { action?: "review" | "block" | "flag" | "off" | undefined; accounts?: number | undefined; windowDays?: number | undefined; ipAccounts?: number | null | undefined; } | undefined; rapidRepeats?: { action?: "review" | "block" | "flag" | "off" | undefined; referrals?: number | undefined; windowMinutes?: number | undefined; ipReferrals?: number | null | undefined; } | undefined; repeatCustomer?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; disposableEmail?: { action?: "review" | "flag" | "off" | undefined; } | undefined; };

FraudMatch

What Grizzlee did about the fraud rules that fired. action is the strongest of the rules: blocked, then review, then flagged. rules lists each rule with its own action.

ts
type FraudMatch = FraudMatch;

FraudRuleAction

ts
type FraudRuleAction = "review" | "block" | "flag" | "off";

FraudRuleId

ts
type FraudRuleId = "duplicate_accounts" | "rapid_repeats" | "repeat_customer" | "disposable_email";

FraudRuleMatch

One rule that fired and what it did.

ts
type FraudRuleMatch = FraudRuleMatch;

OrderCategoryRules

ts
type OrderCategoryRules = { include?: string[] | undefined; exclude?: string[] | undefined; };

OrderCategoryRulesInput

ts
type OrderCategoryRulesInput = { include?: string[] | undefined; exclude?: string[] | undefined; };

OrderEvent

ts
type OrderEvent = { type: "order.completed"; customerId: string; orderId: string; occurredAt: string; eventId: string; commissionableCents: number; currency: "CAD" | "USD" | "EUR" | "GBP"; customerDisplayName?: string | undefined; newCustomer?: boolean | undefined; categories?: string[] | undefined; customerOrderNumber?: number | undefined; totalCents?: number | undefined; customerEmail?: string | undefined; incentiveAppliedCents?: number | undefined; };

AttributionInput

ts
type AttributionInput = { programId: string; referralCode: string; customerId: string; occurredAt: string; channel: "link" | "qr" | "coupon" | "in_app"; providerPromoCodeId?: string | undefined; customerDisplayName?: string | undefined; orderId?: string | undefined; };

EventResult

ts
type EventResult = EventResult;

ProgramCreateInput

ts
type ProgramCreateInput = { name: string; kind: "referral" | "affiliate" | "both"; rewardType: "offer" | "cash" | "credit"; attributionWindowDays: number | null; active: boolean; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; currency?: "CAD" | "USD" | "EUR" | "GBP" | undefined; tracking?: { links?: boolean | undefined; qrCodes?: boolean | undefined; attributionCodes?: boolean | undefined; providerPromoCodes?: boolean | undefined; } | undefined; destinationUrl?: string | undefined; display?: { en?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; "fr-CA"?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; hy?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; ru?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; } | undefined; trigger?: { type: "order"; } | { type: "milestone"; milestone: string; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; fixedRefundMode?: "prorate" | "full_refund_only" | undefined; duration?: { type: "only_order"; } | { type: "first_order"; } | { type: "first_n_orders"; count: number; } | { type: "days"; days: number; } | { type: "months"; months: number; } | { type: "lifetime"; } | undefined; delivery?: { cash?: "grizzlee_wallet" | "merchant" | undefined; credit?: "grizzlee_wallet" | "merchant" | undefined; } | undefined; reviewRewards?: boolean | undefined; fraudChecks?: { selfReferral?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; duplicateAccounts?: { action?: "review" | "block" | "flag" | "off" | undefined; accounts?: number | undefined; windowDays?: number | undefined; ipAccounts?: number | null | undefined; } | undefined; rapidRepeats?: { action?: "review" | "block" | "flag" | "off" | undefined; referrals?: number | undefined; windowMinutes?: number | undefined; ipReferrals?: number | null | undefined; } | undefined; repeatCustomer?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; disposableEmail?: { action?: "review" | "flag" | "off" | undefined; } | undefined; } | undefined; performance?: { metric: "orders" | "new_customers"; tiers: { name: string; minValue: number; bonusBps: number; }[]; windowDays?: number | undefined; } | undefined; limits?: { customerCapCents?: number | undefined; partnerCapCents?: number | undefined; } | undefined; customTerms?: ({ target: "partner"; targetId: string; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; customerCapCents?: number | null | undefined; partnerCapCents?: number | null | undefined; } | { target: "customer"; targetId: string; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; customerCapCents?: number | null | undefined; })[] | undefined; friendIncentive?: { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | undefined; partnerOffer?: { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | undefined; };

ProgramDeletion

What deleteProgram did. deleted: the program had no referrals, rewards or other history, so it is gone with its versions. archived: it had history, so it is paused, hidden and kept.

ts
type ProgramDeletion = ProgramDeletion;

ProgramDisplay

What a partner or customer screen shows for a program, in every supported language. Missing copy falls back: publicName to the default language's public name and then the program name, headline to terms.text.headline, and the milestone label to "step" and "steps".

ts
type ProgramDisplay = ProgramDisplay;

ProgramDisplayInput

ts
type ProgramDisplayInput = { en?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; "fr-CA"?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; hy?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; ru?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; };

ProgramInput

ts
type ProgramInput = { currency: "CAD" | "USD" | "EUR" | "GBP"; name: string; kind: "referral" | "affiliate" | "both"; rewardType: "offer" | "cash" | "credit"; attributionWindowDays: number | null; active: boolean; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; tracking?: { links?: boolean | undefined; qrCodes?: boolean | undefined; attributionCodes?: boolean | undefined; providerPromoCodes?: boolean | undefined; } | undefined; destinationUrl?: string | undefined; display?: { en?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; "fr-CA"?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; hy?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; ru?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; } | undefined; trigger?: { type: "order"; } | { type: "milestone"; milestone: string; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; fixedRefundMode?: "prorate" | "full_refund_only" | undefined; duration?: { type: "only_order"; } | { type: "first_order"; } | { type: "first_n_orders"; count: number; } | { type: "days"; days: number; } | { type: "months"; months: number; } | { type: "lifetime"; } | undefined; delivery?: { cash?: "grizzlee_wallet" | "merchant" | undefined; credit?: "grizzlee_wallet" | "merchant" | undefined; } | undefined; reviewRewards?: boolean | undefined; fraudChecks?: { selfReferral?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; duplicateAccounts?: { action?: "review" | "block" | "flag" | "off" | undefined; accounts?: number | undefined; windowDays?: number | undefined; ipAccounts?: number | null | undefined; } | undefined; rapidRepeats?: { action?: "review" | "block" | "flag" | "off" | undefined; referrals?: number | undefined; windowMinutes?: number | undefined; ipReferrals?: number | null | undefined; } | undefined; repeatCustomer?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; disposableEmail?: { action?: "review" | "flag" | "off" | undefined; } | undefined; } | undefined; performance?: { metric: "orders" | "new_customers"; tiers: { name: string; minValue: number; bonusBps: number; }[]; windowDays?: number | undefined; } | undefined; limits?: { customerCapCents?: number | undefined; partnerCapCents?: number | undefined; } | undefined; customTerms?: ({ target: "partner"; targetId: string; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; customerCapCents?: number | null | undefined; partnerCapCents?: number | null | undefined; } | { target: "customer"; targetId: string; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; customerCapCents?: number | null | undefined; })[] | undefined; friendIncentive?: { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | undefined; partnerOffer?: { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | undefined; };

ProgramUpdateInput

ts
type ProgramUpdateInput = { name: string; kind: "referral" | "affiliate" | "both"; rewardType: "offer" | "cash" | "credit"; attributionWindowDays: number | null; active: boolean; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | null | undefined; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; currency?: "CAD" | "USD" | "EUR" | "GBP" | undefined; tracking?: { links?: boolean | undefined; qrCodes?: boolean | undefined; attributionCodes?: boolean | undefined; providerPromoCodes?: boolean | undefined; } | undefined; destinationUrl?: string | null | undefined; display?: { en?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; "fr-CA"?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; hy?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; ru?: { publicName?: string | undefined; headline?: string | undefined; milestoneLabel?: { one: string; other: string; } | undefined; } | undefined; } | null | undefined; trigger?: { type: "order"; } | { type: "milestone"; milestone: string; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; fixedRefundMode?: "prorate" | "full_refund_only" | undefined; duration?: { type: "only_order"; } | { type: "first_order"; } | { type: "first_n_orders"; count: number; } | { type: "days"; days: number; } | { type: "months"; months: number; } | { type: "lifetime"; } | undefined; delivery?: { cash?: "grizzlee_wallet" | "merchant" | undefined; credit?: "grizzlee_wallet" | "merchant" | undefined; } | undefined; reviewRewards?: boolean | undefined; fraudChecks?: { selfReferral?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; duplicateAccounts?: { action?: "review" | "block" | "flag" | "off" | undefined; accounts?: number | undefined; windowDays?: number | undefined; ipAccounts?: number | null | undefined; } | undefined; rapidRepeats?: { action?: "review" | "block" | "flag" | "off" | undefined; referrals?: number | undefined; windowMinutes?: number | undefined; ipReferrals?: number | null | undefined; } | undefined; repeatCustomer?: { action?: "review" | "block" | "flag" | "off" | undefined; } | undefined; disposableEmail?: { action?: "review" | "flag" | "off" | undefined; } | undefined; } | undefined; performance?: { metric: "orders" | "new_customers"; tiers: { name: string; minValue: number; bonusBps: number; }[]; windowDays?: number | undefined; } | undefined; limits?: { customerCapCents?: number | undefined; partnerCapCents?: number | undefined; } | undefined; customTerms?: ({ target: "partner"; targetId: string; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; customerCapCents?: number | null | undefined; partnerCapCents?: number | null | undefined; } | { target: "customer"; targetId: string; compensation?: { type: "percentage"; rateBps: number; phases?: { rateBps: number; afterMonths: number; }[] | undefined; } | { type: "fixed"; amountCents: number; } | undefined; milestoneRewards?: { eachReport?: { compensation: { type: "fixed"; amountCents: number; } | { type: "percentage"; rateBps: number; }; limit?: number | undefined; } | undefined; atCount?: { amountCents: number; count: number; } | undefined; } | undefined; customerCapCents?: number | null | undefined; })[] | undefined; friendIncentive?: { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; newCustomersOnly?: boolean | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | null | undefined; partnerOffer?: { type: "percent"; rateBps: number; maxDiscountCents?: number | undefined; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | { type: "fixed"; amountCents: number; minOrderCents?: number | undefined; orders?: number | undefined; expiresAfterDays?: number | null | undefined; returnOnFullRefund?: boolean | undefined; orderCategories?: { include?: string[] | undefined; exclude?: string[] | undefined; } | undefined; } | undefined; };

Placement

A company key that names one program.

ts
type Placement = Placement;

SetPlacementInput

ts
type SetPlacementInput = { programId: string; };

PartnerInput

ts
type PartnerInput = { email: string; name: string; externalId: string; customerIds?: string[] | undefined; programIds?: string[] | undefined; addProgramIds?: string[] | undefined; removeProgramIds?: string[] | undefined; labels?: string[] | undefined; properties?: Record<string, string | number | boolean> | undefined; stripeAccountId?: string | null | undefined; locale?: "en" | "fr-CA" | "hy" | "ru" | null | undefined; };

Partner

ts
type Partner = Partner;

PartnerUpsertInput

ts
type PartnerUpsertInput = { email: string; name: string; externalId: string; customerIds?: string[] | undefined; programIds?: string[] | undefined; addProgramIds?: string[] | undefined; removeProgramIds?: string[] | undefined; labels?: string[] | undefined; properties?: Record<string, string | number | boolean> | undefined; stripeAccountId?: string | null | undefined; locale?: "en" | "fr-CA" | "hy" | "ru" | null | undefined; };

PartnerUpsertResult

ts
type PartnerUpsertResult = PartnerUpsertResult;

PartnerUpdateInput

ts
type PartnerUpdateInput = { email?: string | undefined; name?: string | undefined; active?: boolean | undefined; customerIds?: string[] | undefined; programIds?: string[] | undefined; addProgramIds?: string[] | undefined; removeProgramIds?: string[] | undefined; labels?: string[] | undefined; properties?: Record<string, string | number | boolean> | undefined; stripeAccountId?: string | null | undefined; locale?: "en" | "fr-CA" | "hy" | "ru" | null | undefined; };

DeliveryMode

ts
type DeliveryMode = "grizzlee_wallet" | "merchant";

PartnerCreditDeliveryInput

ts
type PartnerCreditDeliveryInput = { amountCents: number; currency: "CAD" | "USD" | "EUR" | "GBP"; externalReference: string; };

PartnerCreditDeliveryResult

ts
type PartnerCreditDeliveryResult = PartnerCreditDeliveryResult;

PartnerDebtRecoveryInput

ts
type PartnerDebtRecoveryInput = { amountCents: number; currency: "CAD" | "USD" | "EUR" | "GBP"; rewardType: "cash" | "credit"; externalReference: string; };

PartnerDebtRecoveryResult

ts
type PartnerDebtRecoveryResult = PartnerDebtRecoveryResult;

ProgramDelivery

ts
type ProgramDelivery = { cash: "grizzlee_wallet" | "merchant"; credit: "grizzlee_wallet" | "merchant"; };

RewardDelivery

Append-only delivery attempt or transfer reversal for a merchant-delivered reward.

ts
type RewardDelivery = RewardDelivery;

RewardDeliveryHistory

Response of GET /rewards/:id/deliveries.

ts
type RewardDeliveryHistory = RewardDeliveryHistory;

PartnerDeliveryDebt

ts
type PartnerDeliveryDebt = PartnerDeliveryDebt;

DeliveryDebtSettlement

restored: a reward restoration or transfer reversal reduced the partner's outstanding debt. netted: the merchant kept part of a later delivery. recovered: the merchant collected it another way.

ts
type DeliveryDebtSettlement = DeliveryDebtSettlement;

Payout

ts
type Payout = Payout;

PayoutAllocation

Append-only link between a merchant payout and one reward it pays.

ts
type PayoutAllocation = PayoutAllocation;

PayoutWithAllocations

A payout with the rewards it pays. Wallet payouts have no allocations.

ts
type PayoutWithAllocations = PayoutWithAllocations;

PayoutPage

ts
type PayoutPage = PayoutPage;

PayoutSchedule

Response of GET and PUT /payout-schedule.

ts
type PayoutSchedule = ({ frequency: "weekly"; weekday: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"; enabled: boolean; minimumCents: number; holdPeriodDays: number; stripeIntegrationId: string | null; missingStripeAccount: "manual" | "wait"; } | { frequency: "monthly"; enabled: boolean; minimumCents: number; holdPeriodDays: number; stripeIntegrationId: string | null; missingStripeAccount: "manual" | "wait"; dayOfMonth: number; }) & { activeSince: string | null; lastRunOn: string | null; nextRunOn: string | null; updatedAt: string | null; };

PayoutScheduleInput

ts
type PayoutScheduleInput = { frequency: "weekly"; weekday: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"; enabled: boolean; minimumCents?: number | undefined; holdPeriodDays?: number | undefined; stripeIntegrationId?: string | null | undefined; missingStripeAccount?: "manual" | "wait" | undefined; } | { frequency: "monthly"; enabled: boolean; dayOfMonth: number; minimumCents?: number | undefined; holdPeriodDays?: number | undefined; stripeIntegrationId?: string | null | undefined; missingStripeAccount?: "manual" | "wait" | undefined; };

PayoutScheduleRun

The scheduled run that created a payout.

ts
type PayoutScheduleRun = PayoutScheduleRun;

PayoutWeekday

ts
type PayoutWeekday = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";

PartnerSummary

Response of GET /partners/.../summary.

ts
type PartnerSummary = PartnerSummary;

PartnerSummaryProgram

ts
type PartnerSummaryProgram = PartnerSummaryProgram;

PartnerProgramWalletBalance

Reward totals attributable to one program. Wallet operations belong to the partner as a whole.

ts
type PartnerProgramWalletBalance = { currency: "CAD" | "USD" | "EUR" | "GBP"; rewardType: MoneyRewardType; pendingApprovalCents: number; approvedCents: number; };

PartnerClickCounts

Recorded link and QR activity, including code attachments marked with either channel.

ts
type PartnerClickCounts = PartnerClickCounts;

PartnerLinkUnavailableReason

Why a program in a partner summary has no referral link.

ts
type PartnerLinkUnavailableReason = "program_inactive" | "partner_inactive" | "tracking_disabled" | "no_published_page" | "invalid_destination";

PartnerWalletBalance

Wallet-mode rewards of one type. Merchant-delivered rewards are never counted here.

ts
type PartnerWalletBalance = PartnerWalletBalance;

PartnerMerchantBalance

Merchant-delivered rewards of one type. Wallet rewards are never counted here.

ts
type PartnerMerchantBalance = PartnerMerchantBalance;

PartnerReferral

ts
type PartnerReferral = PartnerReferral;

PartnerReferralStatus

claimed: this partner holds the referral and no purchase has qualified yet. qualified: a purchase qualified while this partner held it. displaced: a later referral by another partner took it over before any purchase qualified. expired: this partner holds it, nothing qualified and the program's attribution window has passed.

ts
type PartnerReferralStatus = "expired" | "claimed" | "qualified" | "displaced";

PartnerReferralPage

ts
type PartnerReferralPage = PartnerReferralPage;

PartnerReward

ts
type PartnerReward = PartnerReward;

PartnerRewardDelivery

ts
type PartnerRewardDelivery = PartnerRewardDelivery;

PartnerRewardDeliveryStatus

not_applicable: the Grizzlee wallet pays the reward, or a merchant reward was fully reversed before any delivery. undelivered: the merchant still owes some of it. in_payout: an open merchant payout includes it. delivered: the merchant delivered everything it owes. failed: the latest delivery attempt failed and something is still owed.

ts
type PartnerRewardDeliveryStatus = "not_applicable" | "undelivered" | "in_payout" | "delivered" | "failed";

PartnerRewardPage

ts
type PartnerRewardPage = PartnerRewardPage;

CreateEmbedSessionInput

ts
type CreateEmbedSessionInput = { partner: { externalId: string; } | { id: string; }; programIds?: string[] | undefined; locale?: "en" | "fr-CA" | "hy" | "ru" | undefined; layout?: "full" | "simple" | undefined; actions?: ("payout_details:write" | "profile:write")[] | undefined; ttlSeconds?: number | undefined; embedOrigin?: string | undefined; placement?: string | undefined; };

CreateEmbedSessionResponse

ts
type CreateEmbedSessionResponse = CreateEmbedSessionResponse;

EmbedSession

An embed session as the merchant's server sees it. Token hashes never leave the database.

ts
type EmbedSession = EmbedSession;

EmbedAction

ts
type EmbedAction = "payout_details:write" | "profile:write";

EmbedLocale

ts
type EmbedLocale = "en" | "fr-CA" | "hy" | "ru";

EmbedLayout

ts
type EmbedLayout = "full" | "simple";

EmbedExchangeResponse

Response of POST /api/embed/exchange, read by the embedded frame.

ts
type EmbedExchangeResponse = EmbedExchangeResponse;

EmbedSummary

A scoped summary omits wallet operations, which have no program allocations.

ts
type EmbedSummary = EmbedSummary;

EmbedPayout

A payout as the embedded dashboard shows it. Provider errors, references, destinations and internal IDs stay with the merchant.

ts
type EmbedPayout = EmbedPayout;

EmbedPayoutPage

ts
type EmbedPayoutPage = EmbedPayoutPage;

EmbedReferral

Partner-facing rows contain only the fields the frame displays.

ts
type EmbedReferral = EmbedReferral;

EmbedReferralPage

ts
type EmbedReferralPage = EmbedReferralPage;

EmbedReward

ts
type EmbedReward = EmbedReward;

EmbedRewardPage

ts
type EmbedRewardPage = EmbedRewardPage;

ErasureCounts

What one erasure call changed. A repeat call counts only what arrived since the last one, so its counts are usually zero.

ts
type ErasureCounts = ErasureCounts;

PartnerErasureResult

Response of POST /partners/:id/erase and POST /partners/by-external-id/:externalId/erase.

ts
type PartnerErasureResult = PartnerErasureResult;

CustomerErasureResult

Response of POST /customers/:customerId/erase.

ts
type CustomerErasureResult = CustomerErasureResult;

ERASED_PARTNER_NAME

Name an erased partner keeps.

ts
declare const ERASED_PARTNER_NAME: "Erased partner";

ERASED_TEXT

Replaces free text that erasure removes, such as a rejection or revocation reason.

ts
declare const ERASED_TEXT: "[erased]";

RevokeEmbedSessionResponse

ts
type RevokeEmbedSessionResponse = EmbedSession;

GetPartnerByExternalIdResponse

ts
type GetPartnerByExternalIdResponse = Partner;

PartnerSignalsInput

Identity signals sent with a partner. Grizzlee stores keyed hashes, compares them with the customers the partner refers and never returns them.

ts
type PartnerSignalsInput = PartnerSignalsInput;

UpdatePartnerByExternalIdInput

Add or remove enrollments, replace programIds, or send signals alone.

ts
type UpdatePartnerByExternalIdInput = { email?: string | undefined; name?: string | undefined; active?: boolean | undefined; customerIds?: string[] | undefined; programIds?: string[] | undefined; addProgramIds?: string[] | undefined; removeProgramIds?: string[] | undefined; labels?: string[] | undefined; properties?: Record<string, string | number | boolean> | undefined; stripeAccountId?: string | null | undefined; locale?: "en" | "fr-CA" | "hy" | "ru" | null | undefined; } & PartnerSignalsInput;

UpdatePartnerByExternalIdResponse

ts
type UpdatePartnerByExternalIdResponse = Partner;

UpsertPartnerInput

Omit programIds when a sync must preserve enrollments from the dashboard or placements.

ts
type UpsertPartnerInput = { email: string; name: string; externalId: string; customerIds?: string[] | undefined; programIds?: string[] | undefined; addProgramIds?: string[] | undefined; removeProgramIds?: string[] | undefined; labels?: string[] | undefined; properties?: Record<string, string | number | boolean> | undefined; stripeAccountId?: string | null | undefined; locale?: "en" | "fr-CA" | "hy" | "ru" | null | undefined; } & PartnerSignalsInput;

UpsertPartnerResponse

ts
type UpsertPartnerResponse = PartnerUpsertResult;

DeliverRewardInput

ts
type DeliverRewardInput = DeliverRewardInput;

DeliverRewardResponse

ts
type DeliverRewardResponse = RewardDelivery;

FailRewardDeliveryInput

ts
type FailRewardDeliveryInput = FailRewardDeliveryInput;

FailRewardDeliveryResponse

ts
type FailRewardDeliveryResponse = RewardDelivery;

ListRewardDeliveriesResponse

ts
type ListRewardDeliveriesResponse = RewardDeliveryHistory;

RecoverPartnerDebtInput

ts
type RecoverPartnerDebtInput = RecoverPartnerDebtInput;

RecoverPartnerDebtResponse

ts
type RecoverPartnerDebtResponse = PartnerDeliveryDebt;

PartnerReference

Address a partner by your external ID or by Grizzlee's internal ID.

ts
type PartnerReference = { externalId: string; } | { id: string; };

CreatePartnerPayoutInput

mode "grizzlee_wallet" reserves the partner's available wallet cash, with provider "manual" or "stripe". mode "merchant" pays listed merchant-delivered cash rewards: you send the money yourself with provider "manual" (the default), or Grizzlee sends a Stripe transfer of the net amount from your Stripe balance with provider "stripe". Stripe payouts default destination to the partner's stripeAccountId.

ts
type CreatePartnerPayoutInput = { amountCents: number; eventId: string; mode: "grizzlee_wallet"; provider: "manual" | "stripe"; integrationId?: string | undefined; destination?: string | undefined; } | { eventId: string; mode: "merchant"; allocations: { amountCents: number; rewardId: string; }[]; integrationId?: string | undefined; amountCents?: number | undefined; provider?: "manual" | "stripe" | undefined; destination?: string | undefined; nettedDebtCents?: number | undefined; };

CreatePartnerPayoutResponse

ts
type CreatePartnerPayoutResponse = PayoutWithAllocations;

MarkPayoutPaidRequest

ts
type MarkPayoutPaidRequest = { externalReference: string; paidAt?: string | undefined; };

MarkPayoutPaidResponse

ts
type MarkPayoutPaidResponse = PayoutWithAllocations;

CancelPayoutRequest

confirmNoTransfer releases a Stripe payout held for review after you checked Stripe and found no transfer for it. Grizzlee searches Stripe again and refuses if it finds one.

ts
type CancelPayoutRequest = { confirmNoTransfer?: boolean | undefined; };

CancelPayoutResponse

ts
type CancelPayoutResponse = PayoutWithAllocations;

ListPartnerPayoutsOptions

ts
type ListPartnerPayoutsOptions = ListPartnerPayoutsOptions;

ListPartnerPayoutsResponse

ts
type ListPartnerPayoutsResponse = PayoutPage;

GetPartnerSummaryResponse

ts
type GetPartnerSummaryResponse = PartnerSummary;

DeliverPartnerCreditInput

ts
type DeliverPartnerCreditInput = { amountCents: number; currency: "CAD" | "USD" | "EUR" | "GBP"; externalReference: string; };

DeliverPartnerCreditResponse

ts
type DeliverPartnerCreditResponse = PartnerCreditDeliveryResult;

RecoverPartnerDebtsInput

ts
type RecoverPartnerDebtsInput = { amountCents: number; currency: "CAD" | "USD" | "EUR" | "GBP"; rewardType: "cash" | "credit"; externalReference: string; };

RecoverPartnerDebtsResponse

ts
type RecoverPartnerDebtsResponse = PartnerDebtRecoveryResult;

ListPartnerReferralsOptions

ts
type ListPartnerReferralsOptions = ListPartnerReferralsOptions;

ListPartnerReferralsResponse

ts
type ListPartnerReferralsResponse = PartnerReferralPage;

ListPartnerRewardsOptions

ts
type ListPartnerRewardsOptions = ListPartnerRewardsOptions;

ListPartnerRewardsResponse

ts
type ListPartnerRewardsResponse = PartnerRewardPage;

GetPayoutResponse

ts
type GetPayoutResponse = PayoutWithAllocations;

GetPayoutScheduleResponse

ts
type GetPayoutScheduleResponse = ({ frequency: "weekly"; weekday: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"; enabled: boolean; minimumCents: number; holdPeriodDays: number; stripeIntegrationId: string | null; missingStripeAccount: "manual" | "wait"; } | { frequency: "monthly"; enabled: boolean; minimumCents: number; holdPeriodDays: number; stripeIntegrationId: string | null; missingStripeAccount: "manual" | "wait"; dayOfMonth: number; }) & { activeSince: string | null; lastRunOn: string | null; nextRunOn: string | null; updatedAt: string | null; };

UpdatePayoutScheduleInput

ts
type UpdatePayoutScheduleInput = { frequency: "weekly"; weekday: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"; enabled: boolean; minimumCents?: number | undefined; holdPeriodDays?: number | undefined; stripeIntegrationId?: string | null | undefined; missingStripeAccount?: "manual" | "wait" | undefined; } | { frequency: "monthly"; enabled: boolean; dayOfMonth: number; minimumCents?: number | undefined; holdPeriodDays?: number | undefined; stripeIntegrationId?: string | null | undefined; missingStripeAccount?: "manual" | "wait" | undefined; };

UpdatePayoutScheduleResponse

ts
type UpdatePayoutScheduleResponse = ({ frequency: "weekly"; weekday: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday"; enabled: boolean; minimumCents: number; holdPeriodDays: number; stripeIntegrationId: string | null; missingStripeAccount: "manual" | "wait"; } | { frequency: "monthly"; enabled: boolean; minimumCents: number; holdPeriodDays: number; stripeIntegrationId: string | null; missingStripeAccount: "manual" | "wait"; dayOfMonth: number; }) & { activeSince: string | null; lastRunOn: string | null; nextRunOn: string | null; updatedAt: string | null; };

GrizzleeServerClient

Keep this client and its API key on the merchant's server.

ts
class GrizzleeServerClient {
  constructor(options: { baseUrl: string; apiKey: string; fetch?: typeof fetch; });
  getCompany(options?: { page?: number; search?: string; rewardStatus?: "all" | Reward["status"] | "review"; }): Promise<CompanySnapshot>;
  listPlacements(): Promise<Placement[]>;
  getPlacement(key: string): Promise<Placement>;
  setPlacement(key: string, input: SetPlacementInput): Promise<Placement>;
  deletePlacement(key: string): Promise<Placement>;
  createProgram(input: ProgramCreateInput): Promise<Program>;
  updateProgram(id: string, input: ProgramUpdateInput): Promise<Program>;
  deleteProgram(id: string): Promise<ProgramDeletion>;
  listProgramVersions(programId: string): Promise<ProgramVersionList>;
  getProgramVersion(programId: string, version: number): Promise<ProgramVersionDetail>;
  registerPartner(input: PartnerInput & PartnerSignalsInput): Promise<Partner>;
  upsertPartner(input: UpsertPartnerInput): Promise<UpsertPartnerResponse>;
  getPartnerByExternalId(externalId: string): Promise<GetPartnerByExternalIdResponse>;
  updatePartnerByExternalId(externalId: string, input: UpdatePartnerByExternalIdInput): Promise<UpdatePartnerByExternalIdResponse>;
  updatePartner(id: string, input: PartnerUpdateInput & PartnerSignalsInput): Promise<Partner>;
  attribute(input: AttributionInput): Promise<Attribution>;
  attachReferralCode(input: AttachReferralCodeInput): Promise<AttachReferralCodeResponse>;
  getReferralIncentive(input: ReferralIncentiveInput): Promise<ReferralIncentive>;
  reserveIncentive(input: ReserveIncentiveInput): Promise<IncentiveReservationResult>;
  releaseIncentive(reservationId: string): Promise<IncentiveReservation>;
  listIncentiveReservations(input?: { customerId?: string; olderThanDays?: number; }): Promise<{ reservations: IncentiveReservation[]; }>;
  importCustomers(input: CustomerImportInput): Promise<{ imported: number; }>;
  claimReferral(input: ClaimReferralInput): Promise<ClaimReferralResult>;
  sendEvent(event: PlatformEvent): Promise<EventResult>;
  adjustOrder(input: Omit<OrderAdjustmentEvent, "type">): Promise<EventResult>;
  completeOrder(event: OrderEvent, options?: { candidates?: ReferralCandidate[]; reservationId?: string; signals?: IdentitySignals; }): Promise<EventResult>;
  reportMilestone(input: ReportMilestoneInput): Promise<MilestoneResult>;
  revokeMilestone(input: RevokeMilestoneInput): Promise<MilestoneResult>;
  reinstateMilestone(input: ReinstateMilestoneInput): Promise<MilestoneResult>;
  reverseMilestoneReport(input: ReverseMilestoneReportInput): Promise<MilestoneResult>;
  simulate(event: OrderEvent, attribution?: AttributionInput): Promise<{ result: EventResult; rewards: Reward[]; }>;
  approveReward(id: string): Promise<Reward>;
  rejectReward(id: string, input?: RejectRewardInput): Promise<Reward>;
  deliverReward(rewardId: string, input: DeliverRewardInput): Promise<DeliverRewardResponse>;
  failRewardDelivery(rewardId: string, input: FailRewardDeliveryInput): Promise<FailRewardDeliveryResponse>;
  listRewardDeliveries(rewardId: string): Promise<ListRewardDeliveriesResponse>;
  recoverPartnerDebt(externalId: string, debtId: string, input: RecoverPartnerDebtInput): Promise<RecoverPartnerDebtResponse>;
  deliverPartnerCredit(externalId: string, input: DeliverPartnerCreditInput): Promise<DeliverPartnerCreditResponse>;
  recoverPartnerDebts(externalId: string, input: RecoverPartnerDebtsInput): Promise<RecoverPartnerDebtsResponse>;
  createPartnerPayout(partner: PartnerReference, input: CreatePartnerPayoutInput): Promise<CreatePartnerPayoutResponse>;
  markPayoutPaid(payoutId: string, input: MarkPayoutPaidRequest): Promise<MarkPayoutPaidResponse>;
  cancelPayout(payoutId: string, input?: CancelPayoutRequest): Promise<CancelPayoutResponse>;
  getPayoutSchedule(): Promise<GetPayoutScheduleResponse>;
  updatePayoutSchedule(input: UpdatePayoutScheduleInput): Promise<UpdatePayoutScheduleResponse>;
  listPartnerPayouts(partner: PartnerReference, options?: ListPartnerPayoutsOptions): Promise<ListPartnerPayoutsResponse>;
  listPartnerPromoCodes(partner: PartnerReference): Promise<ProviderPromoCode[]>;
  createPartnerPromoCode(partner: PartnerReference, input: ProviderPromoCodeInput): Promise<ProviderPromoCode>;
  renamePartnerPromoCode(partner: PartnerReference, codeId: string, input: RenameProviderPromoCodeInput): Promise<ProviderPromoCode>;
  deactivatePartnerPromoCode(partner: PartnerReference, codeId: string): Promise<ProviderPromoCode>;
  getPartnerSummary(partner: PartnerReference): Promise<GetPartnerSummaryResponse>;
  listPartnerReferrals(partner: PartnerReference, options?: ListPartnerReferralsOptions): Promise<ListPartnerReferralsResponse>;
  listPartnerRewards(partner: PartnerReference, options?: ListPartnerRewardsOptions): Promise<ListPartnerRewardsResponse>;
  erasePartner(partner: PartnerReference): Promise<PartnerErasureResult>;
  eraseCustomer(customerId: string): Promise<CustomerErasureResult>;
  createEmbedSession(input: CreateEmbedSessionInput): Promise<CreateEmbedSessionResponse>;
  revokeEmbedSession(sessionId: string): Promise<RevokeEmbedSessionResponse>;
  getPayout(payoutId: string): Promise<GetPayoutResponse>;
  getWallets(partnerId: string): Promise<WalletBalance[]>;
  redeemCredits(input: { partnerId: string; orderId: string; eventId: string; amountCents: number; }): Promise<CreditRedemption>;
  restoreCredits(id: string, input: { eventId: string; restoredCents: number; }): Promise<CreditRedemption>;
}

verifyWebhook

Verify the untouched request body before parsing JSON or processing an event.

ts
declare const verifyWebhook: (input: { secret: string; body: string; eventId: string; signature: string; now?: number | undefined; toleranceSeconds?: number | undefined; }) => boolean;

parseWebhookEvent

Verify the raw body with verifyWebhook first. Throws for invalid JSON or payloads.

ts
declare const parseWebhookEvent: (body: string) => GrizzleeWebhookEvent;

GrizzleeWebhookEvent

Switch on type to narrow data to that event's payload.

ts
type GrizzleeWebhookEvent = { id: string; companyId: string; type: "order.refunded"; data: OrderRefundedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "order.adjusted"; data: OrderAdjustedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "order.completed"; data: OrderCompletedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "partner.created"; data: PartnerCreatedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.created"; data: RewardCreatedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.approved"; data: RewardApprovedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.reversed"; data: RewardReversedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.restored"; data: RewardRestoredWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.adjusted"; data: RewardAdjustedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.delivered"; data: RewardDeliveredWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.delivery_failed"; data: RewardDeliveryFailedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.debt_recorded"; data: RewardDebtRecordedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "reward.debt_settled"; data: RewardDebtSettledWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "payout.created"; data: PayoutWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "payout.paid"; data: PayoutWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "payout.reversed"; data: PayoutReversedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "payout.failed"; data: PayoutWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "payout.needs_action"; data: PayoutWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "payout.cancelled"; data: PayoutWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "payout.account_required"; data: PayoutAccountRequiredWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "credit.redeemed"; data: CreditRedeemedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "credit.restored"; data: CreditRestoredWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "incentive.flagged"; data: IncentiveFlaggedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "self_referral.detected"; data: SelfReferralDetectedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "fraud.flagged"; data: FraudFlaggedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "referral.displaced"; data: ReferralDisplacedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "milestone.reported"; data: MilestoneReportedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "milestone.revoked"; data: MilestoneRevokedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "milestone.reinstated"; data: MilestoneReinstatedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "milestone.reversed"; data: MilestoneReversedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "partner.erased"; data: PartnerErasedWebhookPayload; createdAt: string; } | { id: string; companyId: string; type: "customer.erased"; data: CustomerErasedWebhookPayload; createdAt: string; };

GrizzleeWebhookEventType

ts
type GrizzleeWebhookEventType = "order.refunded" | "order.adjusted" | "order.completed" | "partner.created" | "reward.created" | "reward.approved" | "reward.reversed" | "reward.restored" | "reward.adjusted" | "reward.delivered" | "reward.delivery_failed" | "reward.debt_recorded" | "reward.debt_settled" | "payout.created" | "payout.paid" | "payout.reversed" | "payout.failed" | "payout.needs_action" | "payout.cancelled" | "payout.account_required" | "credit.redeemed" | "credit.restored" | "incentive.flagged" | "self_referral.detected" | "fraud.flagged" | "referral.displaced" | "milestone.reported" | "milestone.revoked" | "milestone.reinstated" | "milestone.reversed" | "partner.erased" | "customer.erased";

GrizzleeWebhookPayloads

ts
type GrizzleeWebhookPayloads = GrizzleeWebhookPayloads;

WebhookPartnerReference

ts
type WebhookPartnerReference = WebhookPartnerReference;

RewardWebhookPayload

Switch on trigger, or check milestone, to read the order or the milestone.

ts
type RewardWebhookPayload = RewardWebhookFields & RewardWebhookSource;

RewardWebhookFields

ts
type RewardWebhookFields = RewardWebhookFields;

RewardWebhookSource

What earned a reward. Order rewards carry orderId. Milestone rewards carry milestone and no orderId. Payloads queued before milestones existed have no trigger and are order rewards.

ts
type RewardWebhookSource = { trigger?: "order" | undefined; orderId: string; } | { trigger: "milestone"; milestone: string; };

RewardCreatedWebhookPayload

Keeps the original raw reward fields as well as the nested reward.

ts
type RewardCreatedWebhookPayload = RewardWebhookPayload & Reward;

RewardApprovedWebhookPayload

ts
type RewardApprovedWebhookPayload = RewardWebhookPayload & Reward;

RewardReversedWebhookPayload

Sent after a refund, a milestone revocation or a milestone report reversal reverses part or all of a reward.

ts
type RewardReversedWebhookPayload = RewardWebhookPayload & { reversalCents: number; };

RewardRestoredWebhookPayload

Sent after a lower refund total, a milestone reinstatement or a milestone report that brings the count back to the threshold gives back part or all of a reversed reward.

ts
type RewardRestoredWebhookPayload = RewardWebhookPayload & { restoredCents: number; };

RewardAdjustedWebhookPayload

Sent when an order adjustment changed what an order reward is worth. changeCents is signed: positive when the order total went up, negative when it went down.

ts
type RewardAdjustedWebhookPayload = RewardWebhookPayload & { eventId: string; changeCents: number; };

RewardDeliveredWebhookPayload

ts
type RewardDeliveredWebhookPayload = RewardWebhookPayload & { delivery: RewardDelivery; };

RewardDeliveryFailedWebhookPayload

ts
type RewardDeliveryFailedWebhookPayload = RewardWebhookPayload & { delivery: RewardDelivery; };

RewardDebtRecordedWebhookPayload

Sent when a reversal leaves the partner holding part of a reward the merchant already delivered. debt is the new debt with outstandingCents equal to amountCents.

ts
type RewardDebtRecordedWebhookPayload = RewardWebhookPayload & { debt: PartnerDeliveryDebt; };

RewardDebtSettledWebhookPayload

Sent once for each settlement of a delivery debt. reward is the reward the debt belongs to. debt shows its outstandingCents and settlements right after this settlement.

ts
type RewardDebtSettledWebhookPayload = RewardWebhookPayload & { debt: PartnerDeliveryDebt; settlement: DeliveryDebtSettlement; settledCents: number; };

PayoutWebhookPayload

ts
type PayoutWebhookPayload = PayoutWebhookPayload;

PayoutReversedWebhookPayload

ts
type PayoutReversedWebhookPayload = PayoutReversedWebhookPayload;

PayoutAccountRequiredWebhookPayload

Sent when a scheduled run creates no payout for a partner because the schedule waits for a Stripe account and the partner has none. Sent once per wait: later runs that skip the same partner send nothing until the partner is paid or has nothing payable at a run. The amounts are what the run would have paid. The rewards stay payable and roll over.

ts
type PayoutAccountRequiredWebhookPayload = PayoutAccountRequiredWebhookPayload;

PartnerCreatedWebhookPayload

ts
type PartnerCreatedWebhookPayload = PartnerCreatedWebhookPayload;

OrderWebhookPartners

ts
type OrderWebhookPartners = OrderWebhookPartners;

OrderCompletedWebhookPayload

ts
type OrderCompletedWebhookPayload = { type: "order.completed"; customerId: string; orderId: string; occurredAt: string; eventId: string; commissionableCents: number; currency: "CAD" | "USD" | "EUR" | "GBP"; customerDisplayName?: string | undefined; newCustomer?: boolean | undefined; categories?: string[] | undefined; customerOrderNumber?: number | undefined; totalCents?: number | undefined; customerEmail?: string | undefined; incentiveAppliedCents?: number | undefined; } & OrderWebhookPartners & { customerOrderNumber?: number | undefined; reportedCustomerOrderNumber?: number | undefined; incentiveFlag?: IncentiveFlag | undefined; referralSelection?: { winner: { programId: string; partnerId: string; occurredAt: string; type?: "code" | "receipt" | undefined; providerPromoCodeId?: string | undefined; index?: number | undefined; } | null; skipped: { index: number; reason: "expired" | "invalid" | "self_referral" | "wrong_program" | "program_inactive" | "partner_inactive" | "fraud" | "customer_already_referred" | "older"; }[]; } | undefined; };

OrderRefundedWebhookPayload

ts
type OrderRefundedWebhookPayload = { type: "order.refunded"; orderId: string; occurredAt: string; eventId: string; refundedTotalCents?: number | undefined; refundedCommissionableCents?: number | undefined; fullRefund?: boolean | undefined; } & OrderWebhookPartners;

OrderAdjustedWebhookPayload

Sent once for each applied order adjustment. A stale adjustment sends nothing. Each reward whose value changed also sends reward.adjusted.

ts
type OrderAdjustedWebhookPayload = { type: "order.adjusted"; orderId: string; occurredAt: string; eventId: string; reason?: string | undefined; totalCents?: number | undefined; commissionableCents?: number | undefined; } & OrderWebhookPartners & { customerId: string; currency: "CAD" | "USD" | "EUR" | "GBP"; previousTotalCents?: number | undefined; previousCommissionableCents?: number | undefined; rewardIds: string[]; rewardChangeCents: number; };

CreditRedeemedWebhookPayload

ts
type CreditRedeemedWebhookPayload = CreditRedeemedWebhookPayload;

CreditRestoredWebhookPayload

ts
type CreditRestoredWebhookPayload = CreditRestoredWebhookPayload;

IncentiveFlaggedWebhookPayload

Sent with order.completed when Grizzlee accepted an order whose incentiveAppliedCents did not match its reservation.

ts
type IncentiveFlaggedWebhookPayload = IncentiveFlaggedWebhookPayload;

SelfReferralDetectedWebhookPayload

Sent when a new completed order or milestone report matched a linked customer ID or the referring partner's identity signals. blocked: the program created no reward. review: rewardId names the reward held as pending. flagged: rewardId names a reward that follows the usual approval. signals lists the matching signal types, never their values.

ts
type SelfReferralDetectedWebhookPayload = WebhookPartnerReference & SelfReferralMatch & ({ eventId: string; programId: string; customerId: string; rewardId?: string | undefined; } & ({ trigger: "order"; orderId: string; } | { trigger: "milestone"; milestone: string; }));

FraudFlaggedWebhookPayload

Sent when fraud rules fired on a new completed order or milestone report. It covers every rule in fraudRuleIds. Self-referral matches keep their own self_referral.detected event, and a referral that triggers both sends both. blocked: the program created no reward. review: rewardId names the reward held as pending. flagged: rewardId names a reward that follows the usual approval. rules lists rule IDs and signal types, never values.

ts
type FraudFlaggedWebhookPayload = WebhookPartnerReference & FraudMatch & ({ eventId: string; programId: string; customerId: string; rewardId?: string | undefined; } & ({ trigger: "order"; orderId: string; } | { trigger: "milestone"; milestone: string; }));

ReferralDisplacedWebhookPayload

Sent when a referral by another partner took over a customer's attribution in a program before a purchase or milestone locked it. partnerId names the new partner.

ts
type ReferralDisplacedWebhookPayload = ReferralDisplacedWebhookPayload;

MilestoneWebhookFields

Fields of milestone.reported, milestone.revoked, milestone.reinstated and milestone.reversed. partners lists the distinct partners from the decisions and rewards, with top-level partnerId and partnerExternalId when there is one.

ts
type MilestoneWebhookFields = MilestoneWebhookFields;

MilestoneReportedWebhookPayload

Sent once for each new milestone report, rewarded or not.

ts
type MilestoneReportedWebhookPayload = MilestoneReportedWebhookPayload;

MilestoneRevokedWebhookPayload

Sent when a milestone is revoked for a person. Revoking it again while it is revoked sends nothing. After a reinstatement, the next revocation sends it again.

ts
type MilestoneRevokedWebhookPayload = MilestoneRevokedWebhookPayload;

MilestoneReinstatedWebhookPayload

Sent when a revoked milestone is reinstated for a person. A reinstatement of a milestone that is not revoked sends nothing.

ts
type MilestoneReinstatedWebhookPayload = MilestoneReinstatedWebhookPayload;

MilestoneReversedWebhookPayload

Sent when a report is reversed. Reversing a report that is already reversed sends nothing. rewardIds lists every reward for the person and milestone. The report's own rewards and bonuses whose count fell below their saved threshold reverse and also send reward.reversed.

ts
type MilestoneReversedWebhookPayload = MilestoneReversedWebhookPayload;

PartnerErasedWebhookPayload

Sent the first time a merchant erases a partner. The partner keeps its IDs and amounts.

ts
type PartnerErasedWebhookPayload = PartnerErasedWebhookPayload;

CustomerErasedWebhookPayload

Sent the first time a merchant erases a customer. Orders and rewards keep the customer ID.

ts
type CustomerErasedWebhookPayload = CustomerErasedWebhookPayload;