Skip to content
全部能力
商业化packages/commerce/contracts

contracts 能力包

事件 / 身份 / 计费 / 通知的跨包类型契约;commerce 与 iam、queue、webhooks 之间通信的共享 TypeScript 边界。

打开文档
稳定性
稳定
作用域
按租户隔离
边界
packages/commerce/contracts
contracts
记录系统
类型化事件契约
事件类型Payload Schema状态
invoice.paidInvoicePaidV2稳定
subscription.createdSubscriptionV3稳定
subscription.canceledSubscriptionV3稳定
checkout.expiredCheckoutV1Beta

总交易额

$1.24M

活跃记录

8,472

环比增长

+8.4%

成功率

99.6%

packages/commerce/contracts·商业记录
使用方式contracts.ts
typescript
contracts.ts
1import type { BillingEvent, IdentityEvent } from "@nebutra/contracts";
2
3// Cross-package contracts — TypeScript-validated event shapes.
4function onBilling(event: BillingEvent) {
5  if (event.type === "subscription.canceled") {
6    revokeAccess(event.payload.tenantId);
7  }
8}