Kaizen
Browse modulesCheckoutcheckout/serverTypes

Type Alias: HandleWebhookResult

type HandleWebhookResult = 
  | {
  handled: true;
  paymentId: string;
}
  | {
  handled: false;
  reason: "foreign";
}
  | {
  handled: false;
  providerPaymentId: string;
  reason: "unknown_payment";
};

Defined in: server/checkout/payment-service.ts:125

handleWebhook's discriminated routing result (proposal §Idempotent webhook ingestion). Routing outcomes NEVER throw — one exception meaning two opposite HTTP responses was a design error; only the consumer's HTTP layer knows that foreign → 2xx (ack) and unknown_payment → non-2xx (provider redelivers). Genuine ingestion failures (DB errors, a forged signature rejected by the adapter) still propagate as exceptions.