@openrails/billing-ui 0.241.0 → 0.243.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/CHANGELOG.md +27 -11
  2. package/README.md +41 -8
  3. package/dist/admin/billing-admin.d.ts +3 -0
  4. package/dist/admin/components/app-sidebar.d.ts +1 -0
  5. package/dist/admin/components/confirm.d.ts +4 -0
  6. package/dist/admin/components/cursor-pager.d.ts +8 -0
  7. package/dist/admin/components/data-table.d.ts +14 -0
  8. package/dist/admin/components/fact-card.d.ts +5 -0
  9. package/dist/admin/components/form-field-errors.d.ts +3 -0
  10. package/dist/admin/components/linked-table-row.d.ts +5 -0
  11. package/dist/admin/components/logo.d.ts +3 -0
  12. package/dist/admin/components/no-access.d.ts +3 -0
  13. package/dist/admin/components/no-merchants.d.ts +1 -0
  14. package/dist/admin/components/notification-bell.d.ts +2 -0
  15. package/dist/admin/components/route-error.d.ts +3 -0
  16. package/dist/admin/components/site-header.d.ts +9 -0
  17. package/dist/admin/components/status-badge.d.ts +3 -0
  18. package/dist/admin/components/typed-confirm-dialog.d.ts +11 -0
  19. package/dist/admin/components/ui/alert-dialog.d.ts +18 -0
  20. package/dist/admin/components/ui/avatar.d.ts +11 -0
  21. package/dist/admin/components/ui/badge.d.ts +7 -0
  22. package/dist/admin/components/ui/breadcrumb.d.ts +10 -0
  23. package/dist/admin/components/ui/button.d.ts +8 -0
  24. package/dist/admin/components/ui/card.d.ts +11 -0
  25. package/dist/admin/components/ui/chart.d.ts +44 -0
  26. package/dist/admin/components/ui/dialog.d.ts +17 -0
  27. package/dist/admin/components/ui/dropdown-menu.d.ts +29 -0
  28. package/dist/admin/components/ui/input.d.ts +3 -0
  29. package/dist/admin/components/ui/label.d.ts +3 -0
  30. package/dist/admin/components/ui/select.d.ts +15 -0
  31. package/dist/admin/components/ui/separator.d.ts +3 -0
  32. package/dist/admin/components/ui/sheet.d.ts +14 -0
  33. package/dist/admin/components/ui/sidebar.d.ts +63 -0
  34. package/dist/admin/components/ui/skeleton.d.ts +2 -0
  35. package/dist/admin/components/ui/sonner.d.ts +3 -0
  36. package/dist/admin/components/ui/switch.d.ts +5 -0
  37. package/dist/admin/components/ui/table.d.ts +10 -0
  38. package/dist/admin/components/ui/tabs.d.ts +10 -0
  39. package/dist/admin/components/ui/textarea.d.ts +3 -0
  40. package/dist/admin/components/ui/tooltip.d.ts +6 -0
  41. package/dist/admin/context.d.ts +1193 -0
  42. package/dist/admin/hooks/use-mobile.d.ts +1 -0
  43. package/dist/admin/index.d.ts +5 -0
  44. package/dist/admin/layouts/app-layout.d.ts +4 -0
  45. package/dist/admin/lib/api/client.d.ts +64 -0
  46. package/dist/admin/lib/api/copilot.d.ts +6 -0
  47. package/dist/admin/lib/api/credit-endpoints.d.ts +8 -0
  48. package/dist/admin/lib/api/credit-types.d.ts +9 -0
  49. package/dist/admin/lib/api/endpoints.d.ts +133 -0
  50. package/dist/admin/lib/api/index.d.ts +89 -0
  51. package/dist/admin/lib/api/invoice-profile-endpoints.d.ts +6 -0
  52. package/dist/admin/lib/api/metrics.d.ts +68 -0
  53. package/dist/admin/lib/api/order-endpoints.d.ts +21 -0
  54. package/dist/admin/lib/api/types.d.ts +122 -0
  55. package/dist/admin/lib/auth.d.ts +6 -0
  56. package/dist/admin/lib/capabilities.d.ts +13 -0
  57. package/dist/admin/lib/chunk-error.d.ts +1 -0
  58. package/dist/admin/lib/confirm.d.ts +11 -0
  59. package/dist/admin/lib/credit-queries.d.ts +23 -0
  60. package/dist/admin/lib/csv.d.ts +3 -0
  61. package/dist/admin/lib/cursor-pages.d.ts +13 -0
  62. package/dist/admin/lib/dialog-width.d.ts +6 -0
  63. package/dist/admin/lib/dom.d.ts +1 -0
  64. package/dist/admin/lib/duration.d.ts +3 -0
  65. package/dist/admin/lib/format.d.ts +23 -0
  66. package/dist/admin/lib/mount.d.ts +6 -0
  67. package/dist/admin/lib/mutations.d.ts +125 -0
  68. package/dist/admin/lib/order-queries.d.ts +29 -0
  69. package/dist/admin/lib/queries.d.ts +369 -0
  70. package/dist/admin/lib/query-client.d.ts +3 -0
  71. package/dist/admin/lib/toast.d.ts +10 -0
  72. package/dist/admin/lib/utils.d.ts +2 -0
  73. package/dist/admin/messages.d.ts +670 -0
  74. package/dist/admin/navigation.d.ts +14 -0
  75. package/dist/admin/pages/catalog/application-dialog.d.ts +2 -0
  76. package/dist/admin/pages/catalog/copilot-panel.d.ts +4 -0
  77. package/dist/admin/pages/catalog/index.d.ts +4 -0
  78. package/dist/admin/pages/catalog/meter-form.d.ts +6 -0
  79. package/dist/admin/pages/catalog/metering-model.d.ts +67 -0
  80. package/dist/admin/pages/catalog/metering.d.ts +3 -0
  81. package/dist/admin/pages/catalog/price-detail.d.ts +2 -0
  82. package/dist/admin/pages/catalog/price-format.d.ts +3 -0
  83. package/dist/admin/pages/catalog/price-wizard-logic.d.ts +20 -0
  84. package/dist/admin/pages/catalog/price-wizard.d.ts +10 -0
  85. package/dist/admin/pages/catalog/psp-links.d.ts +10 -0
  86. package/dist/admin/pages/catalog/rate-card-editor.d.ts +10 -0
  87. package/dist/admin/pages/customers/credit-form.d.ts +14 -0
  88. package/dist/admin/pages/customers/credits.d.ts +5 -0
  89. package/dist/admin/pages/customers/default-card-badges.d.ts +3 -0
  90. package/dist/admin/pages/customers/detail.d.ts +5 -0
  91. package/dist/admin/pages/customers/grant-duration.d.ts +32 -0
  92. package/dist/admin/pages/customers/index.d.ts +2 -0
  93. package/dist/admin/pages/customers/invoice-profile-model.d.ts +18 -0
  94. package/dist/admin/pages/customers/invoice-profile.d.ts +9 -0
  95. package/dist/admin/pages/dashboard/index.d.ts +2 -0
  96. package/dist/admin/pages/dashboard/lib.d.ts +48 -0
  97. package/dist/admin/pages/dashboard/range-picker.d.ts +1 -0
  98. package/dist/admin/pages/dashboard/range.d.ts +34 -0
  99. package/dist/admin/pages/dashboard/reports-model.d.ts +29 -0
  100. package/dist/admin/pages/dashboard/reports.d.ts +2 -0
  101. package/dist/admin/pages/dashboard/use-range.d.ts +5 -0
  102. package/dist/admin/pages/dashboard/widget-editor.d.ts +8 -0
  103. package/dist/admin/pages/dashboard/widget-tile.d.ts +9 -0
  104. package/dist/admin/pages/dashboard/widget-viz.d.ts +12 -0
  105. package/dist/admin/pages/ops/index.d.ts +2 -0
  106. package/dist/admin/pages/orders/detail.d.ts +5 -0
  107. package/dist/admin/pages/orders/index.d.ts +1 -0
  108. package/dist/admin/pages/orders/model.d.ts +7 -0
  109. package/dist/admin/pages/payments/attempts.d.ts +7 -0
  110. package/dist/admin/pages/payments/detail.d.ts +2 -0
  111. package/dist/admin/pages/payments/health-model.d.ts +149 -0
  112. package/dist/admin/pages/payments/health.d.ts +2 -0
  113. package/dist/admin/pages/payments/index.d.ts +2 -0
  114. package/dist/admin/pages/settings/configuration-edit.d.ts +9 -0
  115. package/dist/admin/pages/settings/index.d.ts +9 -0
  116. package/dist/admin/pages/settings/notifications.d.ts +2 -0
  117. package/dist/admin/pages/settings/setting-fields.d.ts +20 -0
  118. package/dist/admin/pages/subscriptions/change-subscription-dialog.d.ts +16 -0
  119. package/dist/admin/pages/subscriptions/detail.d.ts +2 -0
  120. package/dist/admin/pages/subscriptions/dunning.d.ts +2 -0
  121. package/dist/admin/pages/subscriptions/index.d.ts +2 -0
  122. package/dist/admin/pages/subscriptions/subscription-change-options.d.ts +23 -0
  123. package/dist/admin/pages/subscriptions/views.d.ts +15 -0
  124. package/dist/admin/router.d.ts +32 -0
  125. package/dist/admin/routes.d.ts +5 -0
  126. package/dist/admin/summary.d.ts +27 -0
  127. package/dist/admin/theme.d.ts +2 -0
  128. package/dist/admin/types.d.ts +56 -0
  129. package/dist/admin/ui-context.d.ts +14 -0
  130. package/dist/admin-attempts-lAoW-Urd.js +419 -0
  131. package/dist/admin-attempts-lAoW-Urd.js.map +1 -0
  132. package/dist/admin-auth-DQGHtt0j.js +14 -0
  133. package/dist/admin-auth-DQGHtt0j.js.map +1 -0
  134. package/dist/admin-badge-DR5-1qd8.js +31 -0
  135. package/dist/admin-badge-DR5-1qd8.js.map +1 -0
  136. package/dist/admin-button-CTL3DgOt.js +46 -0
  137. package/dist/admin-button-CTL3DgOt.js.map +1 -0
  138. package/dist/admin-capabilities-BuigAgtm.js +59 -0
  139. package/dist/admin-capabilities-BuigAgtm.js.map +1 -0
  140. package/dist/admin-card-bzAks3-3.js +51 -0
  141. package/dist/admin-card-bzAks3-3.js.map +1 -0
  142. package/dist/admin-catalog-CC7I4n0_.js +1189 -0
  143. package/dist/admin-catalog-CC7I4n0_.js.map +1 -0
  144. package/dist/admin-confirm-katGq0Qo.js +12 -0
  145. package/dist/admin-confirm-katGq0Qo.js.map +1 -0
  146. package/dist/admin-csv-CPoNZj2D.js +16 -0
  147. package/dist/admin-csv-CPoNZj2D.js.map +1 -0
  148. package/dist/admin-customers-D8u5gq3M.js +160 -0
  149. package/dist/admin-customers-D8u5gq3M.js.map +1 -0
  150. package/dist/admin-dashboard-DqqFjOzq.js +420 -0
  151. package/dist/admin-dashboard-DqqFjOzq.js.map +1 -0
  152. package/dist/admin-data-table-qfXLOFmN.js +96 -0
  153. package/dist/admin-data-table-qfXLOFmN.js.map +1 -0
  154. package/dist/admin-detail-5aNNvrc0.js +324 -0
  155. package/dist/admin-detail-5aNNvrc0.js.map +1 -0
  156. package/dist/admin-detail-7p684Uyc.js +342 -0
  157. package/dist/admin-detail-7p684Uyc.js.map +1 -0
  158. package/dist/admin-detail-CGOyqs7s.js +1312 -0
  159. package/dist/admin-detail-CGOyqs7s.js.map +1 -0
  160. package/dist/admin-detail-DUAJQg8G.js +710 -0
  161. package/dist/admin-detail-DUAJQg8G.js.map +1 -0
  162. package/dist/admin-dialog-BjuKI5Hp.js +88 -0
  163. package/dist/admin-dialog-BjuKI5Hp.js.map +1 -0
  164. package/dist/admin-dialog-width-BPrgdYlj.js +6 -0
  165. package/dist/admin-dialog-width-BPrgdYlj.js.map +1 -0
  166. package/dist/admin-dom-uMmZzRvU.js +149 -0
  167. package/dist/admin-dom-uMmZzRvU.js.map +1 -0
  168. package/dist/admin-dropdown-menu-BW1D_h6s.js +69 -0
  169. package/dist/admin-dropdown-menu-BW1D_h6s.js.map +1 -0
  170. package/dist/admin-dunning-B2zgtrOo.js +10 -0
  171. package/dist/admin-dunning-B2zgtrOo.js.map +1 -0
  172. package/dist/admin-fact-card-DO_fHosg.js +20 -0
  173. package/dist/admin-fact-card-DO_fHosg.js.map +1 -0
  174. package/dist/admin-form-field-errors-hbUMIriS.js +14 -0
  175. package/dist/admin-form-field-errors-hbUMIriS.js.map +1 -0
  176. package/dist/admin-format-DoohJ7Fg.js +136 -0
  177. package/dist/admin-format-DoohJ7Fg.js.map +1 -0
  178. package/dist/admin-health-B4jN2LwR.js +983 -0
  179. package/dist/admin-health-B4jN2LwR.js.map +1 -0
  180. package/dist/admin-input-CcfQfJFN.js +17 -0
  181. package/dist/admin-input-CcfQfJFN.js.map +1 -0
  182. package/dist/admin-invoice-profile-model-Cgjy3zV8.js +53 -0
  183. package/dist/admin-invoice-profile-model-Cgjy3zV8.js.map +1 -0
  184. package/dist/admin-label-BiEN5cjb.js +15 -0
  185. package/dist/admin-label-BiEN5cjb.js.map +1 -0
  186. package/dist/admin-linked-table-row-BsaUruCN.js +26 -0
  187. package/dist/admin-linked-table-row-BsaUruCN.js.map +1 -0
  188. package/dist/admin-metering-BGAXbT23.js +1702 -0
  189. package/dist/admin-metering-BGAXbT23.js.map +1 -0
  190. package/dist/admin-ops-B3mcr76u.js +217 -0
  191. package/dist/admin-ops-B3mcr76u.js.map +1 -0
  192. package/dist/admin-orders-dxC99Idl.js +192 -0
  193. package/dist/admin-orders-dxC99Idl.js.map +1 -0
  194. package/dist/admin-payments-Bs7HSfP0.js +246 -0
  195. package/dist/admin-payments-Bs7HSfP0.js.map +1 -0
  196. package/dist/admin-price-detail-DRquxpA9.js +482 -0
  197. package/dist/admin-price-detail-DRquxpA9.js.map +1 -0
  198. package/dist/admin-price-format-DM1qORWI.js +44 -0
  199. package/dist/admin-price-format-DM1qORWI.js.map +1 -0
  200. package/dist/admin-price-wizard-CI7K-2Nz.js +357 -0
  201. package/dist/admin-price-wizard-CI7K-2Nz.js.map +1 -0
  202. package/dist/admin-range-picker-Dr2M1EZr.js +192 -0
  203. package/dist/admin-range-picker-Dr2M1EZr.js.map +1 -0
  204. package/dist/admin-reports-CywKLiSA.js +320 -0
  205. package/dist/admin-reports-CywKLiSA.js.map +1 -0
  206. package/dist/admin-select-DBgprVW6.js +81 -0
  207. package/dist/admin-select-DBgprVW6.js.map +1 -0
  208. package/dist/admin-settings-Bmoy95uO.js +1434 -0
  209. package/dist/admin-settings-Bmoy95uO.js.map +1 -0
  210. package/dist/admin-skeleton-DsM7crYi.js +14 -0
  211. package/dist/admin-skeleton-DsM7crYi.js.map +1 -0
  212. package/dist/admin-status-badge-BFPgo71d.js +38 -0
  213. package/dist/admin-status-badge-BFPgo71d.js.map +1 -0
  214. package/dist/admin-subscriptions-CLYc_HEV.js +301 -0
  215. package/dist/admin-subscriptions-CLYc_HEV.js.map +1 -0
  216. package/dist/admin-switch-BJUxLCsa.js +20 -0
  217. package/dist/admin-switch-BJUxLCsa.js.map +1 -0
  218. package/dist/admin-table-CH9TrXJf.js +61 -0
  219. package/dist/admin-table-CH9TrXJf.js.map +1 -0
  220. package/dist/admin-tabs-528FJMjt.js +46 -0
  221. package/dist/admin-tabs-528FJMjt.js.map +1 -0
  222. package/dist/admin-textarea-DEz38RaI.js +15 -0
  223. package/dist/admin-textarea-DEz38RaI.js.map +1 -0
  224. package/dist/admin-typed-confirm-dialog-DU7m9-O7.js +66 -0
  225. package/dist/admin-typed-confirm-dialog-DU7m9-O7.js.map +1 -0
  226. package/dist/admin-utils-BK4Vh1o_.js +1809 -0
  227. package/dist/admin-utils-BK4Vh1o_.js.map +1 -0
  228. package/dist/admin-widget-viz-Da48c-Zf.js +581 -0
  229. package/dist/admin-widget-viz-Da48c-Zf.js.map +1 -0
  230. package/dist/admin.css +3 -0
  231. package/dist/admin.js +2164 -0
  232. package/dist/admin.js.map +1 -0
  233. package/dist/appearance.d.ts +1 -1
  234. package/dist/client/generated/error-codes.d.ts +1 -1
  235. package/dist/client/generated/routes.d.ts +2156 -189
  236. package/dist/client/generated/wire.d.ts +1265 -50
  237. package/dist/client/types.d.ts +0 -1
  238. package/dist/{client-Cxz_miQj.js → client-PjivPHmE.js} +2 -3
  239. package/dist/client-PjivPHmE.js.map +1 -0
  240. package/dist/client.js +1 -1
  241. package/dist/{hooks-aKefXeMO.js → hooks-Ckd8F2JF.js} +8 -8
  242. package/dist/hooks-Ckd8F2JF.js.map +1 -0
  243. package/dist/index.d.ts +1 -1
  244. package/dist/index.js +12 -12
  245. package/dist/index.js.map +1 -1
  246. package/dist/lib/{offer-label.d.ts → price-label.d.ts} +1 -1
  247. package/dist/locales/de.js +1 -1
  248. package/dist/locales/de.js.map +1 -1
  249. package/dist/locales/en.d.ts +1 -1
  250. package/dist/locales/en.js +1 -1
  251. package/dist/locales/en.js.map +1 -1
  252. package/dist/locales/es.js +1 -1
  253. package/dist/locales/es.js.map +1 -1
  254. package/dist/locales/ja.js +1 -1
  255. package/dist/locales/ja.js.map +1 -1
  256. package/dist/locales/ko.js +1 -1
  257. package/dist/locales/ko.js.map +1 -1
  258. package/dist/locales/zh.js +1 -1
  259. package/dist/locales/zh.js.map +1 -1
  260. package/dist/{offers.d.ts → product-list.d.ts} +5 -5
  261. package/dist/react.js +1 -1
  262. package/dist/styles.css +1 -1
  263. package/package.json +28 -6
  264. package/dist/client-Cxz_miQj.js.map +0 -1
  265. package/dist/hooks-aKefXeMO.js.map +0 -1
@@ -2,6 +2,74 @@ export type ListPage<T> = {
2
2
  data: T[];
3
3
  next_cursor: string | null;
4
4
  };
5
+ export type AcknowledgeHostEventsParams = {
6
+ host_event_ids?: string[];
7
+ };
8
+ export type AcknowledgeNotificationEventsParams = {
9
+ notification_ids?: string[];
10
+ };
11
+ export type AdminAccess = {
12
+ admin: "none" | "read" | "update";
13
+ catalog: "none" | "read" | "update";
14
+ merchant_config: "none" | "read" | "update";
15
+ metrics: boolean;
16
+ scope_id: string;
17
+ assistants: AdminAssistants;
18
+ application_permissions: ("merchant:catalog:manage" | "merchant:catalog:read" | "merchant:config:manage" | "merchant:config:read" | "merchant:customer:manage" | "merchant:customer:read" | "merchant:customers:read" | "merchant:entitlements:read" | "merchant:events:read" | "merchant:metrics:read" | "merchant:orders:manage" | "merchant:usage:manage" | "merchant:usage:read" | "root:admin-rate-limits:unlock" | "root:catalog:manage" | "root:catalog:read" | "root:config:manage" | "root:config:read" | "root:customer:manage" | "root:customer:read" | "root:customers:read" | "root:entitlements:read" | "root:events:read" | "root:merchants:delete" | "root:merchants:read" | "root:merchants:restore" | "root:metrics:read" | "root:orders:manage" | "root:usage:manage" | "root:usage:read" | "root:worker-health:read")[];
19
+ };
20
+ export type AdminAssistants = {
21
+ catalog_copilot: boolean;
22
+ catalog_drafting: boolean;
23
+ };
24
+ export type Admission = {
25
+ request_id: string;
26
+ customer_id: string;
27
+ allowed: boolean;
28
+ blocked_by: "abuse" | "budget" | "money" | null;
29
+ deny_code: string | null;
30
+ retry_after_seconds: number | null;
31
+ currency: string;
32
+ estimated_amount: string;
33
+ start_capacity_amount: string;
34
+ state: "captured" | "expired" | "open" | "released" | null;
35
+ expires_at: string | null;
36
+ captured_amount: string | null;
37
+ replayed: boolean;
38
+ };
39
+ export type AdmissionBatchResult = {
40
+ items: AdmissionResult[];
41
+ };
42
+ export type AdmissionResult = {
43
+ status: number;
44
+ admission: Admission | null;
45
+ error: ErrorDetails | null;
46
+ };
47
+ export type AdmissionVerdict = {
48
+ status: number;
49
+ admission: Admission | null;
50
+ error: ErrorDetails | null;
51
+ };
52
+ export type AdmitBatchParams = {
53
+ items?: AdmitParams[];
54
+ };
55
+ export type AdmitBatchResult = {
56
+ items: AdmissionVerdict[];
57
+ };
58
+ export type AdmitParams = {
59
+ request_id?: string;
60
+ customer_id?: string;
61
+ invoker?: string;
62
+ invoker_type?: "customer" | "delegated";
63
+ trust_level?: string;
64
+ resource?: string;
65
+ currency?: string;
66
+ estimated_amount?: string;
67
+ usage?: UsageEstimate;
68
+ accrual_rate_delta_per_hour?: string;
69
+ source?: string;
70
+ expires_at?: string;
71
+ roles?: string[];
72
+ };
5
73
  export type Agreement = {
6
74
  id: string;
7
75
  kind: "card_on_file" | "recurring" | "unscheduled";
@@ -25,6 +93,65 @@ export type AgreementSubscription = {
25
93
  billing_interval_hours: number | null;
26
94
  next_charge_at: string | null;
27
95
  };
96
+ export type AlertWebhook = {
97
+ id: string;
98
+ name: string | null;
99
+ destination_host: string;
100
+ format: "discord" | "generic" | "slack";
101
+ enabled: boolean;
102
+ created_at: string;
103
+ updated_at: string;
104
+ };
105
+ export type Allowance = {
106
+ included?: number;
107
+ };
108
+ export type Application = {
109
+ schema_version?: number;
110
+ prune?: boolean;
111
+ entitlement_replacements?: EntitlementReplacement[];
112
+ products?: Record<string, ApplyProduct>;
113
+ meters?: Record<string, ApplyMeter>;
114
+ };
115
+ export type ApplyMeter = {
116
+ event_type?: string | null;
117
+ value_property?: string | null;
118
+ aggregation?: "count" | "latest" | "max" | "min" | "sum" | "unique_count" | null;
119
+ unit?: string | null;
120
+ group_by?: Record<string, string> | null;
121
+ };
122
+ export type ApplyPrice = {
123
+ id?: string;
124
+ currency?: string | null;
125
+ unit_amount?: string | null;
126
+ access_duration_hours?: number | null;
127
+ billing_interval_hours?: number | null;
128
+ archived?: boolean | null;
129
+ trial_unit_amount?: string | null;
130
+ trial_duration_hours?: number | null;
131
+ customer_amount?: CustomerAmount | null;
132
+ quantity?: Quantity | null;
133
+ psps?: string[] | null;
134
+ psp_links?: Record<string, Record<string, string>> | null;
135
+ amount?: string;
136
+ access_duration?: string | null;
137
+ billing_interval?: string | null;
138
+ trial_duration?: string | null;
139
+ };
140
+ export type ApplyProduct = {
141
+ display_name?: string | null;
142
+ description?: string | null;
143
+ tier_group?: string | null;
144
+ tier_rank?: number | null;
145
+ archived?: boolean | null;
146
+ ownership?: "consumable" | "extend" | "unique" | null;
147
+ entitlements?: string[];
148
+ credit_grant?: CreditGrantSpec | null;
149
+ prices?: Record<string, ApplyPrice>;
150
+ rate_cards?: RateCard[] | null;
151
+ };
152
+ export type AskCatalogParams = {
153
+ question?: string;
154
+ };
28
155
  export type Balance = {
29
156
  customer_id: string;
30
157
  currency: string;
@@ -38,6 +165,15 @@ export type Balance = {
38
165
  as_of: string;
39
166
  depletes_at: string | null;
40
167
  };
168
+ export type BalanceHostEvent = {
169
+ customer_id: string;
170
+ currency: string;
171
+ available_amount: string;
172
+ owed_amount: string;
173
+ accrual_rate_per_hour: string;
174
+ as_of: string;
175
+ depletes_at: string;
176
+ };
41
177
  export type BalanceTransaction = {
42
178
  id: string;
43
179
  customer_id: string;
@@ -59,12 +195,58 @@ export type BillingAddress = {
59
195
  postal_code: string | null;
60
196
  country: string | null;
61
197
  };
198
+ export type BillingArchiveImport = {
199
+ merchant_id: string;
200
+ digest: string;
201
+ rows: string;
202
+ already_imported: boolean;
203
+ };
62
204
  export type BillingDetails = {
63
205
  name: string | null;
64
206
  email: string | null;
65
207
  phone: string | null;
66
208
  address: BillingAddress | null;
67
209
  };
210
+ export type BillingImportResult = {
211
+ imported: string[];
212
+ skipped: string[];
213
+ blocked: string[];
214
+ reasons: Record<string, string> | null;
215
+ };
216
+ export type BillingPolicy = {
217
+ name: string;
218
+ kind: string;
219
+ outstanding_cap_amount?: string;
220
+ spend_windows?: BudgetWindow[];
221
+ accrual_rate_cap_per_hour?: string;
222
+ accrual_rate_window_seconds?: number;
223
+ collection_threshold_amount?: string;
224
+ delinquency_grace_days?: number;
225
+ delinquency_amount_floor?: string;
226
+ collection_cycle_boundary?: string;
227
+ bad_spend_windows?: BudgetWindow[];
228
+ policy_currency?: string;
229
+ };
230
+ export type BillingPolicyBinding = {
231
+ policy: string;
232
+ tier?: string;
233
+ };
234
+ export type BudgetWindow = {
235
+ key: string;
236
+ window_seconds: number;
237
+ limit: string;
238
+ currency?: string;
239
+ };
240
+ export type CancelEvidence = {
241
+ kind?: string;
242
+ at?: string;
243
+ schedule_live?: boolean;
244
+ };
245
+ export type CancelSubscriptionParams = {
246
+ reason?: string;
247
+ revoke_access?: boolean;
248
+ account_deletion?: boolean;
249
+ };
68
250
  export type Capabilities = {
69
251
  route_groups: Record<string, boolean> | null;
70
252
  features: Record<string, boolean> | null;
@@ -76,6 +258,41 @@ export type CaptchaConfig = {
76
258
  action: string;
77
259
  token_header: string;
78
260
  };
261
+ export type CaptureAdmissionBatchParams = {
262
+ items?: CaptureAdmissionParams[];
263
+ };
264
+ export type CaptureAdmissionParams = {
265
+ request_id?: string;
266
+ usage?: CaptureUsage;
267
+ amount?: string;
268
+ };
269
+ export type CaptureBatchResult = {
270
+ items: CaptureResult[];
271
+ };
272
+ export type CaptureReceipt = {
273
+ request_id: string;
274
+ customer_id: string;
275
+ currency: string;
276
+ estimated_amount: string;
277
+ amount: string;
278
+ charges: UsageCharge[];
279
+ usage_event_id: string | null;
280
+ balance_transaction_id: string | null;
281
+ replayed: boolean;
282
+ };
283
+ export type CaptureResult = {
284
+ status: number;
285
+ receipt: CaptureReceipt | null;
286
+ error: ErrorDetails | null;
287
+ };
288
+ export type CaptureUsage = {
289
+ event_type?: string;
290
+ resource?: string;
291
+ metadata?: Record<string, unknown>;
292
+ source?: string;
293
+ source_id?: string;
294
+ dimensions?: Record<string, number>;
295
+ };
79
296
  export type CardDetails = {
80
297
  brand: string | null;
81
298
  last4: string | null;
@@ -96,6 +313,104 @@ export type Cart = {
96
313
  last_changed_at: string | null;
97
314
  expires_at: string | null;
98
315
  };
316
+ export type CatalogAnswer = {
317
+ answer: string;
318
+ evidence: CatalogEvidence[];
319
+ drafts: CatalogDraft[];
320
+ };
321
+ export type CatalogApplicationReceipt = {
322
+ application_id: string;
323
+ base_revision: number;
324
+ applied_revision: number;
325
+ replayed: boolean;
326
+ products_changed: number;
327
+ prices_changed: number;
328
+ entitlement_changes: EntitlementChange[];
329
+ changes: CatalogChange[];
330
+ conflicts: CatalogConflict[];
331
+ };
332
+ export type CatalogChange = {
333
+ object: "meter" | "price" | "product";
334
+ key: string;
335
+ product_key: string | null;
336
+ fields: string[];
337
+ revision: number;
338
+ };
339
+ export type CatalogConflict = {
340
+ object: "meter" | "price" | "product";
341
+ key: string;
342
+ product_key: string | null;
343
+ currency: string | null;
344
+ fields: CatalogFieldConflict[];
345
+ };
346
+ export type CatalogDraft = {
347
+ kind: "new_price" | "price_change" | "refused";
348
+ price_change: PriceChangeDraft | null;
349
+ new_price: NewPriceDraft | null;
350
+ refusal: CatalogDraftRefusal | null;
351
+ };
352
+ export type CatalogDraftRefusal = {
353
+ code: string;
354
+ reason: string;
355
+ workaround: string;
356
+ };
357
+ export type CatalogEvidence = {
358
+ tool: string;
359
+ args: string;
360
+ summary: string;
361
+ };
362
+ export type CatalogFieldConflict = {
363
+ field: string;
364
+ file_value: unknown | null;
365
+ live_value: unknown | null;
366
+ set_by: string;
367
+ set_at: string;
368
+ };
369
+ export type ChangeSubscriptionParams = {
370
+ price_id?: string;
371
+ quantity?: number;
372
+ reason?: string;
373
+ };
374
+ export type CheckEntitlementsParams = {
375
+ customer_id?: string;
376
+ entitlements?: string[];
377
+ prefixes?: string[];
378
+ prefix_limit?: number;
379
+ at?: string;
380
+ };
381
+ export type CheckoutRoutingMatch = {
382
+ currency?: string;
383
+ product?: string;
384
+ price?: string;
385
+ mode?: string;
386
+ country?: string;
387
+ };
388
+ export type CheckoutRoutingRule = {
389
+ match?: CheckoutRoutingMatch;
390
+ prefer: string[];
391
+ };
392
+ export type CreateAlertWebhookParams = {
393
+ name?: string;
394
+ url?: string;
395
+ format?: "discord" | "generic" | "slack";
396
+ enabled?: boolean | null;
397
+ };
398
+ export type CreateCreditGrantBatchParams = {
399
+ items?: CreateCreditGrantParams[];
400
+ };
401
+ export type CreateCreditGrantBatchResult = {
402
+ items: CreditGrant[];
403
+ };
404
+ export type CreateCreditGrantParams = {
405
+ customer_id?: string;
406
+ currency?: string;
407
+ amount?: string;
408
+ source_id?: string;
409
+ source?: string;
410
+ invoker?: string;
411
+ expires_at?: string;
412
+ description?: string;
413
+ };
99
414
  export type CreateMyOrderParams = {
100
415
  lines?: OrderLineParams[];
101
416
  cart?: boolean;
@@ -107,28 +422,143 @@ export type CreateNetworkLinkParams = {
107
422
  challenge_id?: string;
108
423
  id_token?: string;
109
424
  };
425
+ export type CreateOrderParams = {
426
+ customer_id?: string;
427
+ lines?: OrderLineParams[];
428
+ expires_at?: string;
429
+ checkout?: OrderCheckoutParams;
430
+ };
431
+ export type CreatePSPParams = {
432
+ key?: string;
433
+ rail?: "ccbill" | "nmi" | "solana" | "stripe";
434
+ account_id?: string;
435
+ settings?: Record<string, unknown> | null;
436
+ credentials?: Record<string, string> | null;
437
+ };
110
438
  export type CreatePaymentMethodParams = {
111
439
  psp_id?: string;
112
440
  token?: string;
113
441
  card?: CardEntry;
114
442
  billing_details?: BillingDetails;
115
443
  };
444
+ export type CreatePriceMigrationParams = {
445
+ from_price_id?: string;
446
+ product_key?: string;
447
+ price_key?: string;
448
+ to_price_id?: string;
449
+ effective_at?: string;
450
+ acknowledge_short_notice?: boolean;
451
+ fallback_policy?: "cancel_at_period_end" | "keep_grandfathered";
452
+ archive_source?: boolean;
453
+ };
454
+ export type CreatePriceParams = {
455
+ customer_amount?: CustomerAmount;
456
+ quantity?: Quantity;
457
+ product_id?: string;
458
+ product_key?: string;
459
+ product_data?: CreatePriceProduct;
460
+ key?: string;
461
+ unit_amount: string;
462
+ currency: string;
463
+ access_duration_hours?: number;
464
+ billing_interval_hours?: number;
465
+ trial_unit_amount?: string;
466
+ trial_duration_hours?: number;
467
+ psps?: string[];
468
+ psp_links?: Record<string, Record<string, string>>;
469
+ archived?: boolean;
470
+ expected_revision?: number;
471
+ };
472
+ export type CreatePriceProduct = {
473
+ key: string;
474
+ display_name: string;
475
+ description?: string;
476
+ };
477
+ export type CreateProductAccessBatchParams = {
478
+ items?: CreateProductAccessParams[];
479
+ };
480
+ export type CreateProductAccessBatchResult = {
481
+ items: ProductAccessGrant[];
482
+ };
483
+ export type CreateProductAccessParams = {
484
+ customer_id?: string;
485
+ product_id?: string;
486
+ hours?: number | null;
487
+ ends_at?: string | null;
488
+ reason?: "comp" | "import" | "migration" | "staff";
489
+ note?: string | null;
490
+ };
491
+ export type CreateProductParams = {
492
+ key?: string;
493
+ display_name?: string;
494
+ description?: string;
495
+ entitlements?: string[];
496
+ credit_grant?: CreditGrantSpec;
497
+ tier_group?: string;
498
+ tier_rank?: number;
499
+ ownership?: "consumable" | "extend" | "unique";
500
+ archived?: boolean;
501
+ };
502
+ export type CreateProvisioningTokenParams = {
503
+ name?: string;
504
+ };
505
+ export type CreatedProvisioningToken = {
506
+ id: string;
507
+ name: string;
508
+ declared: boolean;
509
+ created_at: string;
510
+ last_used_at: string | null;
511
+ token: string;
512
+ };
513
+ export type CreditGrant = {
514
+ id: string;
515
+ customer_id: string;
516
+ currency: string;
517
+ amount: string;
518
+ spent_amount: string;
519
+ remaining_amount: string;
520
+ revoked_amount: string;
521
+ expired_amount: string;
522
+ state: "active" | "expired" | "revoked" | "scheduled" | "spent" | "terminated";
523
+ source_type: string;
524
+ source_id: string | null;
525
+ description: string | null;
526
+ starts_at: string;
527
+ expires_at: string | null;
528
+ created_at: string;
529
+ terminated_at: string | null;
530
+ termination_reason: string | null;
531
+ replayed: boolean;
532
+ };
116
533
  export type CreditGrantSpec = {
117
534
  currency: string;
118
535
  amount?: string;
119
536
  from_payment?: boolean;
120
537
  expires_after_days?: number;
121
538
  };
539
+ export type CreditLimit = {
540
+ currency: string;
541
+ amount: string;
542
+ };
122
543
  export type CurrencyUnits = {
123
544
  code: string;
124
545
  decimals: number;
125
546
  minor_decimals: number;
126
547
  };
548
+ export type Customer = {
549
+ id: string;
550
+ contact: CustomerContact | null;
551
+ created_at: string;
552
+ last_seen_at: string;
553
+ settings: CustomerSettings;
554
+ balances: Balance[];
555
+ default_payment_methods: DefaultPaymentMethod[];
556
+ network: CustomerNetwork | null;
557
+ };
127
558
  export type CustomerAccount = {
128
559
  id: string;
129
560
  balances: Balance[];
130
561
  default_payment_methods: DefaultPaymentMethod[];
131
- unread_notifications: number;
132
562
  };
133
563
  export type CustomerAmount = {
134
564
  min_amount: string;
@@ -147,6 +577,13 @@ export type CustomerConfig = {
147
577
  payment: PaymentConfig;
148
578
  merchant: PublicMerchant;
149
579
  };
580
+ export type CustomerContact = {
581
+ email: string | null;
582
+ name: string | null;
583
+ username: string | null;
584
+ active: boolean | null;
585
+ synced_at: string | null;
586
+ };
150
587
  export type CustomerEntitlement = {
151
588
  customer_id: string;
152
589
  entitlement: string;
@@ -163,25 +600,238 @@ export type CustomerLink = {
163
600
  revoked_at: string | null;
164
601
  revoked_by: "account_deleted" | "customer" | "merchant_left" | null;
165
602
  };
166
- export type CustomerNotificationLookup = {
167
- notifications: Record<string, Notification | null> | null;
603
+ export type CustomerNetwork = {
604
+ account_id: string;
605
+ linked_at: string;
606
+ method: "checkout" | "connect" | "sign_in";
607
+ };
608
+ export type CustomerNetworkHostEvent = {
609
+ customer_id: string;
610
+ account_id: string;
611
+ method: "checkout" | "connect" | "sign_in" | null;
612
+ revoked_by: "account_deleted" | "customer" | "merchant_left" | null;
613
+ };
614
+ export type CustomerSettings = {
615
+ credit_limits: CreditLimit[];
616
+ trust_levels: TrustLevel[];
617
+ billing_policy: string | null;
618
+ invoice_profile: InvoiceProfile | null;
619
+ };
620
+ export type Dashboard = {
621
+ widgets: DashboardWidget[];
622
+ is_default: boolean;
623
+ updated_at: string | null;
624
+ updated_by: string | null;
625
+ };
626
+ export type DashboardGrid = {
627
+ x: number;
628
+ y: number;
629
+ w: number;
630
+ h: number;
631
+ };
632
+ export type DashboardWidget = {
633
+ id: string;
634
+ title: string;
635
+ viz: string;
636
+ query: MetricsQuery;
637
+ grid: DashboardGrid;
638
+ fixed_range: boolean;
639
+ };
640
+ export type DeclaredAdminGrant = {
641
+ customer?: string;
642
+ product?: string;
643
+ source_id?: string;
644
+ starts_at?: string;
645
+ ends_at?: string;
646
+ };
647
+ export type DeclaredBilling = {
648
+ as_of?: string;
649
+ subscriptions_exhaustive?: boolean;
650
+ expected_subscriptions?: number;
651
+ default_psp?: PSPRef;
652
+ customers?: DeclaredCustomer[];
653
+ payment_methods?: DeclaredPaymentMethod[];
654
+ subscriptions?: DeclaredSubscription[];
655
+ transactions?: DeclaredTransaction[];
656
+ admin_grants?: DeclaredAdminGrant[];
657
+ };
658
+ export type DeclaredCustomer = {
659
+ customer?: string;
660
+ };
661
+ export type DeclaredPaymentMethod = {
662
+ customer?: string;
663
+ rail?: string;
664
+ psp?: PSPRef;
665
+ rail_customer_ref?: string;
666
+ rail_method_ref?: string;
667
+ recurring_transaction_id?: string;
668
+ card?: CardDetails;
669
+ created_at?: string;
670
+ };
671
+ export type DeclaredSubscription = {
672
+ source_id?: string;
673
+ customer?: string;
674
+ price?: string;
675
+ rail?: string;
676
+ rail_subscription_id?: string;
677
+ psp?: PSPRef;
678
+ started_at?: string;
679
+ paid_through?: string;
680
+ cancel?: CancelEvidence;
681
+ dunning?: DunningEvidence;
682
+ payment_method?: PaymentMethodRef;
683
+ evidence?: unknown;
684
+ };
685
+ export type DeclaredTransaction = {
686
+ rail_subscription_id?: string;
687
+ transaction_id?: string;
688
+ type?: string;
689
+ success?: boolean;
690
+ amount?: string;
691
+ currency?: string;
692
+ occurred_at?: string;
168
693
  };
169
694
  export type DefaultPaymentMethod = {
170
695
  currency: string;
171
696
  payment_method_id: string;
172
697
  };
698
+ export type DelinquencyHostEvent = {
699
+ customer_id: string;
700
+ currency: string;
701
+ from_state: string;
702
+ to_state: string;
703
+ overdue_started_at?: string;
704
+ overdue_amount: string;
705
+ overdue_orders: number;
706
+ grace_days: number;
707
+ amount_floor: string;
708
+ };
173
709
  export type DriftField = {
174
710
  field: string;
175
711
  openrails_value: string;
176
712
  remote_value: string;
177
713
  };
714
+ export type DunningEvidence = {
715
+ retries?: number;
716
+ last_retry_at?: string;
717
+ next_retry_at?: string;
718
+ schedule_live?: boolean;
719
+ };
720
+ export type DunningPolicy = {
721
+ tiers: DunningTier[];
722
+ transient_retry_minutes?: number[];
723
+ access_during_dunning?: string;
724
+ access_while_renewal_held?: string;
725
+ };
726
+ export type DunningTier = {
727
+ max_cycle_hours?: number;
728
+ retry_after_hours?: number[];
729
+ };
730
+ export type EntitlementChange = {
731
+ product_id: string;
732
+ product_key: string;
733
+ added: string[];
734
+ removed: string[];
735
+ holders: number;
736
+ };
737
+ export type EntitlementCheck = {
738
+ entitlements: Record<string, boolean> | null;
739
+ quantities: Record<string, number | null> | null;
740
+ held: Record<string, HeldEntitlements> | null;
741
+ };
742
+ export type EntitlementReplacement = {
743
+ from?: string;
744
+ to?: string;
745
+ };
746
+ export type ErrorDetails = {
747
+ type: string;
748
+ code: string;
749
+ message: string;
750
+ request_id?: string;
751
+ param?: string;
752
+ metadata?: Record<string, unknown>;
753
+ order?: Order;
754
+ };
755
+ export type ExtendAdmissionBatchParams = {
756
+ items?: ExtendAdmissionParams[];
757
+ };
758
+ export type ExtendAdmissionParams = {
759
+ request_id?: string;
760
+ expires_at?: string;
761
+ };
762
+ export type Finding = {
763
+ id: string;
764
+ finding_type: string;
765
+ provider: string | null;
766
+ psp_id: string | null;
767
+ resource_type: string | null;
768
+ resource_id: string | null;
769
+ external_resource_id: string | null;
770
+ field: string | null;
771
+ openrails_value: string | null;
772
+ external_value: string | null;
773
+ subject_key: string;
774
+ severity: string;
775
+ status: string;
776
+ recommended_action: string | null;
777
+ evidence: Record<string, unknown> | null;
778
+ recommendation: FindingRecommendation | null;
779
+ last_seen_at: string;
780
+ resolved_at: string | null;
781
+ resolution: string | null;
782
+ resolved_by: string | null;
783
+ operator_notes: string | null;
784
+ created_at: string;
785
+ updated_at: string;
786
+ };
787
+ export type FindingRecommendation = {
788
+ action: string;
789
+ params: Record<string, unknown> | null;
790
+ alternatives: FindingRecommendation[];
791
+ };
792
+ export type FindingResolution = {
793
+ finding: Finding;
794
+ execution: Record<string, unknown> | null;
795
+ };
796
+ export type FlatPrice = {
797
+ amount?: string;
798
+ };
178
799
  export type Health = {
179
800
  status: "ok" | "ready";
180
801
  };
802
+ export type HeldEntitlements = {
803
+ keys: string[];
804
+ truncated: boolean;
805
+ };
806
+ export type HostEvent = {
807
+ id: string;
808
+ merchant_id: string;
809
+ type: "balance.depleted" | "balance.low" | "customer.network_linked" | "customer.network_unlinked" | "delinquency.cleared" | "delinquency.entered" | "delinquency.grace" | "mandate.revoked" | "order.canceled" | "order.completed" | "order.expired" | "order.payment_failed" | "order.requires_action" | "order.voided" | "payment.settled" | "product.entitlements_changed";
810
+ occurred_at: string;
811
+ acknowledged_at: string | null;
812
+ payment: PaymentSettledEvent | null;
813
+ delinquency: DelinquencyHostEvent | null;
814
+ product_entitlements: ProductEntitlementsChangedEvent | null;
815
+ order: OrderHostEvent | null;
816
+ customer_network: CustomerNetworkHostEvent | null;
817
+ mandate: MandateHostEvent | null;
818
+ balance: BalanceHostEvent | null;
819
+ };
820
+ export type HostEventLookup = {
821
+ host_events: Record<string, HostEvent | null> | null;
822
+ };
181
823
  export type InvoiceContact = {
182
824
  name: string;
183
825
  email: string;
184
826
  };
827
+ export type InvoiceProfile = {
828
+ net_terms_days: number;
829
+ collection_method: "charge_automatically" | "send_invoice";
830
+ po_number: string;
831
+ tax: Record<string, unknown> | null;
832
+ billing_contacts: InvoiceContact[];
833
+ memo: string;
834
+ };
185
835
  export type Mandate = {
186
836
  id: string;
187
837
  customer_id: string;
@@ -201,15 +851,177 @@ export type Mandate = {
201
851
  accepted_at: string;
202
852
  created_at: string;
203
853
  };
204
- export type MarkNotificationsReadParams = {
205
- notification_ids?: string[];
206
- all?: boolean;
854
+ export type MandateHostEvent = {
855
+ mandate_id: string;
856
+ kind: "card_on_file" | "recurring" | "unscheduled";
857
+ customer_id: string;
858
+ currency: string;
859
+ subscription_id: string | null;
860
+ revoked_at: string;
861
+ };
862
+ export type Matrix = {
863
+ dimension: string;
864
+ cells: Record<string, MatrixCell> | null;
865
+ };
866
+ export type MatrixCell = {
867
+ unit_amount: string;
868
+ maximum_amount?: string;
869
+ };
870
+ export type MerchantCheckoutSettings = {
871
+ embed_origins?: string[];
872
+ };
873
+ export type MerchantConfigurationState = {
874
+ revision: number;
875
+ display_name: string;
876
+ settings: MerchantSettings;
877
+ };
878
+ export type MerchantProfile = {
879
+ logo_url?: string;
880
+ from_email?: string;
881
+ support_url?: string;
882
+ signup_url?: string;
883
+ billing_url?: string;
884
+ };
885
+ export type MerchantSettings = {
886
+ profile?: MerchantProfile;
887
+ collection_threshold?: string;
888
+ monthly_floor?: string;
889
+ billing_period_boundary?: string;
890
+ alert_email?: string;
891
+ reprice_notice_window_days?: number;
892
+ provider_refund_access?: string;
893
+ arrears_grace_days?: number;
894
+ arrears_delinquency_floor?: string;
895
+ checkout_routing?: CheckoutRoutingRule[];
896
+ dunning_policy?: DunningPolicy;
897
+ checkout?: MerchantCheckoutSettings;
898
+ billing_policies?: BillingPolicy[];
899
+ billing_policy_bindings?: BillingPolicyBinding[];
900
+ delegated_invoker_wasted_spend_limits?: BudgetWindow[];
901
+ };
902
+ export type Meter = {
903
+ key: string;
904
+ event_type: string;
905
+ value_property: string;
906
+ aggregation: "count" | "latest" | "max" | "min" | "sum" | "unique_count";
907
+ unit: string;
908
+ group_by: Record<string, string> | null;
909
+ billing_supported: boolean;
910
+ rate_card: MeterRateCard | null;
911
+ revision: number;
912
+ has_activity: boolean;
913
+ last_event_at: string | null;
914
+ created_at: string;
915
+ updated_at: string;
916
+ };
917
+ export type MeterRateCard = {
918
+ product_id: string;
919
+ product_key: string;
920
+ filter: Record<string, string[]> | null;
921
+ price: RatePrice;
922
+ allowance: Allowance | null;
923
+ created_at: string;
924
+ updated_at: string;
925
+ };
926
+ export type MeterRateCardParams = {
927
+ product_id?: string;
928
+ filter?: Record<string, string[]>;
929
+ price?: RatePrice;
930
+ allowance?: Allowance;
931
+ };
932
+ export type MetricsColumn = {
933
+ name: string;
934
+ kind: string;
935
+ unit?: string;
936
+ };
937
+ export type MetricsDimension = {
938
+ name: string;
939
+ description: string;
940
+ values?: string[];
941
+ };
942
+ export type MetricsExample = {
943
+ intent: string;
944
+ query: MetricsQuery;
945
+ };
946
+ export type MetricsLimits = {
947
+ max_buckets: number;
948
+ max_limit: number;
949
+ };
950
+ export type MetricsMeasure = {
951
+ name: string;
952
+ class: string;
953
+ unit: string;
954
+ description: string;
955
+ formula: string;
956
+ dims: string[];
957
+ money?: boolean;
958
+ };
959
+ export type MetricsOrder = {
960
+ measure?: string;
961
+ dimension?: string;
962
+ dir?: string;
963
+ };
964
+ export type MetricsQuery = {
965
+ measures: string[];
966
+ by: string[];
967
+ grain: string;
968
+ range: MetricsRange | null;
969
+ filters: Record<string, string[]> | null;
970
+ order: MetricsOrder[];
971
+ limit: number | null;
972
+ compare: string;
973
+ };
974
+ export type MetricsRange = {
975
+ from?: string;
976
+ to?: string;
977
+ last?: string;
978
+ };
979
+ export type MetricsResult = {
980
+ grain?: string;
981
+ range: MetricsResultRange;
982
+ columns: MetricsColumn[];
983
+ rows: unknown[][];
984
+ compare_range?: MetricsResultRange;
985
+ compare_rows?: unknown[][];
986
+ };
987
+ export type MetricsResultRange = {
988
+ from: string;
989
+ to: string;
990
+ };
991
+ export type MetricsSchema = {
992
+ measures: MetricsMeasure[];
993
+ dimensions: MetricsDimension[];
994
+ grains: string[];
995
+ deferred: string[];
996
+ caveats: string[];
997
+ examples: MetricsExample[];
998
+ limits: MetricsLimits;
999
+ query_shape: string;
1000
+ };
1001
+ export type NetworkLink = {
1002
+ link: CustomerLink;
1003
+ merchant: PublicMerchant;
207
1004
  };
208
1005
  export type NetworkLinkChallenge = {
209
1006
  id: string;
210
1007
  nonce: string;
211
1008
  expires_at: string;
212
1009
  };
1010
+ export type NetworkOrder = {
1011
+ link_id: string;
1012
+ merchant_id: string;
1013
+ order: Order;
1014
+ };
1015
+ export type NetworkSubscription = {
1016
+ link_id: string;
1017
+ merchant_id: string;
1018
+ subscription: Subscription;
1019
+ };
1020
+ export type NewPriceDraft = {
1021
+ product_key: string;
1022
+ review_text: string;
1023
+ create_price: CreatePriceParams;
1024
+ };
213
1025
  export type NextAction = {
214
1026
  type: string;
215
1027
  url: string | null;
@@ -217,55 +1029,18 @@ export type NextAction = {
217
1029
  psp_id: string | null;
218
1030
  payload: Record<string, string> | null;
219
1031
  };
220
- export type Notification = {
1032
+ export type NotificationEvent = {
221
1033
  id: string;
1034
+ merchant_id: string;
222
1035
  customer_id: string;
223
1036
  event_type: string;
224
- data: NotificationData;
225
- seen: boolean;
1037
+ data: unknown | null;
226
1038
  created_at: string;
1039
+ action_requested?: boolean;
1040
+ optional?: boolean;
227
1041
  };
228
- export type NotificationData = {
229
- reason?: string;
230
- message?: string;
231
- source?: string;
232
- product_id?: string;
233
- ended_at?: string;
234
- currency?: string;
235
- subscription_id?: string;
236
- from_price_id?: string;
237
- to_price_id?: string;
238
- to_product_id?: string;
239
- to_product_name?: string;
240
- old_amount?: string;
241
- new_amount?: string;
242
- effective_at?: string;
243
- period_starts_at?: string;
244
- period_ends_at?: string;
245
- downgrade_applied?: boolean;
246
- new_product?: string;
247
- overdue_amount?: string;
248
- overdue_orders?: number;
249
- overdue_started_at?: string;
250
- from_state?: string;
251
- to_state?: string;
252
- amount_due?: string;
253
- due_at?: string;
254
- failure_code?: string;
255
- failure_reason?: string;
256
- decline_outcome?: string;
257
- next_attempt_at?: string;
258
- rail?: string;
259
- rail_subscription_id?: string;
260
- transaction_id?: string;
261
- quantity?: number;
262
- amount?: string;
263
- product_name?: string;
264
- payment_method?: string;
265
- user_email?: string;
266
- payment_id?: string;
267
- order_id?: string;
268
- order_number?: string;
1042
+ export type NotificationEvents = {
1043
+ data: NotificationEvent[];
269
1044
  };
270
1045
  export type Order = {
271
1046
  id: string;
@@ -297,6 +1072,23 @@ export type OrderCheckout = {
297
1072
  cancel_url: string | null;
298
1073
  saved_payment_methods: boolean;
299
1074
  };
1075
+ export type OrderCheckoutParams = {
1076
+ ui_mode?: "embedded" | "hosted";
1077
+ success_url?: string;
1078
+ cancel_url?: string;
1079
+ expires_at?: string;
1080
+ saved_payment_methods?: boolean;
1081
+ };
1082
+ export type OrderHostEvent = {
1083
+ order_id: string;
1084
+ customer_id: string;
1085
+ status: "canceled" | "complete" | "expired" | "open" | "processing" | "uncollectible" | "void";
1086
+ payment_status: "processing" | "requires_action" | "requires_payment_method" | "succeeded";
1087
+ total: string;
1088
+ currency: string;
1089
+ number: string | null;
1090
+ payment_id: string | null;
1091
+ };
300
1092
  export type OrderLine = {
301
1093
  id: string;
302
1094
  price_id: string | null;
@@ -381,6 +1173,24 @@ export type OrderUsage = {
381
1173
  billing_contacts: InvoiceContact[];
382
1174
  delinquent: boolean;
383
1175
  };
1176
+ export type PSP = {
1177
+ id: string;
1178
+ key: string;
1179
+ rail: "ccbill" | "nmi" | "solana" | "stripe";
1180
+ environment: string;
1181
+ account_id: string;
1182
+ archived: boolean;
1183
+ open_obligations: number;
1184
+ settings: Record<string, unknown> | null;
1185
+ credentials: Record<string, PSPCredential> | null;
1186
+ revision: number;
1187
+ created_at: string;
1188
+ updated_at: string;
1189
+ };
1190
+ export type PSPCredential = {
1191
+ configured: boolean;
1192
+ validated_at: string | null;
1193
+ };
384
1194
  export type PSPLinkState = {
385
1195
  status: "error" | "linked" | "pending_manual_link" | "sync_disabled";
386
1196
  ids: Record<string, string> | null;
@@ -401,6 +1211,32 @@ export type PSPPaymentConfig = {
401
1211
  status?: string;
402
1212
  retry_after?: number;
403
1213
  };
1214
+ export type PSPRef = {
1215
+ id?: string;
1216
+ key?: string;
1217
+ };
1218
+ export type PSPRefresh = {
1219
+ status: string;
1220
+ job_id: string;
1221
+ };
1222
+ export type PSPRoutingCandidate = {
1223
+ psp: string;
1224
+ rail: "ccbill" | "nmi" | "solana" | "stripe";
1225
+ skip: string | null;
1226
+ };
1227
+ export type PSPRoutingPreview = {
1228
+ policy: string;
1229
+ rule: number | null;
1230
+ psp: string | null;
1231
+ rail: "ccbill" | "nmi" | "solana" | "stripe" | null;
1232
+ mode: string | null;
1233
+ candidates: PSPRoutingCandidate[];
1234
+ };
1235
+ export type PackagePrice = {
1236
+ amount?: string;
1237
+ package_size?: number;
1238
+ free_units?: number;
1239
+ };
404
1240
  export type PayOrderParams = {
405
1241
  payment?: OrderPaymentParams;
406
1242
  expected_total?: string;
@@ -431,6 +1267,41 @@ export type Payment = {
431
1267
  refunds: Payment[];
432
1268
  created_at: string;
433
1269
  };
1270
+ export type PaymentAttempt = {
1271
+ id: string;
1272
+ kind: string;
1273
+ owner: string;
1274
+ card_entry: string;
1275
+ source: string;
1276
+ observed_via: string;
1277
+ category: string;
1278
+ reason: "authentication_required" | "blocked_by_psp" | "call_issuer" | "card_not_supported" | "communication_error" | "currency_not_supported" | "do_not_honor" | "duplicate_transaction" | "expired_card" | "fraudulent" | "gateway_rejected" | "generic_decline" | "incorrect_address" | "incorrect_cvc" | "incorrect_number" | "incorrect_zip" | "insufficient_funds" | "invalid_account" | "invalid_expiry" | "invalid_pin" | "invalid_request" | "issuer_unavailable" | "lost_card" | "merchant_config" | "no_such_issuer" | "over_limit" | "pickup_card" | "processing_error" | "restricted_card" | "retry_later" | "security_violation" | "stolen_card" | "stop_recurring" | "transaction_not_allowed" | "try_again_later" | "unknown" | "update_cardholder_data";
1279
+ action: string;
1280
+ response_code: string;
1281
+ response_text: string;
1282
+ issuer_code: string;
1283
+ issuer_text: string;
1284
+ avs_result: string;
1285
+ cvv_result: string;
1286
+ card: CardDetails | null;
1287
+ card_bin: string;
1288
+ token_type: string;
1289
+ transaction_id: string;
1290
+ rail: string;
1291
+ psp_id: string;
1292
+ customer_id: string;
1293
+ amount: string;
1294
+ currency: string;
1295
+ attempted_at: string;
1296
+ order_id: string | null;
1297
+ cycle_id: string | null;
1298
+ subscription_id: string | null;
1299
+ payment_method_id: string | null;
1300
+ payment_id: string | null;
1301
+ enriched_at: string | null;
1302
+ mandate_id: string | null;
1303
+ sent_initial_transaction_id: string;
1304
+ };
434
1305
  export type PaymentConfig = {
435
1306
  psps: PSPPaymentConfig[];
436
1307
  solana: SolanaPaymentConfig | null;
@@ -464,6 +1335,11 @@ export type PaymentMethodHealth = {
464
1335
  last_charge_outcome: "failed" | "succeeded" | null;
465
1336
  active: boolean;
466
1337
  };
1338
+ export type PaymentMethodRef = {
1339
+ rail?: string;
1340
+ rail_customer_ref?: string;
1341
+ rail_method_ref?: string;
1342
+ };
467
1343
  export type PaymentMethodSubscription = {
468
1344
  id: string;
469
1345
  display_name: string;
@@ -475,16 +1351,41 @@ export type PaymentRecovery = {
475
1351
  blocked_reason?: string;
476
1352
  order_id?: string;
477
1353
  };
1354
+ export type PaymentSettledEvent = {
1355
+ payment_id: string;
1356
+ customer_id: string;
1357
+ order_id?: string;
1358
+ price_id?: string;
1359
+ subscription_id?: string;
1360
+ amount: string;
1361
+ currency: string;
1362
+ };
478
1363
  export type PendingAction = {
479
1364
  psp: string;
480
1365
  action: string;
481
1366
  hint: string;
482
1367
  patch_required: Record<string, Record<string, Record<string, string>>> | null;
483
1368
  };
1369
+ export type PerUnitPrice = {
1370
+ unit_amount?: string;
1371
+ divide_by?: number;
1372
+ round?: "down" | "half_up" | "up";
1373
+ maximum_amount?: string;
1374
+ matrix?: Matrix;
1375
+ };
484
1376
  export type PreviewMyOrderParams = {
485
1377
  lines?: OrderLineParams[];
486
1378
  cart?: boolean;
487
1379
  };
1380
+ export type PreviewOrderParams = {
1381
+ customer_id?: string;
1382
+ lines?: OrderLineParams[];
1383
+ };
1384
+ export type PreviewPSPRoutingParams = {
1385
+ price_id?: string;
1386
+ country?: string;
1387
+ psp?: string;
1388
+ };
488
1389
  export type PreviewSubscriptionChangeParams = {
489
1390
  price_id?: string | null;
490
1391
  quantity?: number | null;
@@ -509,6 +1410,65 @@ export type Price = {
509
1410
  created_at: string;
510
1411
  updated_at: string;
511
1412
  };
1413
+ export type PriceChangeDraft = {
1414
+ product_key: string;
1415
+ price_key: string;
1416
+ current_amount: string;
1417
+ new_amount: string;
1418
+ currency: string;
1419
+ affected_count: number;
1420
+ review_text: string;
1421
+ create_price: CreatePriceParams;
1422
+ migration: CreatePriceMigrationParams | null;
1423
+ };
1424
+ export type PriceKeyMovement = {
1425
+ effective_at: string;
1426
+ archived: boolean;
1427
+ price: Price;
1428
+ };
1429
+ export type PriceMigration = {
1430
+ id: string;
1431
+ from_price_id: string | null;
1432
+ product_key: string | null;
1433
+ price_key: string | null;
1434
+ to_price_id: string;
1435
+ effective_at: string;
1436
+ fallback_policy: "cancel_at_period_end" | "keep_grandfathered";
1437
+ matched: number;
1438
+ skipped: number;
1439
+ scheduled: number;
1440
+ applied: number;
1441
+ canceled: number;
1442
+ blocked: number;
1443
+ created_at: string;
1444
+ canceled_at: string | null;
1445
+ };
1446
+ export type PriceMigrationCancel = {
1447
+ price_migration: PriceMigration;
1448
+ canceled: number;
1449
+ rail_release_required: string[];
1450
+ };
1451
+ export type PriceMigrationOutcome = {
1452
+ subscription_id: string;
1453
+ rail: string;
1454
+ disposition: "applied" | "blocked" | "scheduled" | "skipped";
1455
+ reason: string | null;
1456
+ };
1457
+ export type PriceMigrationPreview = {
1458
+ to_price_id: string | null;
1459
+ effective_at: string;
1460
+ matched: number;
1461
+ scheduled: number;
1462
+ skipped: number;
1463
+ blocked: number;
1464
+ by_rail: Record<string, PriceMigrationRailCounts | null> | null;
1465
+ outcomes: PriceMigrationOutcome[];
1466
+ };
1467
+ export type PriceMigrationRailCounts = {
1468
+ auto: number;
1469
+ requires_action: number;
1470
+ skipped: number;
1471
+ };
512
1472
  export type Product = {
513
1473
  revision: number;
514
1474
  id: string;
@@ -525,6 +1485,34 @@ export type Product = {
525
1485
  created_at: string;
526
1486
  updated_at: string;
527
1487
  };
1488
+ export type ProductAccessGrant = {
1489
+ id: string;
1490
+ customer_id: string;
1491
+ product_id: string;
1492
+ product_key: string;
1493
+ product_name: string;
1494
+ source_type: "grace" | "grant" | "purchase" | "subscription";
1495
+ source_id: string;
1496
+ payment_id: string | null;
1497
+ quantity: number | null;
1498
+ grant_reason: "comp" | "import" | "migration" | "staff" | null;
1499
+ granted_by: string | null;
1500
+ note: string | null;
1501
+ status: string;
1502
+ starts_at: string;
1503
+ ends_at: string | null;
1504
+ revoked_at: string | null;
1505
+ revoke_reason: string | null;
1506
+ created_at: string;
1507
+ updated_at: string;
1508
+ };
1509
+ export type ProductEntitlementsChangedEvent = {
1510
+ product_id: string;
1511
+ product_key: string;
1512
+ added: string[];
1513
+ removed: string[];
1514
+ holders: number;
1515
+ };
528
1516
  export type ProductSummary = {
529
1517
  id: string;
530
1518
  key: string;
@@ -534,6 +1522,13 @@ export type ProductSummary = {
534
1522
  tier_rank: number;
535
1523
  archived: boolean;
536
1524
  };
1525
+ export type ProvisioningToken = {
1526
+ id: string;
1527
+ name: string;
1528
+ declared: boolean;
1529
+ created_at: string;
1530
+ last_used_at: string | null;
1531
+ };
537
1532
  export type PublicConfig = {
538
1533
  capabilities: Capabilities;
539
1534
  currencies: CurrencyUnits[];
@@ -561,9 +1556,114 @@ export type RailDefinition = {
561
1556
  credential_keys: string[];
562
1557
  setting_keys: string[];
563
1558
  };
1559
+ export type RateCard = {
1560
+ ordinal?: number;
1561
+ meter?: string;
1562
+ filter?: Record<string, string[]>;
1563
+ allowance?: Allowance;
1564
+ payment_term?: "in_advance" | "in_arrears";
1565
+ price?: RatePrice;
1566
+ };
1567
+ export type RatePrice = {
1568
+ model: "flat" | "package" | "per_unit" | "tiered";
1569
+ currency?: string;
1570
+ flat?: FlatPrice;
1571
+ per_unit?: PerUnitPrice;
1572
+ tiered?: TieredPrice;
1573
+ package?: PackagePrice;
1574
+ };
1575
+ export type RateTier = {
1576
+ up_to: number | null;
1577
+ unit_amount?: string;
1578
+ flat_amount?: string;
1579
+ };
1580
+ export type RecordExternalPaymentParams = {
1581
+ order_id?: string;
1582
+ amount?: string;
1583
+ transaction_id?: string;
1584
+ paid_at?: string;
1585
+ };
1586
+ export type RecordUsageBatchParams = {
1587
+ items?: RecordUsageParams[];
1588
+ };
1589
+ export type RecordUsageBatchResult = {
1590
+ items: UsageEventResult[];
1591
+ };
1592
+ export type RecordUsageParams = {
1593
+ customer_id?: string;
1594
+ invoker?: string;
1595
+ invoker_type?: "customer" | "delegated";
1596
+ currency?: string;
1597
+ event_type?: string;
1598
+ dimensions?: Record<string, number>;
1599
+ amount?: string;
1600
+ outcome?: "failed" | "succeeded";
1601
+ resource?: string;
1602
+ metadata?: Record<string, unknown>;
1603
+ source?: string;
1604
+ source_id?: string;
1605
+ occurred_at?: string;
1606
+ };
1607
+ export type RefundPaymentParams = {
1608
+ amount?: string;
1609
+ full?: boolean;
1610
+ reason?: string;
1611
+ revoke_access?: boolean;
1612
+ };
1613
+ export type ReleaseAdmissionBatchParams = {
1614
+ request_ids?: string[];
1615
+ };
1616
+ export type Renewal = {
1617
+ id: string;
1618
+ subscription_id: string;
1619
+ customer_id: string;
1620
+ psp_id: string;
1621
+ rail: string;
1622
+ owner: string;
1623
+ due_at: string;
1624
+ amount: string;
1625
+ currency: string;
1626
+ first_outcome: string;
1627
+ outcome: string;
1628
+ missed_at: string | null;
1629
+ miss_reason: string;
1630
+ collected_at: string | null;
1631
+ recovered_by: string;
1632
+ closes_at: string;
1633
+ attempts: PaymentAttempt[];
1634
+ };
1635
+ export type ResolveFindingParams = {
1636
+ outcome?: "approve" | "ignore";
1637
+ notes?: string;
1638
+ override_params?: unknown;
1639
+ };
564
1640
  export type RetrySubscriptionNowParams = {
565
1641
  payment_method_id?: string;
566
1642
  };
1643
+ export type RevokeCreditGrantParams = {
1644
+ reason?: string;
1645
+ };
1646
+ export type RevokeProductAccessParams = {
1647
+ reason?: string;
1648
+ };
1649
+ export type RunningCharge = {
1650
+ id: string;
1651
+ reference: string;
1652
+ customer_id: string;
1653
+ currency: string;
1654
+ rate_per_hour: string;
1655
+ state: "running" | "stopped";
1656
+ started_at: string;
1657
+ stopped_at: string | null;
1658
+ charged_amount: string;
1659
+ posted_amount: string;
1660
+ as_of: string;
1661
+ overdraft_amount: string;
1662
+ low_balance_amount: string;
1663
+ resource: string | null;
1664
+ created_at: string;
1665
+ updated_at: string;
1666
+ };
567
1667
  export type ScheduledChange = {
568
1668
  price_id: string;
569
1669
  quantity: number | null;
@@ -578,9 +1678,21 @@ export type SetCartLineParams = {
578
1678
  quantity?: number;
579
1679
  amount?: string;
580
1680
  };
1681
+ export type SetDashboardParams = {
1682
+ widgets?: DashboardWidget[];
1683
+ };
581
1684
  export type SetDefaultPaymentMethodParams = {
582
1685
  payment_method_id?: string;
583
1686
  };
1687
+ export type SetMeterParams = {
1688
+ event_type?: string;
1689
+ value_property?: string;
1690
+ aggregation?: "count" | "latest" | "max" | "min" | "sum" | "unique_count";
1691
+ unit?: string;
1692
+ group_by?: Record<string, string>;
1693
+ rate_card?: MeterRateCardParams | null;
1694
+ expected_revision?: number;
1695
+ };
584
1696
  export type SetSubscriptionPaymentMethodParams = {
585
1697
  payment_method_id?: string | null;
586
1698
  };
@@ -609,6 +1721,20 @@ export type SolanaPaymentToken = {
609
1721
  preferred: boolean;
610
1722
  recurring_eligible: boolean;
611
1723
  };
1724
+ export type StartRunningChargeParams = {
1725
+ reference?: string;
1726
+ customer_id?: string;
1727
+ currency?: string;
1728
+ rate_per_hour?: string;
1729
+ started_at?: string;
1730
+ minimum_amount?: string;
1731
+ overdraft_amount?: string;
1732
+ low_balance_amount?: string;
1733
+ resource?: string;
1734
+ };
1735
+ export type StopRunningChargeParams = {
1736
+ stopped_at?: string;
1737
+ };
612
1738
  export type StripePortalSession = {
613
1739
  url: string;
614
1740
  };
@@ -699,12 +1825,61 @@ export type SubscriptionRetryNowResult = {
699
1825
  status: string;
700
1826
  replayed: boolean;
701
1827
  };
1828
+ export type TieredPrice = {
1829
+ mode?: "graduated" | "volume";
1830
+ tiers?: RateTier[];
1831
+ };
1832
+ export type TrustLevel = {
1833
+ currency: string;
1834
+ trust_level: string;
1835
+ };
1836
+ export type UpdateAlertWebhookParams = {
1837
+ name?: string | null;
1838
+ url?: string | null;
1839
+ format?: "discord" | "generic" | "slack" | null;
1840
+ enabled?: boolean | null;
1841
+ };
1842
+ export type UpdateCustomerParams = {
1843
+ credit_limits?: CreditLimit[];
1844
+ trust_levels?: TrustLevel[];
1845
+ billing_policy?: string | null;
1846
+ invoice_profile?: InvoiceProfile | null;
1847
+ };
1848
+ export type UpdateMerchantConfigurationParams = {
1849
+ expected_revision?: number | null;
1850
+ settings?: MerchantSettings;
1851
+ display_name?: string;
1852
+ };
1853
+ export type UpdatePSPParams = {
1854
+ expected_revision?: number | null;
1855
+ settings?: Record<string, unknown> | null;
1856
+ credentials?: Record<string, string> | null;
1857
+ retire_webhook_overlap?: boolean;
1858
+ archived?: boolean;
1859
+ allow_last?: boolean;
1860
+ };
702
1861
  export type UpdatePaymentMethodParams = {
703
1862
  exp_month?: number;
704
1863
  exp_year?: number;
705
1864
  billing_details?: BillingDetails;
706
1865
  reusable?: boolean;
707
1866
  };
1867
+ export type UpdatePriceParams = {
1868
+ archived?: boolean | null;
1869
+ psp_links?: Record<string, Record<string, string>>;
1870
+ expected_revision?: number;
1871
+ };
1872
+ export type UpdateProductParams = {
1873
+ display_name?: string | null;
1874
+ description?: string | null;
1875
+ entitlements?: string[];
1876
+ credit_grant?: CreditGrantSpec | null;
1877
+ tier_group?: string | null;
1878
+ tier_rank?: number | null;
1879
+ ownership?: "consumable" | "extend" | "unique" | null;
1880
+ archived?: boolean | null;
1881
+ expected_revision?: number;
1882
+ };
708
1883
  export type Usage = {
709
1884
  customer_id: string;
710
1885
  currency: string;
@@ -714,6 +1889,42 @@ export type Usage = {
714
1889
  rows: UsageRow[];
715
1890
  next_cursor: string | null;
716
1891
  };
1892
+ export type UsageCharge = {
1893
+ meter_key: string;
1894
+ cell: string | null;
1895
+ quantity: number;
1896
+ amount: string;
1897
+ };
1898
+ export type UsageEstimate = {
1899
+ event_type?: string;
1900
+ dimensions?: Record<string, number>;
1901
+ metadata?: Record<string, unknown>;
1902
+ };
1903
+ export type UsageEvent = {
1904
+ id: string;
1905
+ customer_id: string;
1906
+ invoker: string;
1907
+ currency: string;
1908
+ event_type: string;
1909
+ dimensions: Record<string, number> | null;
1910
+ outcome: "failed" | "succeeded";
1911
+ amount: string;
1912
+ forgiven_amount: string;
1913
+ resource: string | null;
1914
+ metadata: Record<string, unknown> | null;
1915
+ source: string;
1916
+ source_id: string;
1917
+ charges: UsageCharge[];
1918
+ balance_transaction_id: string | null;
1919
+ occurred_at: string;
1920
+ created_at: string;
1921
+ replayed: boolean;
1922
+ };
1923
+ export type UsageEventResult = {
1924
+ status: number;
1925
+ event: UsageEvent | null;
1926
+ error: ErrorDetails | null;
1927
+ };
717
1928
  export type UsageRow = {
718
1929
  key: string;
719
1930
  cell: string | null;
@@ -722,3 +1933,7 @@ export type UsageRow = {
722
1933
  quantity: number | null;
723
1934
  dimensions: Record<string, number> | null;
724
1935
  };
1936
+ export type WebhookReceipt = {
1937
+ status: string;
1938
+ code: string | null;
1939
+ };