@fantastic.dev/better-stripe 0.56.0 → 0.58.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 (248) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +5 -1
  3. package/dist/client/billing/setup-intent-read.d.ts +12 -1
  4. package/dist/client/billing/setup-intent-read.d.ts.map +1 -1
  5. package/dist/client/billing/setup-intent-read.js +13 -8
  6. package/dist/client/billing/setup-intent-read.js.map +1 -1
  7. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +366 -2
  8. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +183 -1
  10. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  11. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +366 -2
  12. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  13. package/dist/client/connect/payoutSyncTestHelpers.d.ts +183 -1
  14. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  15. package/dist/client/index.d.ts +2 -12
  16. package/dist/client/index.d.ts.map +1 -1
  17. package/dist/client/index.js +3 -20
  18. package/dist/client/index.js.map +1 -1
  19. package/dist/client/types/triggers.d.ts +3 -1
  20. package/dist/client/types/triggers.d.ts.map +1 -1
  21. package/dist/client/usage/allowanceClient.d.ts +51 -0
  22. package/dist/client/usage/allowanceClient.d.ts.map +1 -0
  23. package/dist/client/usage/allowanceClient.js +64 -0
  24. package/dist/client/usage/allowanceClient.js.map +1 -0
  25. package/dist/client/usage/allowanceTerms.d.ts +64 -0
  26. package/dist/client/usage/allowanceTerms.d.ts.map +1 -0
  27. package/dist/client/usage/allowanceTerms.js +101 -0
  28. package/dist/client/usage/allowanceTerms.js.map +1 -0
  29. package/dist/client/usage/client.d.ts +2 -2
  30. package/dist/client/usage/client.d.ts.map +1 -1
  31. package/dist/client/usage/client.js +4 -4
  32. package/dist/client/usage/client.js.map +1 -1
  33. package/dist/client/usage/creditCapacity.d.ts +5 -0
  34. package/dist/client/usage/creditCapacity.d.ts.map +1 -0
  35. package/dist/client/usage/creditCapacity.js +47 -0
  36. package/dist/client/usage/creditCapacity.js.map +1 -0
  37. package/dist/client/usage/creditClient.d.ts +104 -0
  38. package/dist/client/usage/creditClient.d.ts.map +1 -0
  39. package/dist/client/usage/creditClient.js +111 -0
  40. package/dist/client/usage/creditClient.js.map +1 -0
  41. package/dist/client/usage/creditDelivery.d.ts +6 -0
  42. package/dist/client/usage/creditDelivery.d.ts.map +1 -0
  43. package/dist/client/usage/creditDelivery.js +71 -0
  44. package/dist/client/usage/creditDelivery.js.map +1 -0
  45. package/dist/client/usage/creditInvoice.d.ts +6 -0
  46. package/dist/client/usage/creditInvoice.d.ts.map +1 -0
  47. package/dist/client/usage/creditInvoice.js +63 -0
  48. package/dist/client/usage/creditInvoice.js.map +1 -0
  49. package/dist/client/usage/creditLifecycle.d.ts +14 -0
  50. package/dist/client/usage/creditLifecycle.d.ts.map +1 -0
  51. package/dist/client/usage/creditLifecycle.js +90 -0
  52. package/dist/client/usage/creditLifecycle.js.map +1 -0
  53. package/dist/client/usage/creditNative.d.ts +20 -0
  54. package/dist/client/usage/creditNative.d.ts.map +1 -0
  55. package/dist/client/usage/creditNative.js +100 -0
  56. package/dist/client/usage/creditNative.js.map +1 -0
  57. package/dist/client/usage/creditObservation.d.ts +23 -0
  58. package/dist/client/usage/creditObservation.d.ts.map +1 -0
  59. package/dist/client/usage/creditObservation.js +54 -0
  60. package/dist/client/usage/creditObservation.js.map +1 -0
  61. package/dist/client/usage/creditProofs.d.ts +50 -0
  62. package/dist/client/usage/creditProofs.d.ts.map +1 -0
  63. package/dist/client/usage/creditProofs.js +58 -0
  64. package/dist/client/usage/creditProofs.js.map +1 -0
  65. package/dist/client/usage/creditProvider.d.ts +11 -0
  66. package/dist/client/usage/creditProvider.d.ts.map +1 -0
  67. package/dist/client/usage/creditProvider.js +195 -0
  68. package/dist/client/usage/creditProvider.js.map +1 -0
  69. package/dist/client/usage/creditRead.d.ts +47 -0
  70. package/dist/client/usage/creditRead.d.ts.map +1 -0
  71. package/dist/client/usage/creditRead.js +18 -0
  72. package/dist/client/usage/creditRead.js.map +1 -0
  73. package/dist/client/usage/creditReconciliation.d.ts +20 -0
  74. package/dist/client/usage/creditReconciliation.d.ts.map +1 -0
  75. package/dist/client/usage/creditReconciliation.js +157 -0
  76. package/dist/client/usage/creditReconciliation.js.map +1 -0
  77. package/dist/client/usage/creditTerms.d.ts +89 -0
  78. package/dist/client/usage/creditTerms.d.ts.map +1 -0
  79. package/dist/client/usage/creditTerms.js +76 -0
  80. package/dist/client/usage/creditTerms.js.map +1 -0
  81. package/dist/client/usage/creditTransport.fixtures.d.ts +101 -0
  82. package/dist/client/usage/creditTransport.fixtures.d.ts.map +1 -0
  83. package/dist/client/usage/creditTransport.fixtures.js +271 -0
  84. package/dist/client/usage/creditTransport.fixtures.js.map +1 -0
  85. package/dist/client/usage/deliveryProvider.d.ts.map +1 -1
  86. package/dist/client/usage/deliveryProvider.js +2 -0
  87. package/dist/client/usage/deliveryProvider.js.map +1 -1
  88. package/dist/client/usage/index.d.ts +4 -0
  89. package/dist/client/usage/index.d.ts.map +1 -1
  90. package/dist/client/usage/index.js +1 -0
  91. package/dist/client/usage/index.js.map +1 -1
  92. package/dist/client/usage/records.d.ts +2 -0
  93. package/dist/client/usage/records.d.ts.map +1 -1
  94. package/dist/client/usage/records.js +22 -0
  95. package/dist/client/usage/records.js.map +1 -1
  96. package/dist/client/usage/subscriptionTransport.fixtures.d.ts +1 -1
  97. package/dist/client/usage/subscriptionTransport.fixtures.d.ts.map +1 -1
  98. package/dist/client/usage/subscriptionTransport.fixtures.js +4 -1
  99. package/dist/client/usage/subscriptionTransport.fixtures.js.map +1 -1
  100. package/dist/client/usage/summary.js +2 -2
  101. package/dist/client/usage/summary.js.map +1 -1
  102. package/dist/client/usageExports.d.ts +16 -0
  103. package/dist/client/usageExports.d.ts.map +1 -0
  104. package/dist/client/usageExports.js +3 -0
  105. package/dist/client/usageExports.js.map +1 -0
  106. package/dist/client/webhooks/subscriptionDeleted.d.ts +5 -0
  107. package/dist/client/webhooks/subscriptionDeleted.d.ts.map +1 -0
  108. package/dist/client/webhooks/subscriptionDeleted.js +34 -0
  109. package/dist/client/webhooks/subscriptionDeleted.js.map +1 -0
  110. package/dist/component/_generated/api.d.ts +18 -0
  111. package/dist/component/_generated/api.d.ts.map +1 -1
  112. package/dist/component/_generated/api.js.map +1 -1
  113. package/dist/component/_generated/component.d.ts +360 -0
  114. package/dist/component/_generated/component.d.ts.map +1 -1
  115. package/dist/component/accountClosure/mutations.d.ts.map +1 -1
  116. package/dist/component/accountClosure/mutations.js +10 -0
  117. package/dist/component/accountClosure/mutations.js.map +1 -1
  118. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  119. package/dist/component/balanceFunding/mutations.d.ts +16 -16
  120. package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
  121. package/dist/component/balanceFunding/queries.d.ts +1 -1
  122. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  123. package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
  124. package/dist/component/earnings/triggers.d.ts +352 -18
  125. package/dist/component/earnings/triggers.d.ts.map +1 -1
  126. package/dist/component/payoutRelease/queries.d.ts +2 -2
  127. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  128. package/dist/component/schema.d.ts +183 -1
  129. package/dist/component/schema.js +8 -0
  130. package/dist/component/schema.js.map +1 -1
  131. package/dist/component/usage/mutations.d.ts.map +1 -1
  132. package/dist/component/usage/mutations.js +7 -0
  133. package/dist/component/usage/mutations.js.map +1 -1
  134. package/dist/component/usage/schema.d.ts +15 -1
  135. package/dist/component/usage/schema.d.ts.map +1 -1
  136. package/dist/component/usage/schema.js +12 -0
  137. package/dist/component/usage/schema.js.map +1 -1
  138. package/dist/component/usageAllowance/helpers.d.ts +78 -0
  139. package/dist/component/usageAllowance/helpers.d.ts.map +1 -0
  140. package/dist/component/usageAllowance/helpers.js +99 -0
  141. package/dist/component/usageAllowance/helpers.js.map +1 -0
  142. package/dist/component/usageAllowance/mutations.d.ts +37 -0
  143. package/dist/component/usageAllowance/mutations.d.ts.map +1 -0
  144. package/dist/component/usageAllowance/mutations.js +99 -0
  145. package/dist/component/usageAllowance/mutations.js.map +1 -0
  146. package/dist/component/usageAllowance/queries.d.ts +36 -0
  147. package/dist/component/usageAllowance/queries.d.ts.map +1 -0
  148. package/dist/component/usageAllowance/queries.js +113 -0
  149. package/dist/component/usageAllowance/queries.js.map +1 -0
  150. package/dist/component/usageAllowance/reservations.d.ts +25 -0
  151. package/dist/component/usageAllowance/reservations.d.ts.map +1 -0
  152. package/dist/component/usageAllowance/reservations.js +150 -0
  153. package/dist/component/usageAllowance/reservations.js.map +1 -0
  154. package/dist/component/usageAllowance/schema.d.ts +77 -0
  155. package/dist/component/usageAllowance/schema.d.ts.map +1 -0
  156. package/dist/component/usageAllowance/schema.js +32 -0
  157. package/dist/component/usageAllowance/schema.js.map +1 -0
  158. package/dist/component/usageCredits/helpers.d.ts +205 -0
  159. package/dist/component/usageCredits/helpers.d.ts.map +1 -0
  160. package/dist/component/usageCredits/helpers.js +129 -0
  161. package/dist/component/usageCredits/helpers.js.map +1 -0
  162. package/dist/component/usageCredits/mutations.d.ts +80 -0
  163. package/dist/component/usageCredits/mutations.d.ts.map +1 -0
  164. package/dist/component/usageCredits/mutations.js +344 -0
  165. package/dist/component/usageCredits/mutations.js.map +1 -0
  166. package/dist/component/usageCredits/purchase.d.ts +23 -0
  167. package/dist/component/usageCredits/purchase.d.ts.map +1 -0
  168. package/dist/component/usageCredits/purchase.js +166 -0
  169. package/dist/component/usageCredits/purchase.js.map +1 -0
  170. package/dist/component/usageCredits/queries.d.ts +184 -0
  171. package/dist/component/usageCredits/queries.d.ts.map +1 -0
  172. package/dist/component/usageCredits/queries.js +243 -0
  173. package/dist/component/usageCredits/queries.js.map +1 -0
  174. package/dist/component/usageCredits/reservations.d.ts +16 -0
  175. package/dist/component/usageCredits/reservations.d.ts.map +1 -0
  176. package/dist/component/usageCredits/reservations.js +161 -0
  177. package/dist/component/usageCredits/reservations.js.map +1 -0
  178. package/dist/component/usageCredits/schema.d.ts +282 -0
  179. package/dist/component/usageCredits/schema.d.ts.map +1 -0
  180. package/dist/component/usageCredits/schema.js +92 -0
  181. package/dist/component/usageCredits/schema.js.map +1 -0
  182. package/docs/README.md +4 -0
  183. package/docs/setup-intent-recovery.md +7 -0
  184. package/docs/usage-credits.md +255 -0
  185. package/docs/usage-ledger.md +7 -0
  186. package/docs/usage-limits.md +217 -0
  187. package/docs/webhooks.md +15 -1
  188. package/package.json +3 -1
  189. package/src/client/billing/setup-intent-read.test.ts +40 -0
  190. package/src/client/billing/setup-intent-read.ts +23 -9
  191. package/src/client/index.ts +9 -67
  192. package/src/client/types/triggers.ts +2 -0
  193. package/src/client/usage/allowanceClient.test.ts +93 -0
  194. package/src/client/usage/allowanceClient.ts +134 -0
  195. package/src/client/usage/allowanceTerms.test.ts +131 -0
  196. package/src/client/usage/allowanceTerms.ts +172 -0
  197. package/src/client/usage/client.ts +4 -4
  198. package/src/client/usage/creditCapacity.test.ts +83 -0
  199. package/src/client/usage/creditCapacity.ts +76 -0
  200. package/src/client/usage/creditClient.test.ts +221 -0
  201. package/src/client/usage/creditClient.ts +246 -0
  202. package/src/client/usage/creditDelivery.ts +105 -0
  203. package/src/client/usage/creditInvoice.test.ts +149 -0
  204. package/src/client/usage/creditInvoice.ts +87 -0
  205. package/src/client/usage/creditLifecycle.ts +175 -0
  206. package/src/client/usage/creditNative.ts +148 -0
  207. package/src/client/usage/creditObservation.test.ts +150 -0
  208. package/src/client/usage/creditObservation.ts +82 -0
  209. package/src/client/usage/creditProofs.ts +61 -0
  210. package/src/client/usage/creditProvider.test.ts +202 -0
  211. package/src/client/usage/creditProvider.ts +304 -0
  212. package/src/client/usage/creditRead.ts +32 -0
  213. package/src/client/usage/creditReconciliation.ts +213 -0
  214. package/src/client/usage/creditTerms.test.ts +48 -0
  215. package/src/client/usage/creditTerms.ts +140 -0
  216. package/src/client/usage/creditTransport.fixtures.ts +282 -0
  217. package/src/client/usage/deliveryProvider.ts +2 -0
  218. package/src/client/usage/index.ts +16 -0
  219. package/src/client/usage/record-composition.test.ts +195 -0
  220. package/src/client/usage/records.ts +26 -0
  221. package/src/client/usage/subscriptionTransport.fixtures.ts +6 -0
  222. package/src/client/usage/summary.test.ts +1 -1
  223. package/src/client/usage/summary.ts +2 -2
  224. package/src/client/usageExports.ts +56 -0
  225. package/src/client/webhook-handlers.test.ts +0 -34
  226. package/src/client/webhooks/subscription-deleted-dispatch.test.ts +61 -0
  227. package/src/client/webhooks/subscription-deleted.integration.test.ts +313 -0
  228. package/src/client/webhooks/subscriptionDeleted.ts +56 -0
  229. package/src/component/_generated/api.ts +18 -0
  230. package/src/component/_generated/component.ts +486 -0
  231. package/src/component/accountClosure/mutations.ts +14 -0
  232. package/src/component/schema.ts +16 -0
  233. package/src/component/usage/allowance.test.ts +435 -0
  234. package/src/component/usage/ledger.test.ts +8 -15
  235. package/src/component/usage/mutations.ts +22 -0
  236. package/src/component/usage/schema.ts +14 -0
  237. package/src/component/usageAllowance/helpers.ts +137 -0
  238. package/src/component/usageAllowance/mutations.ts +139 -0
  239. package/src/component/usageAllowance/queries.ts +133 -0
  240. package/src/component/usageAllowance/reservations.ts +220 -0
  241. package/src/component/usageAllowance/schema.ts +36 -0
  242. package/src/component/usageCredits/accounting.test.ts +389 -0
  243. package/src/component/usageCredits/helpers.ts +160 -0
  244. package/src/component/usageCredits/mutations.ts +451 -0
  245. package/src/component/usageCredits/purchase.ts +219 -0
  246. package/src/component/usageCredits/queries.ts +300 -0
  247. package/src/component/usageCredits/reservations.ts +214 -0
  248. package/src/component/usageCredits/schema.ts +106 -0
@@ -0,0 +1,282 @@
1
+ export declare const accountFields: {
2
+ key: import("convex/values").VString<string, "required">;
3
+ scopeKey: import("convex/values").VString<string, "required">;
4
+ bindingJson: import("convex/values").VString<string, "required">;
5
+ stripeAccountId: import("convex/values").VString<string, "required">;
6
+ customerAccount: import("convex/values").VString<string, "required">;
7
+ closed: import("convex/values").VBoolean<boolean, "required">;
8
+ purchaseCount: import("convex/values").VFloat64<number, "required">;
9
+ historyCount: import("convex/values").VFloat64<number, "required">;
10
+ frozenReason: import("convex/values").VString<string | undefined, "optional">;
11
+ };
12
+ export declare const accountsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
+ bindingJson: string;
14
+ closed: boolean;
15
+ customerAccount: string;
16
+ frozenReason?: string | undefined;
17
+ historyCount: number;
18
+ key: string;
19
+ purchaseCount: number;
20
+ scopeKey: string;
21
+ stripeAccountId: string;
22
+ }, {
23
+ key: import("convex/values").VString<string, "required">;
24
+ scopeKey: import("convex/values").VString<string, "required">;
25
+ bindingJson: import("convex/values").VString<string, "required">;
26
+ stripeAccountId: import("convex/values").VString<string, "required">;
27
+ customerAccount: import("convex/values").VString<string, "required">;
28
+ closed: import("convex/values").VBoolean<boolean, "required">;
29
+ purchaseCount: import("convex/values").VFloat64<number, "required">;
30
+ historyCount: import("convex/values").VFloat64<number, "required">;
31
+ frozenReason: import("convex/values").VString<string | undefined, "optional">;
32
+ }, "required", "bindingJson" | "closed" | "customerAccount" | "frozenReason" | "historyCount" | "key" | "purchaseCount" | "scopeKey" | "stripeAccountId">, {
33
+ by_key: ["key", "_creationTime"];
34
+ by_payer_closed: ["customerAccount", "closed", "_creationTime"];
35
+ by_realm_closed: ["stripeAccountId", "closed", "_creationTime"];
36
+ }, {}, {}>;
37
+ export declare const purchaseFields: {
38
+ key: import("convex/values").VString<string, "required">;
39
+ accountKey: import("convex/values").VString<string, "required">;
40
+ nativeCustomerKey: import("convex/values").VString<string, "required">;
41
+ capacityReserved: import("convex/values").VBoolean<boolean, "required">;
42
+ paymentAttemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
43
+ termsJson: import("convex/values").VString<string, "required">;
44
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
45
+ state: import("convex/values").VUnion<"canceled" | "frozen" | "pending" | "ready", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"frozen", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
46
+ paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
47
+ paymentKey: import("convex/values").VString<string | undefined, "optional">;
48
+ paymentProofJson: import("convex/values").VString<string | undefined, "optional">;
49
+ refundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
50
+ grantFirstAttemptAt: import("convex/values").VFloat64<number | undefined, "optional">;
51
+ creditGrantId: import("convex/values").VString<string | undefined, "optional">;
52
+ };
53
+ export declare const purchaseDoc: import("convex/values").VObject<{
54
+ _creationTime: number;
55
+ _id: import("convex/values").GenericId<"usageCreditPurchases">;
56
+ accountKey: string;
57
+ capacityReserved: boolean;
58
+ creditGrantId?: string | undefined;
59
+ firstAttemptAt: number;
60
+ grantFirstAttemptAt?: number | undefined;
61
+ key: string;
62
+ nativeCustomerKey: string;
63
+ paymentAttemptedAt?: number | undefined;
64
+ paymentIntentId?: string | undefined;
65
+ paymentKey?: string | undefined;
66
+ paymentProofJson?: string | undefined;
67
+ refundedAmount?: number | undefined;
68
+ state: "canceled" | "frozen" | "pending" | "ready";
69
+ termsJson: string;
70
+ }, {
71
+ key: import("convex/values").VString<string, "required">;
72
+ accountKey: import("convex/values").VString<string, "required">;
73
+ nativeCustomerKey: import("convex/values").VString<string, "required">;
74
+ capacityReserved: import("convex/values").VBoolean<boolean, "required">;
75
+ paymentAttemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
76
+ termsJson: import("convex/values").VString<string, "required">;
77
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
78
+ state: import("convex/values").VUnion<"canceled" | "frozen" | "pending" | "ready", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"frozen", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
79
+ paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
80
+ paymentKey: import("convex/values").VString<string | undefined, "optional">;
81
+ paymentProofJson: import("convex/values").VString<string | undefined, "optional">;
82
+ refundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
83
+ grantFirstAttemptAt: import("convex/values").VFloat64<number | undefined, "optional">;
84
+ creditGrantId: import("convex/values").VString<string | undefined, "optional">;
85
+ _id: import("convex/values").VId<import("convex/values").GenericId<"usageCreditPurchases">, "required">;
86
+ _creationTime: import("convex/values").VFloat64<number, "required">;
87
+ }, "required", "_creationTime" | "_id" | "accountKey" | "capacityReserved" | "creditGrantId" | "firstAttemptAt" | "grantFirstAttemptAt" | "key" | "nativeCustomerKey" | "paymentAttemptedAt" | "paymentIntentId" | "paymentKey" | "paymentProofJson" | "refundedAmount" | "state" | "termsJson">;
88
+ export declare const purchasesTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
89
+ accountKey: string;
90
+ capacityReserved: boolean;
91
+ creditGrantId?: string | undefined;
92
+ firstAttemptAt: number;
93
+ grantFirstAttemptAt?: number | undefined;
94
+ key: string;
95
+ nativeCustomerKey: string;
96
+ paymentAttemptedAt?: number | undefined;
97
+ paymentIntentId?: string | undefined;
98
+ paymentKey?: string | undefined;
99
+ paymentProofJson?: string | undefined;
100
+ refundedAmount?: number | undefined;
101
+ state: "canceled" | "frozen" | "pending" | "ready";
102
+ termsJson: string;
103
+ }, {
104
+ key: import("convex/values").VString<string, "required">;
105
+ accountKey: import("convex/values").VString<string, "required">;
106
+ nativeCustomerKey: import("convex/values").VString<string, "required">;
107
+ capacityReserved: import("convex/values").VBoolean<boolean, "required">;
108
+ paymentAttemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
109
+ termsJson: import("convex/values").VString<string, "required">;
110
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
111
+ state: import("convex/values").VUnion<"canceled" | "frozen" | "pending" | "ready", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"frozen", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
112
+ paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
113
+ paymentKey: import("convex/values").VString<string | undefined, "optional">;
114
+ paymentProofJson: import("convex/values").VString<string | undefined, "optional">;
115
+ refundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
116
+ grantFirstAttemptAt: import("convex/values").VFloat64<number | undefined, "optional">;
117
+ creditGrantId: import("convex/values").VString<string | undefined, "optional">;
118
+ }, "required", "accountKey" | "capacityReserved" | "creditGrantId" | "firstAttemptAt" | "grantFirstAttemptAt" | "key" | "nativeCustomerKey" | "paymentAttemptedAt" | "paymentIntentId" | "paymentKey" | "paymentProofJson" | "refundedAmount" | "state" | "termsJson">, {
119
+ by_account: ["accountKey", "_creationTime"];
120
+ by_customer_capacity: ["nativeCustomerKey", "capacityReserved", "_creationTime"];
121
+ by_key: ["key", "_creationTime"];
122
+ by_payment: ["paymentKey", "_creationTime"];
123
+ }, {}, {}>;
124
+ export declare const grantFields: {
125
+ purchaseKey: import("convex/values").VString<string, "required">;
126
+ accountKey: import("convex/values").VString<string, "required">;
127
+ creditGrantId: import("convex/values").VString<string, "required">;
128
+ nativeCustomerKey: import("convex/values").VString<string, "required">;
129
+ nativeUnused: import("convex/values").VBoolean<boolean, "required">;
130
+ nativeCreated: import("convex/values").VFloat64<number, "required">;
131
+ paymentIntentId: import("convex/values").VString<string, "required">;
132
+ chargeId: import("convex/values").VString<string, "required">;
133
+ proofJson: import("convex/values").VString<string, "required">;
134
+ available: import("convex/values").VString<string, "required">;
135
+ reserved: import("convex/values").VString<string, "required">;
136
+ consumed: import("convex/values").VString<string, "required">;
137
+ effectiveAt: import("convex/values").VFloat64<number, "required">;
138
+ expiresAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
139
+ frozen: import("convex/values").VBoolean<boolean, "required">;
140
+ nativeExpired: import("convex/values").VBoolean<boolean | undefined, "optional">;
141
+ nativeObservationJson: import("convex/values").VString<string | undefined, "optional">;
142
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
143
+ };
144
+ export declare const grantDoc: import("convex/values").VObject<{
145
+ _creationTime: number;
146
+ _id: import("convex/values").GenericId<"usageCreditGrants">;
147
+ accountKey: string;
148
+ available: string;
149
+ chargeId: string;
150
+ consumed: string;
151
+ creditGrantId: string;
152
+ effectiveAt: number;
153
+ expiresAt: number | null;
154
+ frozen: boolean;
155
+ nativeCreated: number;
156
+ nativeCustomerKey: string;
157
+ nativeExpired?: boolean | undefined;
158
+ nativeObservationJson?: string | undefined;
159
+ nativeUnused: boolean;
160
+ observedAt?: number | undefined;
161
+ paymentIntentId: string;
162
+ proofJson: string;
163
+ purchaseKey: string;
164
+ reserved: string;
165
+ }, {
166
+ purchaseKey: import("convex/values").VString<string, "required">;
167
+ accountKey: import("convex/values").VString<string, "required">;
168
+ creditGrantId: import("convex/values").VString<string, "required">;
169
+ nativeCustomerKey: import("convex/values").VString<string, "required">;
170
+ nativeUnused: import("convex/values").VBoolean<boolean, "required">;
171
+ nativeCreated: import("convex/values").VFloat64<number, "required">;
172
+ paymentIntentId: import("convex/values").VString<string, "required">;
173
+ chargeId: import("convex/values").VString<string, "required">;
174
+ proofJson: import("convex/values").VString<string, "required">;
175
+ available: import("convex/values").VString<string, "required">;
176
+ reserved: import("convex/values").VString<string, "required">;
177
+ consumed: import("convex/values").VString<string, "required">;
178
+ effectiveAt: import("convex/values").VFloat64<number, "required">;
179
+ expiresAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
180
+ frozen: import("convex/values").VBoolean<boolean, "required">;
181
+ nativeExpired: import("convex/values").VBoolean<boolean | undefined, "optional">;
182
+ nativeObservationJson: import("convex/values").VString<string | undefined, "optional">;
183
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
184
+ _id: import("convex/values").VId<import("convex/values").GenericId<"usageCreditGrants">, "required">;
185
+ _creationTime: import("convex/values").VFloat64<number, "required">;
186
+ }, "required", "_creationTime" | "_id" | "accountKey" | "available" | "chargeId" | "consumed" | "creditGrantId" | "effectiveAt" | "expiresAt" | "frozen" | "nativeCreated" | "nativeCustomerKey" | "nativeExpired" | "nativeObservationJson" | "nativeUnused" | "observedAt" | "paymentIntentId" | "proofJson" | "purchaseKey" | "reserved">;
187
+ export declare const grantsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
188
+ accountKey: string;
189
+ available: string;
190
+ chargeId: string;
191
+ consumed: string;
192
+ creditGrantId: string;
193
+ effectiveAt: number;
194
+ expiresAt: number | null;
195
+ frozen: boolean;
196
+ nativeCreated: number;
197
+ nativeCustomerKey: string;
198
+ nativeExpired?: boolean | undefined;
199
+ nativeObservationJson?: string | undefined;
200
+ nativeUnused: boolean;
201
+ observedAt?: number | undefined;
202
+ paymentIntentId: string;
203
+ proofJson: string;
204
+ purchaseKey: string;
205
+ reserved: string;
206
+ }, {
207
+ purchaseKey: import("convex/values").VString<string, "required">;
208
+ accountKey: import("convex/values").VString<string, "required">;
209
+ creditGrantId: import("convex/values").VString<string, "required">;
210
+ nativeCustomerKey: import("convex/values").VString<string, "required">;
211
+ nativeUnused: import("convex/values").VBoolean<boolean, "required">;
212
+ nativeCreated: import("convex/values").VFloat64<number, "required">;
213
+ paymentIntentId: import("convex/values").VString<string, "required">;
214
+ chargeId: import("convex/values").VString<string, "required">;
215
+ proofJson: import("convex/values").VString<string, "required">;
216
+ available: import("convex/values").VString<string, "required">;
217
+ reserved: import("convex/values").VString<string, "required">;
218
+ consumed: import("convex/values").VString<string, "required">;
219
+ effectiveAt: import("convex/values").VFloat64<number, "required">;
220
+ expiresAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
221
+ frozen: import("convex/values").VBoolean<boolean, "required">;
222
+ nativeExpired: import("convex/values").VBoolean<boolean | undefined, "optional">;
223
+ nativeObservationJson: import("convex/values").VString<string | undefined, "optional">;
224
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
225
+ }, "required", "accountKey" | "available" | "chargeId" | "consumed" | "creditGrantId" | "effectiveAt" | "expiresAt" | "frozen" | "nativeCreated" | "nativeCustomerKey" | "nativeExpired" | "nativeObservationJson" | "nativeUnused" | "observedAt" | "paymentIntentId" | "proofJson" | "purchaseKey" | "reserved">, {
226
+ by_account: ["accountKey", "_creationTime"];
227
+ by_customer_unused: ["nativeCustomerKey", "nativeUnused", "_creationTime"];
228
+ by_native: ["creditGrantId", "_creationTime"];
229
+ by_purchase: ["purchaseKey", "_creationTime"];
230
+ }, {}, {}>;
231
+ export declare const historyFields: {
232
+ accountKey: import("convex/values").VString<string, "required">;
233
+ purchaseKey: import("convex/values").VString<string | undefined, "optional">;
234
+ kind: import("convex/values").VUnion<"closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">], "required", never>;
235
+ sourceKey: import("convex/values").VString<string, "required">;
236
+ fingerprint: import("convex/values").VString<string, "required">;
237
+ evidenceJson: import("convex/values").VString<string, "required">;
238
+ at: import("convex/values").VFloat64<number, "required">;
239
+ };
240
+ export declare const historyDoc: import("convex/values").VObject<{
241
+ _creationTime: number;
242
+ _id: import("convex/values").GenericId<"usageCreditHistory">;
243
+ accountKey: string;
244
+ at: number;
245
+ evidenceJson: string;
246
+ fingerprint: string;
247
+ kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
248
+ purchaseKey?: string | undefined;
249
+ sourceKey: string;
250
+ }, {
251
+ accountKey: import("convex/values").VString<string, "required">;
252
+ purchaseKey: import("convex/values").VString<string | undefined, "optional">;
253
+ kind: import("convex/values").VUnion<"closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">], "required", never>;
254
+ sourceKey: import("convex/values").VString<string, "required">;
255
+ fingerprint: import("convex/values").VString<string, "required">;
256
+ evidenceJson: import("convex/values").VString<string, "required">;
257
+ at: import("convex/values").VFloat64<number, "required">;
258
+ _id: import("convex/values").VId<import("convex/values").GenericId<"usageCreditHistory">, "required">;
259
+ _creationTime: import("convex/values").VFloat64<number, "required">;
260
+ }, "required", "_creationTime" | "_id" | "accountKey" | "at" | "evidenceJson" | "fingerprint" | "kind" | "purchaseKey" | "sourceKey">;
261
+ export declare const historyTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
262
+ accountKey: string;
263
+ at: number;
264
+ evidenceJson: string;
265
+ fingerprint: string;
266
+ kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
267
+ purchaseKey?: string | undefined;
268
+ sourceKey: string;
269
+ }, {
270
+ accountKey: import("convex/values").VString<string, "required">;
271
+ purchaseKey: import("convex/values").VString<string | undefined, "optional">;
272
+ kind: import("convex/values").VUnion<"closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">], "required", never>;
273
+ sourceKey: import("convex/values").VString<string, "required">;
274
+ fingerprint: import("convex/values").VString<string, "required">;
275
+ evidenceJson: import("convex/values").VString<string, "required">;
276
+ at: import("convex/values").VFloat64<number, "required">;
277
+ }, "required", "accountKey" | "at" | "evidenceJson" | "fingerprint" | "kind" | "purchaseKey" | "sourceKey">, {
278
+ by_account: ["accountKey", "_creationTime"];
279
+ by_fingerprint: ["fingerprint", "_creationTime"];
280
+ by_purchase: ["accountKey", "purchaseKey", "_creationTime"];
281
+ }, {}, {}>;
282
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/usageCredits/schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;IACxB,GAAG;IACH,QAAQ;IACR,WAAW;IACX,eAAe;IACf,eAAe;IACf,MAAM;IACN,aAAa;IACb,YAAY;IACZ,YAAY;CACb,CAAC;AACF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;UAGgC,CAAC;AAC3D,eAAO,MAAM,cAAc;IACzB,GAAG;IACH,UAAU;IACV,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;IAClB,SAAS;IACT,cAAc;IACd,KAAK;IAML,eAAe;IACf,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,mBAAmB;IACnB,aAAa;CACd,CAAC;AACF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gSAItB,CAAC;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIW,CAAC;AACvC,eAAO,MAAM,WAAW;IACtB,WAAW;IACX,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,YAAY;IACZ,aAAa;IACb,eAAe;IACf,QAAQ;IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,SAAS;IACT,MAAM;IACN,aAAa;IACb,qBAAqB;IACrB,UAAU;CACX,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4UAInB,CAAC;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIc,CAAC;AACvC,eAAO,MAAM,aAAa;IACxB,UAAU;IACV,WAAW;IACX,IAAI;IAWJ,SAAS;IACT,WAAW;IACX,YAAY;IACZ,EAAE;CACH,CAAC;AACF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;qIAIrB,CAAC;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;UAG6B,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { defineTable } from "convex/server";
2
+ import { v } from "convex/values";
3
+ export const accountFields = {
4
+ key: v.string(),
5
+ scopeKey: v.string(),
6
+ bindingJson: v.string(),
7
+ stripeAccountId: v.string(),
8
+ customerAccount: v.string(),
9
+ closed: v.boolean(),
10
+ purchaseCount: v.number(),
11
+ historyCount: v.number(),
12
+ frozenReason: v.optional(v.string()),
13
+ };
14
+ export const accountsTable = defineTable(accountFields)
15
+ .index("by_key", ["key"])
16
+ .index("by_realm_closed", ["stripeAccountId", "closed"])
17
+ .index("by_payer_closed", ["customerAccount", "closed"]);
18
+ export const purchaseFields = {
19
+ key: v.string(),
20
+ accountKey: v.string(),
21
+ nativeCustomerKey: v.string(),
22
+ capacityReserved: v.boolean(),
23
+ paymentAttemptedAt: v.optional(v.number()),
24
+ termsJson: v.string(),
25
+ firstAttemptAt: v.number(),
26
+ state: v.union(v.literal("pending"), v.literal("ready"), v.literal("frozen"), v.literal("canceled")),
27
+ paymentIntentId: v.optional(v.string()),
28
+ paymentKey: v.optional(v.string()),
29
+ paymentProofJson: v.optional(v.string()),
30
+ refundedAmount: v.optional(v.number()),
31
+ grantFirstAttemptAt: v.optional(v.number()),
32
+ creditGrantId: v.optional(v.string()),
33
+ };
34
+ export const purchaseDoc = v.object({
35
+ _id: v.id("usageCreditPurchases"),
36
+ _creationTime: v.number(),
37
+ ...purchaseFields,
38
+ });
39
+ export const purchasesTable = defineTable(purchaseFields)
40
+ .index("by_key", ["key"])
41
+ .index("by_payment", ["paymentKey"])
42
+ .index("by_customer_capacity", ["nativeCustomerKey", "capacityReserved"])
43
+ .index("by_account", ["accountKey"]);
44
+ export const grantFields = {
45
+ purchaseKey: v.string(),
46
+ accountKey: v.string(),
47
+ creditGrantId: v.string(),
48
+ nativeCustomerKey: v.string(),
49
+ nativeUnused: v.boolean(),
50
+ nativeCreated: v.number(),
51
+ paymentIntentId: v.string(),
52
+ chargeId: v.string(),
53
+ proofJson: v.string(),
54
+ available: v.string(),
55
+ reserved: v.string(),
56
+ consumed: v.string(),
57
+ effectiveAt: v.number(),
58
+ expiresAt: v.union(v.number(), v.null()),
59
+ frozen: v.boolean(),
60
+ nativeExpired: v.optional(v.boolean()),
61
+ nativeObservationJson: v.optional(v.string()),
62
+ observedAt: v.optional(v.number()),
63
+ };
64
+ export const grantDoc = v.object({
65
+ _id: v.id("usageCreditGrants"),
66
+ _creationTime: v.number(),
67
+ ...grantFields,
68
+ });
69
+ export const grantsTable = defineTable(grantFields)
70
+ .index("by_purchase", ["purchaseKey"])
71
+ .index("by_native", ["creditGrantId"])
72
+ .index("by_customer_unused", ["nativeCustomerKey", "nativeUnused"])
73
+ .index("by_account", ["accountKey"]);
74
+ export const historyFields = {
75
+ accountKey: v.string(),
76
+ purchaseKey: v.optional(v.string()),
77
+ kind: v.union(v.literal("purchase"), v.literal("payment"), v.literal("grant"), v.literal("reservation"), v.literal("commit"), v.literal("release"), v.literal("observation"), v.literal("recovery"), v.literal("closure")),
78
+ sourceKey: v.string(),
79
+ fingerprint: v.string(),
80
+ evidenceJson: v.string(),
81
+ at: v.number(),
82
+ };
83
+ export const historyDoc = v.object({
84
+ _id: v.id("usageCreditHistory"),
85
+ _creationTime: v.number(),
86
+ ...historyFields,
87
+ });
88
+ export const historyTable = defineTable(historyFields)
89
+ .index("by_fingerprint", ["fingerprint"])
90
+ .index("by_account", ["accountKey"])
91
+ .index("by_purchase", ["accountKey", "purchaseKey"]);
92
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/usageCredits/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACrC,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC;KACpD,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;KACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;KACvD,KAAK,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG;I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,MAAM,EAAE;CACf,CAAC;AACF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC;IAC/B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,GAAG,aAAa;CACjB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,aAAa,CAAC;KACnD,KAAK,CAAC,gBAAgB,EAAE,CAAC,aAAa,CAAC,CAAC;KACxC,KAAK,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC;KACnC,KAAK,CAAC,aAAa,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC"}
package/docs/README.md CHANGED
@@ -66,3 +66,7 @@ Start with the [native Stripe setup guide](metering-setup.md), then read the
66
66
  [Usage observations and reconciliation](usage-observations.md) covers exact summaries, paginated audit history, native freshness and invoice observations.
67
67
 
68
68
  [Managed metered subscriptions and invoice lifecycle](usage-subscriptions.md) covers all three models, Checkout, renewal, closeout and native test clocks.
69
+
70
+ - [Payment-backed prepaid usage](./usage-credits.md)
71
+
72
+ - [Included usage and limits](./usage-limits.md) covers atomic caps, reservations, period resets and exact overage estimates.
@@ -18,6 +18,13 @@ The two authorization helpers above belong to the host. They must check the enab
18
18
 
19
19
  The SDK copies all four primitive selectors before its first await. The host user ID remains a nonempty opaque string, matching existing provisioning. It is compared exactly and is not trimmed or given an invented URL-identifier length limit. It resolves the exact component account with `requireUnique: true`, rejects absent or foreign ownership, and makes one exact platform-realm GET. The result must agree with the original ID, V2 `customer_account`, `metadata.userId` and usage. This matches the platform realm of `createSetupIntent`; it does not infer a connected-account realm or supply host authorization. Provider errors propagate and mismatched observations are rejected.
20
20
 
21
+ The exported `SetupIntentObservationStatus` type is the closed union
22
+ `requires_payment_method | requires_confirmation | requires_action | processing | canceled | succeeded`.
23
+ A single runtime allowlist and type guard qualify this union. Unknown or malformed
24
+ provider statuses fail the read instead of widening the public result to Stripe's
25
+ open status type. Hosts can assign `observation.status` directly to a matching
26
+ six-literal Convex DTO without a cast or a second projection.
27
+
21
28
  The narrow result contains `setupIntentId`, `customerAccount`, `usage`, supported `status` and `observedAt` in Unix milliseconds. A transient `clientSecret` is included only for `requires_payment_method`, `requires_confirmation` or `requires_action`; those states require a nonempty secret. `processing`, `canceled` and `succeeded` omit it. Never persist or log the secret, put it in analytics, or expose it outside the authenticated original request. The SDK does not return the raw provider object, metadata, card details or payment method.
22
29
 
23
30
  A host may resume the original public `SaveCard` confirmation through its authenticated callbacks and refresh the reactive payment-method list only after a qualified `succeeded` observation. A setup observation does not change an account-wide or subscription default. The host still owns redirect routing, reload correlation, stale-form disposal, translated errors and consent policy. The tagged Vite dashboard's tokenization/attach example is not an authenticated SetupIntent return route; its maintained callback must use the server authorization pattern above before adopting this read.