@fantastic.dev/better-stripe 0.58.0 → 0.60.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 (294) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +888 -62
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +428 -15
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +856 -30
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +444 -31
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/index.d.ts +4 -0
  12. package/dist/client/index.d.ts.map +1 -1
  13. package/dist/client/paymentSource/resolver.d.ts +12 -1
  14. package/dist/client/paymentSource/resolver.d.ts.map +1 -1
  15. package/dist/client/paymentSource/resolver.fixtures.d.ts +220 -0
  16. package/dist/client/paymentSource/resolver.fixtures.d.ts.map +1 -0
  17. package/dist/client/paymentSource/resolver.fixtures.js +189 -0
  18. package/dist/client/paymentSource/resolver.fixtures.js.map +1 -0
  19. package/dist/client/paymentSource/resolver.js +28 -3
  20. package/dist/client/paymentSource/resolver.js.map +1 -1
  21. package/dist/client/settlement/execution.d.ts +25 -0
  22. package/dist/client/settlement/execution.d.ts.map +1 -1
  23. package/dist/client/settlement/execution.js +2 -0
  24. package/dist/client/settlement/execution.js.map +1 -1
  25. package/dist/client/usage/allowanceClient.d.ts +1 -1
  26. package/dist/client/usage/catalogPrices.d.ts +1 -1
  27. package/dist/client/usage/catalogPrices.d.ts.map +1 -1
  28. package/dist/client/usage/catalogPrices.js +4 -4
  29. package/dist/client/usage/catalogPrices.js.map +1 -1
  30. package/dist/client/usage/client.d.ts +2 -2
  31. package/dist/client/usage/client.d.ts.map +1 -1
  32. package/dist/client/usage/client.js +2 -2
  33. package/dist/client/usage/client.js.map +1 -1
  34. package/dist/client/usage/correctionClient.d.ts +33 -0
  35. package/dist/client/usage/correctionClient.d.ts.map +1 -0
  36. package/dist/client/usage/correctionClient.js +27 -0
  37. package/dist/client/usage/correctionClient.js.map +1 -0
  38. package/dist/client/usage/correctionEligibility.d.ts +4 -0
  39. package/dist/client/usage/correctionEligibility.d.ts.map +1 -0
  40. package/dist/client/usage/correctionEligibility.js +7 -0
  41. package/dist/client/usage/correctionEligibility.js.map +1 -0
  42. package/dist/client/usage/correctionInvoice.d.ts +9 -0
  43. package/dist/client/usage/correctionInvoice.d.ts.map +1 -0
  44. package/dist/client/usage/correctionInvoice.js +218 -0
  45. package/dist/client/usage/correctionInvoice.js.map +1 -0
  46. package/dist/client/usage/correctionInvoiceProof.d.ts +29 -0
  47. package/dist/client/usage/correctionInvoiceProof.d.ts.map +1 -0
  48. package/dist/client/usage/correctionInvoiceProof.js +41 -0
  49. package/dist/client/usage/correctionInvoiceProof.js.map +1 -0
  50. package/dist/client/usage/correctionProofs.d.ts +36 -0
  51. package/dist/client/usage/correctionProofs.d.ts.map +1 -0
  52. package/dist/client/usage/correctionProofs.js +41 -0
  53. package/dist/client/usage/correctionProofs.js.map +1 -0
  54. package/dist/client/usage/correctionProvider.d.ts +6 -0
  55. package/dist/client/usage/correctionProvider.d.ts.map +1 -0
  56. package/dist/client/usage/correctionProvider.js +243 -0
  57. package/dist/client/usage/correctionProvider.js.map +1 -0
  58. package/dist/client/usage/correctionRead.d.ts +27 -0
  59. package/dist/client/usage/correctionRead.d.ts.map +1 -0
  60. package/dist/client/usage/correctionRead.js +36 -0
  61. package/dist/client/usage/correctionRead.js.map +1 -0
  62. package/dist/client/usage/correctionTerms.d.ts +64 -0
  63. package/dist/client/usage/correctionTerms.d.ts.map +1 -0
  64. package/dist/client/usage/correctionTerms.js +65 -0
  65. package/dist/client/usage/correctionTerms.js.map +1 -0
  66. package/dist/client/usage/correctionTransport.fixtures.d.ts +37 -0
  67. package/dist/client/usage/correctionTransport.fixtures.d.ts.map +1 -0
  68. package/dist/client/usage/correctionTransport.fixtures.js +322 -0
  69. package/dist/client/usage/correctionTransport.fixtures.js.map +1 -0
  70. package/dist/client/usage/creditClient.d.ts +1 -1
  71. package/dist/client/usage/creditRevenue.d.ts +22 -0
  72. package/dist/client/usage/creditRevenue.d.ts.map +1 -0
  73. package/dist/client/usage/creditRevenue.js +118 -0
  74. package/dist/client/usage/creditRevenue.js.map +1 -0
  75. package/dist/client/usage/creditSettlement.d.ts +29 -0
  76. package/dist/client/usage/creditSettlement.d.ts.map +1 -0
  77. package/dist/client/usage/creditSettlement.fixtures.d.ts +215 -0
  78. package/dist/client/usage/creditSettlement.fixtures.d.ts.map +1 -0
  79. package/dist/client/usage/creditSettlement.fixtures.js +59 -0
  80. package/dist/client/usage/creditSettlement.fixtures.js.map +1 -0
  81. package/dist/client/usage/creditSettlement.js +70 -0
  82. package/dist/client/usage/creditSettlement.js.map +1 -0
  83. package/dist/client/usage/creditTransport.fixtures.d.ts +7 -1
  84. package/dist/client/usage/creditTransport.fixtures.d.ts.map +1 -1
  85. package/dist/client/usage/creditTransport.fixtures.js +25 -4
  86. package/dist/client/usage/creditTransport.fixtures.js.map +1 -1
  87. package/dist/client/usage/index.d.ts +6 -0
  88. package/dist/client/usage/index.d.ts.map +1 -1
  89. package/dist/client/usage/invoiceSale.d.ts +22 -0
  90. package/dist/client/usage/invoiceSale.d.ts.map +1 -0
  91. package/dist/client/usage/invoiceSale.fixtures.d.ts +285 -0
  92. package/dist/client/usage/invoiceSale.fixtures.d.ts.map +1 -0
  93. package/dist/client/usage/invoiceSale.fixtures.js +104 -0
  94. package/dist/client/usage/invoiceSale.fixtures.js.map +1 -0
  95. package/dist/client/usage/invoiceSale.js +117 -0
  96. package/dist/client/usage/invoiceSale.js.map +1 -0
  97. package/dist/client/usage/observationClient.d.ts +20 -0
  98. package/dist/client/usage/observationClient.d.ts.map +1 -1
  99. package/dist/client/usage/observationClient.js +20 -6
  100. package/dist/client/usage/observationClient.js.map +1 -1
  101. package/dist/client/usage/records.d.ts +1 -1
  102. package/dist/client/usage/records.d.ts.map +1 -1
  103. package/dist/client/usage/records.js.map +1 -1
  104. package/dist/client/usage/settlement.d.ts +32 -0
  105. package/dist/client/usage/settlement.d.ts.map +1 -0
  106. package/dist/client/usage/settlement.js +60 -0
  107. package/dist/client/usage/settlement.js.map +1 -0
  108. package/dist/client/usage/settlementClient.d.ts +51 -0
  109. package/dist/client/usage/settlementClient.d.ts.map +1 -0
  110. package/dist/client/usage/settlementClient.js +35 -0
  111. package/dist/client/usage/settlementClient.js.map +1 -0
  112. package/dist/client/usage/summary.d.ts +3 -0
  113. package/dist/client/usage/summary.d.ts.map +1 -1
  114. package/dist/client/usage/summary.js +9 -4
  115. package/dist/client/usage/summary.js.map +1 -1
  116. package/dist/client/usageExports.d.ts +2 -0
  117. package/dist/client/usageExports.d.ts.map +1 -1
  118. package/dist/component/_generated/api.d.ts +12 -0
  119. package/dist/component/_generated/api.d.ts.map +1 -1
  120. package/dist/component/_generated/api.js.map +1 -1
  121. package/dist/component/_generated/component.d.ts +380 -14
  122. package/dist/component/_generated/component.d.ts.map +1 -1
  123. package/dist/component/accountClosure/mutations.d.ts.map +1 -1
  124. package/dist/component/accountClosure/mutations.js +13 -0
  125. package/dist/component/accountClosure/mutations.js.map +1 -1
  126. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  127. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  128. package/dist/component/earnings/triggers.d.ts +368 -32
  129. package/dist/component/earnings/triggers.d.ts.map +1 -1
  130. package/dist/component/financialObservations/settlementHelpers.d.ts.map +1 -1
  131. package/dist/component/financialObservations/settlementHelpers.js +2 -0
  132. package/dist/component/financialObservations/settlementHelpers.js.map +1 -1
  133. package/dist/component/recoveryWorkflow/helpers.d.ts +25 -0
  134. package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -1
  135. package/dist/component/recoveryWorkflow/mutations.d.ts +25 -0
  136. package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -1
  137. package/dist/component/recoveryWorkflow/queries.d.ts +50 -0
  138. package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -1
  139. package/dist/component/recoveryWorkflow/schema.d.ts +566 -10
  140. package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -1
  141. package/dist/component/schema.d.ts +428 -15
  142. package/dist/component/schema.js +4 -0
  143. package/dist/component/schema.js.map +1 -1
  144. package/dist/component/settlement/mutations.d.ts +50 -0
  145. package/dist/component/settlement/mutations.d.ts.map +1 -1
  146. package/dist/component/settlement/mutations.js +8 -1
  147. package/dist/component/settlement/mutations.js.map +1 -1
  148. package/dist/component/settlement/queries.d.ts +25 -0
  149. package/dist/component/settlement/queries.d.ts.map +1 -1
  150. package/dist/component/settlement/schema.d.ts +128 -1
  151. package/dist/component/settlement/schema.d.ts.map +1 -1
  152. package/dist/component/settlement/schema.js +22 -0
  153. package/dist/component/settlement/schema.js.map +1 -1
  154. package/dist/component/usage/queries.d.ts +2 -2
  155. package/dist/component/usage/schema.d.ts +18 -13
  156. package/dist/component/usage/schema.d.ts.map +1 -1
  157. package/dist/component/usage/schema.js +2 -1
  158. package/dist/component/usage/schema.js.map +1 -1
  159. package/dist/component/usageAllowance/queries.d.ts +1 -1
  160. package/dist/component/usageAllowance/queries.d.ts.map +1 -1
  161. package/dist/component/usageAllowance/queries.js +10 -1
  162. package/dist/component/usageAllowance/queries.js.map +1 -1
  163. package/dist/component/usageAllowance/schema.d.ts +5 -5
  164. package/dist/component/usageAllowance/schema.d.ts.map +1 -1
  165. package/dist/component/usageAllowance/schema.js +1 -1
  166. package/dist/component/usageAllowance/schema.js.map +1 -1
  167. package/dist/component/usageCorrections/accounting.d.ts +5 -0
  168. package/dist/component/usageCorrections/accounting.d.ts.map +1 -0
  169. package/dist/component/usageCorrections/accounting.js +55 -0
  170. package/dist/component/usageCorrections/accounting.js.map +1 -0
  171. package/dist/component/usageCorrections/cancellation.d.ts +6 -0
  172. package/dist/component/usageCorrections/cancellation.d.ts.map +1 -0
  173. package/dist/component/usageCorrections/cancellation.js +29 -0
  174. package/dist/component/usageCorrections/cancellation.js.map +1 -0
  175. package/dist/component/usageCorrections/helpers.d.ts +60 -0
  176. package/dist/component/usageCorrections/helpers.d.ts.map +1 -0
  177. package/dist/component/usageCorrections/helpers.js +52 -0
  178. package/dist/component/usageCorrections/helpers.js.map +1 -0
  179. package/dist/component/usageCorrections/invoice.d.ts +38 -0
  180. package/dist/component/usageCorrections/invoice.d.ts.map +1 -0
  181. package/dist/component/usageCorrections/invoice.js +82 -0
  182. package/dist/component/usageCorrections/invoice.js.map +1 -0
  183. package/dist/component/usageCorrections/mutations.d.ts +121 -0
  184. package/dist/component/usageCorrections/mutations.d.ts.map +1 -0
  185. package/dist/component/usageCorrections/mutations.js +256 -0
  186. package/dist/component/usageCorrections/mutations.js.map +1 -0
  187. package/dist/component/usageCorrections/queries.d.ts +115 -0
  188. package/dist/component/usageCorrections/queries.d.ts.map +1 -0
  189. package/dist/component/usageCorrections/queries.js +84 -0
  190. package/dist/component/usageCorrections/queries.js.map +1 -0
  191. package/dist/component/usageCorrections/schema.d.ts +248 -0
  192. package/dist/component/usageCorrections/schema.d.ts.map +1 -0
  193. package/dist/component/usageCorrections/schema.js +74 -0
  194. package/dist/component/usageCorrections/schema.js.map +1 -0
  195. package/dist/component/usageCredits/queries.d.ts +1 -1
  196. package/dist/component/usageCredits/queries.d.ts.map +1 -1
  197. package/dist/component/usageCredits/queries.js +6 -0
  198. package/dist/component/usageCredits/queries.js.map +1 -1
  199. package/dist/component/usageCredits/schema.d.ts +5 -5
  200. package/dist/component/usageCredits/schema.d.ts.map +1 -1
  201. package/dist/component/usageCredits/schema.js +1 -1
  202. package/dist/component/usageCredits/schema.js.map +1 -1
  203. package/dist/component/usageDelivery/fields.d.ts +2 -2
  204. package/dist/component/usageDelivery/fields.d.ts.map +1 -1
  205. package/dist/component/usageDelivery/fields.js +1 -1
  206. package/dist/component/usageDelivery/fields.js.map +1 -1
  207. package/dist/component/usageDelivery/helpers.d.ts +7 -6
  208. package/dist/component/usageDelivery/helpers.d.ts.map +1 -1
  209. package/dist/component/usageDelivery/mutations.d.ts +6 -6
  210. package/dist/component/usageDelivery/mutations.d.ts.map +1 -1
  211. package/dist/component/usageDelivery/mutations.js +9 -1
  212. package/dist/component/usageDelivery/mutations.js.map +1 -1
  213. package/dist/component/usageDelivery/queries.d.ts +8 -6
  214. package/dist/component/usageDelivery/queries.d.ts.map +1 -1
  215. package/dist/component/usageDelivery/schema.d.ts +4 -4
  216. package/dist/component/usageDelivery/steps.d.ts +2 -2
  217. package/dist/component/usageDelivery/steps.js +1 -1
  218. package/dist/component/usageDelivery/steps.js.map +1 -1
  219. package/dist/component/usageObservations/queries.d.ts.map +1 -1
  220. package/dist/component/usageObservations/queries.js +4 -2
  221. package/dist/component/usageObservations/queries.js.map +1 -1
  222. package/dist/component/usageSubscriptions/retirement.d.ts.map +1 -1
  223. package/dist/component/usageSubscriptions/retirement.js +24 -2
  224. package/dist/component/usageSubscriptions/retirement.js.map +1 -1
  225. package/docs/README.md +4 -0
  226. package/docs/settlement.md +4 -0
  227. package/docs/usage-corrections.md +249 -0
  228. package/docs/usage-limits.md +1 -1
  229. package/docs/usage-settlement.md +162 -0
  230. package/package.json +3 -1
  231. package/src/client/index.ts +9 -0
  232. package/src/client/paymentSource/resolver.fixtures.ts +216 -0
  233. package/src/client/paymentSource/resolver.test.ts +11 -207
  234. package/src/client/paymentSource/resolver.ts +54 -2
  235. package/src/client/settlement/execution.ts +24 -0
  236. package/src/client/usage/catalogPrices.ts +4 -2
  237. package/src/client/usage/client.ts +2 -2
  238. package/src/client/usage/correctionClient.test.ts +153 -0
  239. package/src/client/usage/correctionClient.ts +62 -0
  240. package/src/client/usage/correctionCredits.test.ts +156 -0
  241. package/src/client/usage/correctionEligibility.ts +14 -0
  242. package/src/client/usage/correctionInvoice.test.ts +127 -0
  243. package/src/client/usage/correctionInvoice.ts +269 -0
  244. package/src/client/usage/correctionInvoiceProof.ts +40 -0
  245. package/src/client/usage/correctionProofs.ts +40 -0
  246. package/src/client/usage/correctionProvider.ts +326 -0
  247. package/src/client/usage/correctionRead.ts +73 -0
  248. package/src/client/usage/correctionRecovery.test.ts +113 -0
  249. package/src/client/usage/correctionTerms.ts +98 -0
  250. package/src/client/usage/correctionTransport.fixtures.ts +372 -0
  251. package/src/client/usage/creditRevenue.test.ts +105 -0
  252. package/src/client/usage/creditRevenue.ts +163 -0
  253. package/src/client/usage/creditSettlement.fixtures.ts +70 -0
  254. package/src/client/usage/creditSettlement.test.ts +66 -0
  255. package/src/client/usage/creditSettlement.ts +94 -0
  256. package/src/client/usage/creditSettlementRecovery.test.ts +173 -0
  257. package/src/client/usage/creditTransport.fixtures.ts +29 -4
  258. package/src/client/usage/index.ts +20 -0
  259. package/src/client/usage/invoiceSale.fixtures.ts +103 -0
  260. package/src/client/usage/invoiceSale.test.ts +184 -0
  261. package/src/client/usage/invoiceSale.ts +155 -0
  262. package/src/client/usage/observationClient.ts +20 -6
  263. package/src/client/usage/records.ts +7 -1
  264. package/src/client/usage/settlement.test.ts +179 -0
  265. package/src/client/usage/settlement.ts +81 -0
  266. package/src/client/usage/settlementClient.ts +84 -0
  267. package/src/client/usage/summary.ts +12 -4
  268. package/src/client/usageExports.ts +11 -0
  269. package/src/component/_generated/api.ts +12 -0
  270. package/src/component/_generated/component.ts +440 -2
  271. package/src/component/accountClosure/mutations.ts +17 -0
  272. package/src/component/financialObservations/settlementHelpers.ts +2 -0
  273. package/src/component/schema.ts +8 -0
  274. package/src/component/settlement/mutations.ts +10 -1
  275. package/src/component/settlement/schema.ts +26 -0
  276. package/src/component/settlement/settlement-claims.test.ts +54 -0
  277. package/src/component/usage/schema.ts +2 -0
  278. package/src/component/usageAllowance/queries.ts +8 -1
  279. package/src/component/usageAllowance/schema.ts +1 -0
  280. package/src/component/usageCorrections/accounting.ts +79 -0
  281. package/src/component/usageCorrections/cancellation.ts +32 -0
  282. package/src/component/usageCorrections/corrections.test.ts +389 -0
  283. package/src/component/usageCorrections/helpers.ts +57 -0
  284. package/src/component/usageCorrections/invoice.ts +103 -0
  285. package/src/component/usageCorrections/mutations.ts +278 -0
  286. package/src/component/usageCorrections/queries.ts +94 -0
  287. package/src/component/usageCorrections/schema.ts +90 -0
  288. package/src/component/usageCredits/queries.ts +4 -0
  289. package/src/component/usageCredits/schema.ts +1 -0
  290. package/src/component/usageDelivery/fields.ts +1 -0
  291. package/src/component/usageDelivery/mutations.ts +8 -3
  292. package/src/component/usageDelivery/steps.ts +1 -1
  293. package/src/component/usageObservations/queries.ts +5 -2
  294. package/src/component/usageSubscriptions/retirement.ts +31 -2
@@ -9,6 +9,114 @@ export declare const scope: {
9
9
  };
10
10
  export declare function setup(amounts?: number[], currency?: string): Promise<{
11
11
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
12
+ usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
+ key: string;
14
+ operationKey: string;
15
+ proofJson: string;
16
+ }, {
17
+ key: import("convex/values").VString<string, "required">;
18
+ operationKey: import("convex/values").VString<string, "required">;
19
+ proofJson: import("convex/values").VString<string, "required">;
20
+ }, "required", "key" | "operationKey" | "proofJson">, {
21
+ by_key: ["key", "_creationTime"];
22
+ }, {}, {}>;
23
+ usageCorrections: import("convex/server").TableDefinition<import("convex/values").VObject<{
24
+ adjustmentJson?: string | undefined;
25
+ attempt: number;
26
+ attemptedAt?: number | undefined;
27
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
28
+ correctionId: string;
29
+ creditNoteId?: string | undefined;
30
+ customerAccount?: string | undefined;
31
+ eventId: import("convex/values").GenericId<"usageEvents">;
32
+ firstAttemptAt: number;
33
+ historyCount: number;
34
+ inputJson: string;
35
+ invoiceId?: string | undefined;
36
+ key: string;
37
+ leaseUntil?: number | undefined;
38
+ nativeAdjustmentId?: string | undefined;
39
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
40
+ nativeStatus?: "complete" | "pending" | undefined;
41
+ observedAt?: number | undefined;
42
+ quantity: string;
43
+ reason: string;
44
+ recordJson: string;
45
+ refundId?: string | undefined;
46
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
47
+ restoredQuantity: string;
48
+ scaledQuantity: string;
49
+ scopeKey: string;
50
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
51
+ stripeAccountId?: string | undefined;
52
+ subscriptionJson: string;
53
+ }, {
54
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
55
+ customerAccount: import("convex/values").VString<string | undefined, "optional">;
56
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
57
+ nativeCreditNoteStatus: import("convex/values").VUnion<"issued" | "void" | undefined, [import("convex/values").VLiteral<"issued", "required">, import("convex/values").VLiteral<"void", "required">], "optional", never>;
58
+ resolution: import("convex/values").VUnion<"event_cancellation" | "invoice_credit" | undefined, [import("convex/values").VLiteral<"event_cancellation", "required">, import("convex/values").VLiteral<"invoice_credit", "required">], "optional", never>;
59
+ adjustmentJson: import("convex/values").VString<string | undefined, "optional">;
60
+ key: import("convex/values").VString<string, "required">;
61
+ scopeKey: import("convex/values").VString<string, "required">;
62
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
63
+ correctionId: import("convex/values").VString<string, "required">;
64
+ inputJson: import("convex/values").VString<string, "required">;
65
+ recordJson: import("convex/values").VString<string, "required">;
66
+ subscriptionJson: import("convex/values").VString<string, "required">;
67
+ quantity: import("convex/values").VString<string, "required">;
68
+ scaledQuantity: import("convex/values").VString<string, "required">;
69
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
70
+ reason: import("convex/values").VString<string, "required">;
71
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
72
+ attemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
73
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
74
+ attempt: import("convex/values").VFloat64<number, "required">;
75
+ nativeAdjustmentId: import("convex/values").VString<string | undefined, "optional">;
76
+ nativeStatus: import("convex/values").VUnion<"complete" | "pending" | undefined, [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "optional", never>;
77
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
78
+ creditNoteId: import("convex/values").VString<string | undefined, "optional">;
79
+ refundId: import("convex/values").VString<string | undefined, "optional">;
80
+ cashConsequence: import("convex/values").VUnion<"none" | "operator_resolution_required" | "verified_external_adjustment", [import("convex/values").VLiteral<"none", "required">, import("convex/values").VLiteral<"operator_resolution_required", "required">, import("convex/values").VLiteral<"verified_external_adjustment", "required">], "required", never>;
81
+ restoredQuantity: import("convex/values").VString<string, "required">;
82
+ historyCount: import("convex/values").VFloat64<number, "required">;
83
+ }, "required", "adjustmentJson" | "attempt" | "attemptedAt" | "cashConsequence" | "correctionId" | "creditNoteId" | "customerAccount" | "eventId" | "firstAttemptAt" | "historyCount" | "inputJson" | "invoiceId" | "key" | "leaseUntil" | "nativeAdjustmentId" | "nativeCreditNoteStatus" | "nativeStatus" | "observedAt" | "quantity" | "reason" | "recordJson" | "refundId" | "resolution" | "restoredQuantity" | "scaledQuantity" | "scopeKey" | "state" | "stripeAccountId" | "subscriptionJson">, {
84
+ by_event: ["eventId", "_creationTime"];
85
+ by_key: ["key", "_creationTime"];
86
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
87
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
88
+ by_scope: ["scopeKey", "_creationTime"];
89
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
90
+ }, {}, {}>;
91
+ usageCorrectionHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
92
+ at: number;
93
+ eventId: import("convex/values").GenericId<"usageEvents">;
94
+ evidenceJson: string;
95
+ key: string;
96
+ occurredAt?: number | undefined;
97
+ reason: string;
98
+ recordJson: string;
99
+ scopeKey: string;
100
+ sequence: number;
101
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
102
+ subscriptionJson: string;
103
+ }, {
104
+ key: import("convex/values").VString<string, "required">;
105
+ scopeKey: import("convex/values").VString<string, "required">;
106
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
107
+ sequence: import("convex/values").VFloat64<number, "required">;
108
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
109
+ reason: import("convex/values").VString<string, "required">;
110
+ recordJson: import("convex/values").VString<string, "required">;
111
+ subscriptionJson: import("convex/values").VString<string, "required">;
112
+ evidenceJson: import("convex/values").VString<string, "required">;
113
+ occurredAt: import("convex/values").VFloat64<number | undefined, "optional">;
114
+ at: import("convex/values").VFloat64<number, "required">;
115
+ }, "required", "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson">, {
116
+ by_event: ["eventId", "_creationTime"];
117
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
118
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
119
+ }, {}, {}>;
12
120
  usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
121
  bindingJson: string;
14
122
  consumed: string;
@@ -42,10 +150,10 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
42
150
  at: number;
43
151
  evidenceJson: string;
44
152
  key: string;
45
- kind: "commit" | "policy" | "release" | "reservation";
153
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
46
154
  }, {
47
155
  key: import("convex/values").VString<string, "required">;
48
- kind: import("convex/values").VUnion<"commit" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">], "required", never>;
156
+ kind: import("convex/values").VUnion<"commit" | "correction" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
49
157
  evidenceJson: import("convex/values").VString<string, "required">;
50
158
  at: import("convex/values").VFloat64<number, "required">;
51
159
  }, "required", "at" | "evidenceJson" | "key" | "kind">, {
@@ -252,6 +360,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
252
360
  }, {}, {}>;
253
361
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
254
362
  attempts: number;
363
+ correctionKey?: string | undefined;
255
364
  definitionVersion?: 1 | undefined;
256
365
  dispatch?: string | undefined;
257
366
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -262,13 +371,13 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
262
371
  nextAttemptAt: number;
263
372
  provider?: string | undefined;
264
373
  providerIdentifier: string;
265
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
374
+ reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined;
266
375
  receipt?: {
267
376
  created: number;
268
377
  identifier: string;
269
378
  } | undefined;
270
379
  scopeKey: string;
271
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
380
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
272
381
  workflowId?: string | undefined;
273
382
  }, {
274
383
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -278,7 +387,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
278
387
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
279
388
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
280
389
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
281
- reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
390
+ reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined, [import("convex/values").VLiteral<"usage_canceled", "required">, import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
282
391
  receipt: import("convex/values").VObject<{
283
392
  created: number;
284
393
  identifier: string;
@@ -286,14 +395,15 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
286
395
  identifier: import("convex/values").VString<string, "required">;
287
396
  created: import("convex/values").VFloat64<number, "required">;
288
397
  }, "optional", "created" | "identifier">;
398
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
289
399
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
290
400
  scopeKey: import("convex/values").VString<string, "required">;
291
- state: import("convex/values").VUnion<"held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
401
+ state: import("convex/values").VUnion<"canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
292
402
  attempts: import("convex/values").VFloat64<number, "required">;
293
403
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
294
404
  providerIdentifier: import("convex/values").VString<string, "required">;
295
405
  dispatch: import("convex/values").VString<string | undefined, "optional">;
296
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
406
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
297
407
  by_event: ["eventId", "_creationTime"];
298
408
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
299
409
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -449,13 +559,13 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
449
559
  at: number;
450
560
  evidenceJson: string;
451
561
  fingerprint: string;
452
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
562
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
453
563
  purchaseKey?: string | undefined;
454
564
  sourceKey: string;
455
565
  }, {
456
566
  accountKey: import("convex/values").VString<string, "required">;
457
567
  purchaseKey: import("convex/values").VString<string | undefined, "optional">;
458
- 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>;
568
+ kind: import("convex/values").VUnion<"closure" | "commit" | "correction" | "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">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
459
569
  sourceKey: import("convex/values").VString<string, "required">;
460
570
  fingerprint: import("convex/values").VString<string, "required">;
461
571
  evidenceJson: import("convex/values").VString<string, "required">;
@@ -1004,6 +1114,15 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1004
1114
  activePhase?: "execute" | "reconcile" | undefined;
1005
1115
  allocation?: {
1006
1116
  adjustmentAmount?: number | undefined;
1117
+ creditSource?: {
1118
+ creditGrantId: string;
1119
+ customerAccount: string;
1120
+ livemode: boolean;
1121
+ purchaseId: string;
1122
+ stripeAccountId: string;
1123
+ stripePriceId: string;
1124
+ stripeProductId: string;
1125
+ } | undefined;
1007
1126
  currency: string;
1008
1127
  gross: number;
1009
1128
  paymentId?: string | undefined;
@@ -1017,6 +1136,22 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1017
1136
  destinationAccountId: string;
1018
1137
  role: "affiliate" | "other" | "store";
1019
1138
  }[];
1139
+ usageSource?: {
1140
+ customerAccount: string;
1141
+ invoicePaymentId: string;
1142
+ livemode: boolean;
1143
+ meterId: string;
1144
+ model: "included_overage" | "pay_as_you_go";
1145
+ period: {
1146
+ end: number;
1147
+ start: number;
1148
+ };
1149
+ stripeAccountId: string;
1150
+ stripePriceId: string;
1151
+ stripeProductId: string;
1152
+ subscriptionId: string;
1153
+ subscriptionItemId: string;
1154
+ } | undefined;
1020
1155
  } | undefined;
1021
1156
  cancelRequested: boolean;
1022
1157
  completion?: string | undefined;
@@ -1051,6 +1186,15 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1051
1186
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1052
1187
  allocation: import("convex/values").VObject<{
1053
1188
  adjustmentAmount?: number | undefined;
1189
+ creditSource?: {
1190
+ creditGrantId: string;
1191
+ customerAccount: string;
1192
+ livemode: boolean;
1193
+ purchaseId: string;
1194
+ stripeAccountId: string;
1195
+ stripePriceId: string;
1196
+ stripeProductId: string;
1197
+ } | undefined;
1054
1198
  currency: string;
1055
1199
  gross: number;
1056
1200
  paymentId?: string | undefined;
@@ -1064,10 +1208,77 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1064
1208
  destinationAccountId: string;
1065
1209
  role: "affiliate" | "other" | "store";
1066
1210
  }[];
1211
+ usageSource?: {
1212
+ customerAccount: string;
1213
+ invoicePaymentId: string;
1214
+ livemode: boolean;
1215
+ meterId: string;
1216
+ model: "included_overage" | "pay_as_you_go";
1217
+ period: {
1218
+ end: number;
1219
+ start: number;
1220
+ };
1221
+ stripeAccountId: string;
1222
+ stripePriceId: string;
1223
+ stripeProductId: string;
1224
+ subscriptionId: string;
1225
+ subscriptionItemId: string;
1226
+ } | undefined;
1067
1227
  } | undefined, {
1068
1228
  sourceChargeId: import("convex/values").VString<string, "required">;
1069
1229
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1070
1230
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1231
+ usageSource: import("convex/values").VObject<{
1232
+ customerAccount: string;
1233
+ invoicePaymentId: string;
1234
+ livemode: boolean;
1235
+ meterId: string;
1236
+ model: "included_overage" | "pay_as_you_go";
1237
+ period: {
1238
+ end: number;
1239
+ start: number;
1240
+ };
1241
+ stripeAccountId: string;
1242
+ stripePriceId: string;
1243
+ stripeProductId: string;
1244
+ subscriptionId: string;
1245
+ subscriptionItemId: string;
1246
+ } | undefined, {
1247
+ stripeAccountId: import("convex/values").VString<string, "required">;
1248
+ customerAccount: import("convex/values").VString<string, "required">;
1249
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1250
+ meterId: import("convex/values").VString<string, "required">;
1251
+ stripePriceId: import("convex/values").VString<string, "required">;
1252
+ stripeProductId: import("convex/values").VString<string, "required">;
1253
+ subscriptionId: import("convex/values").VString<string, "required">;
1254
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1255
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1256
+ period: import("convex/values").VObject<{
1257
+ end: number;
1258
+ start: number;
1259
+ }, {
1260
+ start: import("convex/values").VFloat64<number, "required">;
1261
+ end: import("convex/values").VFloat64<number, "required">;
1262
+ }, "required", "end" | "start">;
1263
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
1264
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1265
+ creditSource: import("convex/values").VObject<{
1266
+ creditGrantId: string;
1267
+ customerAccount: string;
1268
+ livemode: boolean;
1269
+ purchaseId: string;
1270
+ stripeAccountId: string;
1271
+ stripePriceId: string;
1272
+ stripeProductId: string;
1273
+ } | undefined, {
1274
+ stripeAccountId: import("convex/values").VString<string, "required">;
1275
+ customerAccount: import("convex/values").VString<string, "required">;
1276
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1277
+ purchaseId: import("convex/values").VString<string, "required">;
1278
+ creditGrantId: import("convex/values").VString<string, "required">;
1279
+ stripePriceId: import("convex/values").VString<string, "required">;
1280
+ stripeProductId: import("convex/values").VString<string, "required">;
1281
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1071
1282
  gross: import("convex/values").VFloat64<number, "required">;
1072
1283
  currency: import("convex/values").VString<string, "required">;
1073
1284
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1087,7 +1298,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1087
1298
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1088
1299
  amount: import("convex/values").VFloat64<number, "required">;
1089
1300
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1090
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1301
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1091
1302
  version: import("convex/values").VFloat64<number, "required">;
1092
1303
  sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
1093
1304
  sourceId: import("convex/values").VString<string, "required">;
@@ -1098,7 +1309,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1098
1309
  activePhase: import("convex/values").VUnion<"execute" | "reconcile" | undefined, [import("convex/values").VLiteral<"execute", "required">, import("convex/values").VLiteral<"reconcile", "required">], "optional", never>;
1099
1310
  resumeQueued: import("convex/values").VBoolean<boolean, "required">;
1100
1311
  outcome: import("convex/values").VUnion<"collect" | "release" | undefined, [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "optional", never>;
1101
- }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
1312
+ }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
1102
1313
  by_group: ["groupKey", "_creationTime"];
1103
1314
  by_source: ["sourceKind", "sourceId", "_creationTime"];
1104
1315
  }, {}, {}>;
@@ -1107,6 +1318,15 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1107
1318
  accountId: string;
1108
1319
  allocation?: {
1109
1320
  adjustmentAmount?: number | undefined;
1321
+ creditSource?: {
1322
+ creditGrantId: string;
1323
+ customerAccount: string;
1324
+ livemode: boolean;
1325
+ purchaseId: string;
1326
+ stripeAccountId: string;
1327
+ stripePriceId: string;
1328
+ stripeProductId: string;
1329
+ } | undefined;
1110
1330
  currency: string;
1111
1331
  gross: number;
1112
1332
  paymentId?: string | undefined;
@@ -1120,6 +1340,22 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1120
1340
  destinationAccountId: string;
1121
1341
  role: "affiliate" | "other" | "store";
1122
1342
  }[];
1343
+ usageSource?: {
1344
+ customerAccount: string;
1345
+ invoicePaymentId: string;
1346
+ livemode: boolean;
1347
+ meterId: string;
1348
+ model: "included_overage" | "pay_as_you_go";
1349
+ period: {
1350
+ end: number;
1351
+ start: number;
1352
+ };
1353
+ stripeAccountId: string;
1354
+ stripePriceId: string;
1355
+ stripeProductId: string;
1356
+ subscriptionId: string;
1357
+ subscriptionItemId: string;
1358
+ } | undefined;
1123
1359
  } | undefined;
1124
1360
  completion?: string | undefined;
1125
1361
  currency: string;
@@ -1140,6 +1376,15 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1140
1376
  accountId: string;
1141
1377
  allocation?: {
1142
1378
  adjustmentAmount?: number | undefined;
1379
+ creditSource?: {
1380
+ creditGrantId: string;
1381
+ customerAccount: string;
1382
+ livemode: boolean;
1383
+ purchaseId: string;
1384
+ stripeAccountId: string;
1385
+ stripePriceId: string;
1386
+ stripeProductId: string;
1387
+ } | undefined;
1143
1388
  currency: string;
1144
1389
  gross: number;
1145
1390
  paymentId?: string | undefined;
@@ -1153,6 +1398,22 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1153
1398
  destinationAccountId: string;
1154
1399
  role: "affiliate" | "other" | "store";
1155
1400
  }[];
1401
+ usageSource?: {
1402
+ customerAccount: string;
1403
+ invoicePaymentId: string;
1404
+ livemode: boolean;
1405
+ meterId: string;
1406
+ model: "included_overage" | "pay_as_you_go";
1407
+ period: {
1408
+ end: number;
1409
+ start: number;
1410
+ };
1411
+ stripeAccountId: string;
1412
+ stripePriceId: string;
1413
+ stripeProductId: string;
1414
+ subscriptionId: string;
1415
+ subscriptionItemId: string;
1416
+ } | undefined;
1156
1417
  } | undefined;
1157
1418
  completion?: string | undefined;
1158
1419
  currency: string;
@@ -1178,6 +1439,15 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1178
1439
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1179
1440
  allocation: import("convex/values").VObject<{
1180
1441
  adjustmentAmount?: number | undefined;
1442
+ creditSource?: {
1443
+ creditGrantId: string;
1444
+ customerAccount: string;
1445
+ livemode: boolean;
1446
+ purchaseId: string;
1447
+ stripeAccountId: string;
1448
+ stripePriceId: string;
1449
+ stripeProductId: string;
1450
+ } | undefined;
1181
1451
  currency: string;
1182
1452
  gross: number;
1183
1453
  paymentId?: string | undefined;
@@ -1191,10 +1461,77 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1191
1461
  destinationAccountId: string;
1192
1462
  role: "affiliate" | "other" | "store";
1193
1463
  }[];
1464
+ usageSource?: {
1465
+ customerAccount: string;
1466
+ invoicePaymentId: string;
1467
+ livemode: boolean;
1468
+ meterId: string;
1469
+ model: "included_overage" | "pay_as_you_go";
1470
+ period: {
1471
+ end: number;
1472
+ start: number;
1473
+ };
1474
+ stripeAccountId: string;
1475
+ stripePriceId: string;
1476
+ stripeProductId: string;
1477
+ subscriptionId: string;
1478
+ subscriptionItemId: string;
1479
+ } | undefined;
1194
1480
  } | undefined, {
1195
1481
  sourceChargeId: import("convex/values").VString<string, "required">;
1196
1482
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1197
1483
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1484
+ usageSource: import("convex/values").VObject<{
1485
+ customerAccount: string;
1486
+ invoicePaymentId: string;
1487
+ livemode: boolean;
1488
+ meterId: string;
1489
+ model: "included_overage" | "pay_as_you_go";
1490
+ period: {
1491
+ end: number;
1492
+ start: number;
1493
+ };
1494
+ stripeAccountId: string;
1495
+ stripePriceId: string;
1496
+ stripeProductId: string;
1497
+ subscriptionId: string;
1498
+ subscriptionItemId: string;
1499
+ } | undefined, {
1500
+ stripeAccountId: import("convex/values").VString<string, "required">;
1501
+ customerAccount: import("convex/values").VString<string, "required">;
1502
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1503
+ meterId: import("convex/values").VString<string, "required">;
1504
+ stripePriceId: import("convex/values").VString<string, "required">;
1505
+ stripeProductId: import("convex/values").VString<string, "required">;
1506
+ subscriptionId: import("convex/values").VString<string, "required">;
1507
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1508
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1509
+ period: import("convex/values").VObject<{
1510
+ end: number;
1511
+ start: number;
1512
+ }, {
1513
+ start: import("convex/values").VFloat64<number, "required">;
1514
+ end: import("convex/values").VFloat64<number, "required">;
1515
+ }, "required", "end" | "start">;
1516
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
1517
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1518
+ creditSource: import("convex/values").VObject<{
1519
+ creditGrantId: string;
1520
+ customerAccount: string;
1521
+ livemode: boolean;
1522
+ purchaseId: string;
1523
+ stripeAccountId: string;
1524
+ stripePriceId: string;
1525
+ stripeProductId: string;
1526
+ } | undefined, {
1527
+ stripeAccountId: import("convex/values").VString<string, "required">;
1528
+ customerAccount: import("convex/values").VString<string, "required">;
1529
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1530
+ purchaseId: import("convex/values").VString<string, "required">;
1531
+ creditGrantId: import("convex/values").VString<string, "required">;
1532
+ stripePriceId: import("convex/values").VString<string, "required">;
1533
+ stripeProductId: import("convex/values").VString<string, "required">;
1534
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1198
1535
  gross: import("convex/values").VFloat64<number, "required">;
1199
1536
  currency: import("convex/values").VString<string, "required">;
1200
1537
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1214,10 +1551,10 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1214
1551
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1215
1552
  amount: import("convex/values").VFloat64<number, "required">;
1216
1553
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1217
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1218
- }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
1554
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1555
+ }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
1219
1556
  operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
1220
- }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
1557
+ }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.creditSource" | "binding.allocation.creditSource.creditGrantId" | "binding.allocation.creditSource.customerAccount" | "binding.allocation.creditSource.livemode" | "binding.allocation.creditSource.purchaseId" | "binding.allocation.creditSource.stripeAccountId" | "binding.allocation.creditSource.stripePriceId" | "binding.allocation.creditSource.stripeProductId" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.allocation.usageSource" | "binding.allocation.usageSource.customerAccount" | "binding.allocation.usageSource.invoicePaymentId" | "binding.allocation.usageSource.livemode" | "binding.allocation.usageSource.meterId" | "binding.allocation.usageSource.model" | "binding.allocation.usageSource.period" | "binding.allocation.usageSource.period.end" | "binding.allocation.usageSource.period.start" | "binding.allocation.usageSource.stripeAccountId" | "binding.allocation.usageSource.stripePriceId" | "binding.allocation.usageSource.stripeProductId" | "binding.allocation.usageSource.subscriptionId" | "binding.allocation.usageSource.subscriptionItemId" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
1221
1558
  by_key: ["requestKey", "_creationTime"];
1222
1559
  }, {}, {}>;
1223
1560
  balanceFundingPreparations: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -1525,14 +1862,6 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1525
1862
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
1526
1863
  requestKey: string;
1527
1864
  result?: {
1528
- reason: "identity_changed" | "revision_changed" | "scope_busy";
1529
- retryable: false;
1530
- status: "conflict";
1531
- } | {
1532
- reason: "policy_invalid";
1533
- retryable: false;
1534
- status: "rejected";
1535
- } | {
1536
1865
  operation: {
1537
1866
  accountId: string;
1538
1867
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -1543,6 +1872,14 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1543
1872
  } | {
1544
1873
  enabled: boolean;
1545
1874
  status: "unchanged";
1875
+ } | {
1876
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
1877
+ retryable: false;
1878
+ status: "conflict";
1879
+ } | {
1880
+ reason: "policy_invalid";
1881
+ retryable: false;
1882
+ status: "rejected";
1546
1883
  } | {
1547
1884
  reason: "provider_pending";
1548
1885
  retryable: true;
@@ -1553,14 +1890,6 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1553
1890
  payload: import("convex/values").VString<string, "required">;
1554
1891
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
1555
1892
  result: import("convex/values").VUnion<{
1556
- reason: "identity_changed" | "revision_changed" | "scope_busy";
1557
- retryable: false;
1558
- status: "conflict";
1559
- } | {
1560
- reason: "policy_invalid";
1561
- retryable: false;
1562
- status: "rejected";
1563
- } | {
1564
1893
  operation: {
1565
1894
  accountId: string;
1566
1895
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -1571,6 +1900,14 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1571
1900
  } | {
1572
1901
  enabled: boolean;
1573
1902
  status: "unchanged";
1903
+ } | {
1904
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
1905
+ retryable: false;
1906
+ status: "conflict";
1907
+ } | {
1908
+ reason: "policy_invalid";
1909
+ retryable: false;
1910
+ status: "rejected";
1574
1911
  } | {
1575
1912
  reason: "provider_pending";
1576
1913
  retryable: true;
@@ -3015,6 +3352,15 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
3015
3352
  }, {}, {}>;
3016
3353
  settlementAllocations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3017
3354
  adjustmentAmount?: number | undefined;
3355
+ creditSource?: {
3356
+ creditGrantId: string;
3357
+ customerAccount: string;
3358
+ livemode: boolean;
3359
+ purchaseId: string;
3360
+ stripeAccountId: string;
3361
+ stripePriceId: string;
3362
+ stripeProductId: string;
3363
+ } | undefined;
3018
3364
  currency: string;
3019
3365
  gross: number;
3020
3366
  paymentId?: string | undefined;
@@ -3028,10 +3374,77 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
3028
3374
  destinationAccountId: string;
3029
3375
  role: "affiliate" | "other" | "store";
3030
3376
  }[];
3377
+ usageSource?: {
3378
+ customerAccount: string;
3379
+ invoicePaymentId: string;
3380
+ livemode: boolean;
3381
+ meterId: string;
3382
+ model: "included_overage" | "pay_as_you_go";
3383
+ period: {
3384
+ end: number;
3385
+ start: number;
3386
+ };
3387
+ stripeAccountId: string;
3388
+ stripePriceId: string;
3389
+ stripeProductId: string;
3390
+ subscriptionId: string;
3391
+ subscriptionItemId: string;
3392
+ } | undefined;
3031
3393
  }, {
3032
3394
  sourceChargeId: import("convex/values").VString<string, "required">;
3033
3395
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
3034
3396
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
3397
+ usageSource: import("convex/values").VObject<{
3398
+ customerAccount: string;
3399
+ invoicePaymentId: string;
3400
+ livemode: boolean;
3401
+ meterId: string;
3402
+ model: "included_overage" | "pay_as_you_go";
3403
+ period: {
3404
+ end: number;
3405
+ start: number;
3406
+ };
3407
+ stripeAccountId: string;
3408
+ stripePriceId: string;
3409
+ stripeProductId: string;
3410
+ subscriptionId: string;
3411
+ subscriptionItemId: string;
3412
+ } | undefined, {
3413
+ stripeAccountId: import("convex/values").VString<string, "required">;
3414
+ customerAccount: import("convex/values").VString<string, "required">;
3415
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3416
+ meterId: import("convex/values").VString<string, "required">;
3417
+ stripePriceId: import("convex/values").VString<string, "required">;
3418
+ stripeProductId: import("convex/values").VString<string, "required">;
3419
+ subscriptionId: import("convex/values").VString<string, "required">;
3420
+ subscriptionItemId: import("convex/values").VString<string, "required">;
3421
+ invoicePaymentId: import("convex/values").VString<string, "required">;
3422
+ period: import("convex/values").VObject<{
3423
+ end: number;
3424
+ start: number;
3425
+ }, {
3426
+ start: import("convex/values").VFloat64<number, "required">;
3427
+ end: import("convex/values").VFloat64<number, "required">;
3428
+ }, "required", "end" | "start">;
3429
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
3430
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
3431
+ creditSource: import("convex/values").VObject<{
3432
+ creditGrantId: string;
3433
+ customerAccount: string;
3434
+ livemode: boolean;
3435
+ purchaseId: string;
3436
+ stripeAccountId: string;
3437
+ stripePriceId: string;
3438
+ stripeProductId: string;
3439
+ } | undefined, {
3440
+ stripeAccountId: import("convex/values").VString<string, "required">;
3441
+ customerAccount: import("convex/values").VString<string, "required">;
3442
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3443
+ purchaseId: import("convex/values").VString<string, "required">;
3444
+ creditGrantId: import("convex/values").VString<string, "required">;
3445
+ stripePriceId: import("convex/values").VString<string, "required">;
3446
+ stripeProductId: import("convex/values").VString<string, "required">;
3447
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
3035
3448
  gross: import("convex/values").VFloat64<number, "required">;
3036
3449
  currency: import("convex/values").VString<string, "required">;
3037
3450
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -3051,7 +3464,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
3051
3464
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
3052
3465
  amount: import("convex/values").VFloat64<number, "required">;
3053
3466
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
3054
- }, "required", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">, {
3467
+ }, "required", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">, {
3055
3468
  by_source_charge: ["sourceChargeId", "_creationTime"];
3056
3469
  }, {}, {}>;
3057
3470
  commissionTerms: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -3872,6 +4285,114 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
3872
4285
  }>;
3873
4286
  export declare function historical(currency?: string): Promise<{
3874
4287
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
4288
+ usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
4289
+ key: string;
4290
+ operationKey: string;
4291
+ proofJson: string;
4292
+ }, {
4293
+ key: import("convex/values").VString<string, "required">;
4294
+ operationKey: import("convex/values").VString<string, "required">;
4295
+ proofJson: import("convex/values").VString<string, "required">;
4296
+ }, "required", "key" | "operationKey" | "proofJson">, {
4297
+ by_key: ["key", "_creationTime"];
4298
+ }, {}, {}>;
4299
+ usageCorrections: import("convex/server").TableDefinition<import("convex/values").VObject<{
4300
+ adjustmentJson?: string | undefined;
4301
+ attempt: number;
4302
+ attemptedAt?: number | undefined;
4303
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
4304
+ correctionId: string;
4305
+ creditNoteId?: string | undefined;
4306
+ customerAccount?: string | undefined;
4307
+ eventId: import("convex/values").GenericId<"usageEvents">;
4308
+ firstAttemptAt: number;
4309
+ historyCount: number;
4310
+ inputJson: string;
4311
+ invoiceId?: string | undefined;
4312
+ key: string;
4313
+ leaseUntil?: number | undefined;
4314
+ nativeAdjustmentId?: string | undefined;
4315
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
4316
+ nativeStatus?: "complete" | "pending" | undefined;
4317
+ observedAt?: number | undefined;
4318
+ quantity: string;
4319
+ reason: string;
4320
+ recordJson: string;
4321
+ refundId?: string | undefined;
4322
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
4323
+ restoredQuantity: string;
4324
+ scaledQuantity: string;
4325
+ scopeKey: string;
4326
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
4327
+ stripeAccountId?: string | undefined;
4328
+ subscriptionJson: string;
4329
+ }, {
4330
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
4331
+ customerAccount: import("convex/values").VString<string | undefined, "optional">;
4332
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
4333
+ nativeCreditNoteStatus: import("convex/values").VUnion<"issued" | "void" | undefined, [import("convex/values").VLiteral<"issued", "required">, import("convex/values").VLiteral<"void", "required">], "optional", never>;
4334
+ resolution: import("convex/values").VUnion<"event_cancellation" | "invoice_credit" | undefined, [import("convex/values").VLiteral<"event_cancellation", "required">, import("convex/values").VLiteral<"invoice_credit", "required">], "optional", never>;
4335
+ adjustmentJson: import("convex/values").VString<string | undefined, "optional">;
4336
+ key: import("convex/values").VString<string, "required">;
4337
+ scopeKey: import("convex/values").VString<string, "required">;
4338
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
4339
+ correctionId: import("convex/values").VString<string, "required">;
4340
+ inputJson: import("convex/values").VString<string, "required">;
4341
+ recordJson: import("convex/values").VString<string, "required">;
4342
+ subscriptionJson: import("convex/values").VString<string, "required">;
4343
+ quantity: import("convex/values").VString<string, "required">;
4344
+ scaledQuantity: import("convex/values").VString<string, "required">;
4345
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
4346
+ reason: import("convex/values").VString<string, "required">;
4347
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
4348
+ attemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
4349
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
4350
+ attempt: import("convex/values").VFloat64<number, "required">;
4351
+ nativeAdjustmentId: import("convex/values").VString<string | undefined, "optional">;
4352
+ nativeStatus: import("convex/values").VUnion<"complete" | "pending" | undefined, [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "optional", never>;
4353
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
4354
+ creditNoteId: import("convex/values").VString<string | undefined, "optional">;
4355
+ refundId: import("convex/values").VString<string | undefined, "optional">;
4356
+ cashConsequence: import("convex/values").VUnion<"none" | "operator_resolution_required" | "verified_external_adjustment", [import("convex/values").VLiteral<"none", "required">, import("convex/values").VLiteral<"operator_resolution_required", "required">, import("convex/values").VLiteral<"verified_external_adjustment", "required">], "required", never>;
4357
+ restoredQuantity: import("convex/values").VString<string, "required">;
4358
+ historyCount: import("convex/values").VFloat64<number, "required">;
4359
+ }, "required", "adjustmentJson" | "attempt" | "attemptedAt" | "cashConsequence" | "correctionId" | "creditNoteId" | "customerAccount" | "eventId" | "firstAttemptAt" | "historyCount" | "inputJson" | "invoiceId" | "key" | "leaseUntil" | "nativeAdjustmentId" | "nativeCreditNoteStatus" | "nativeStatus" | "observedAt" | "quantity" | "reason" | "recordJson" | "refundId" | "resolution" | "restoredQuantity" | "scaledQuantity" | "scopeKey" | "state" | "stripeAccountId" | "subscriptionJson">, {
4360
+ by_event: ["eventId", "_creationTime"];
4361
+ by_key: ["key", "_creationTime"];
4362
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
4363
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
4364
+ by_scope: ["scopeKey", "_creationTime"];
4365
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
4366
+ }, {}, {}>;
4367
+ usageCorrectionHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
4368
+ at: number;
4369
+ eventId: import("convex/values").GenericId<"usageEvents">;
4370
+ evidenceJson: string;
4371
+ key: string;
4372
+ occurredAt?: number | undefined;
4373
+ reason: string;
4374
+ recordJson: string;
4375
+ scopeKey: string;
4376
+ sequence: number;
4377
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
4378
+ subscriptionJson: string;
4379
+ }, {
4380
+ key: import("convex/values").VString<string, "required">;
4381
+ scopeKey: import("convex/values").VString<string, "required">;
4382
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
4383
+ sequence: import("convex/values").VFloat64<number, "required">;
4384
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
4385
+ reason: import("convex/values").VString<string, "required">;
4386
+ recordJson: import("convex/values").VString<string, "required">;
4387
+ subscriptionJson: import("convex/values").VString<string, "required">;
4388
+ evidenceJson: import("convex/values").VString<string, "required">;
4389
+ occurredAt: import("convex/values").VFloat64<number | undefined, "optional">;
4390
+ at: import("convex/values").VFloat64<number, "required">;
4391
+ }, "required", "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson">, {
4392
+ by_event: ["eventId", "_creationTime"];
4393
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
4394
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
4395
+ }, {}, {}>;
3875
4396
  usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
3876
4397
  bindingJson: string;
3877
4398
  consumed: string;
@@ -3905,10 +4426,10 @@ export declare function historical(currency?: string): Promise<{
3905
4426
  at: number;
3906
4427
  evidenceJson: string;
3907
4428
  key: string;
3908
- kind: "commit" | "policy" | "release" | "reservation";
4429
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
3909
4430
  }, {
3910
4431
  key: import("convex/values").VString<string, "required">;
3911
- kind: import("convex/values").VUnion<"commit" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">], "required", never>;
4432
+ kind: import("convex/values").VUnion<"commit" | "correction" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
3912
4433
  evidenceJson: import("convex/values").VString<string, "required">;
3913
4434
  at: import("convex/values").VFloat64<number, "required">;
3914
4435
  }, "required", "at" | "evidenceJson" | "key" | "kind">, {
@@ -4115,6 +4636,7 @@ export declare function historical(currency?: string): Promise<{
4115
4636
  }, {}, {}>;
4116
4637
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
4117
4638
  attempts: number;
4639
+ correctionKey?: string | undefined;
4118
4640
  definitionVersion?: 1 | undefined;
4119
4641
  dispatch?: string | undefined;
4120
4642
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -4125,13 +4647,13 @@ export declare function historical(currency?: string): Promise<{
4125
4647
  nextAttemptAt: number;
4126
4648
  provider?: string | undefined;
4127
4649
  providerIdentifier: string;
4128
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
4650
+ reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined;
4129
4651
  receipt?: {
4130
4652
  created: number;
4131
4653
  identifier: string;
4132
4654
  } | undefined;
4133
4655
  scopeKey: string;
4134
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
4656
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
4135
4657
  workflowId?: string | undefined;
4136
4658
  }, {
4137
4659
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -4141,7 +4663,7 @@ export declare function historical(currency?: string): Promise<{
4141
4663
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
4142
4664
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
4143
4665
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
4144
- reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
4666
+ reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined, [import("convex/values").VLiteral<"usage_canceled", "required">, import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
4145
4667
  receipt: import("convex/values").VObject<{
4146
4668
  created: number;
4147
4669
  identifier: string;
@@ -4149,14 +4671,15 @@ export declare function historical(currency?: string): Promise<{
4149
4671
  identifier: import("convex/values").VString<string, "required">;
4150
4672
  created: import("convex/values").VFloat64<number, "required">;
4151
4673
  }, "optional", "created" | "identifier">;
4674
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
4152
4675
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
4153
4676
  scopeKey: import("convex/values").VString<string, "required">;
4154
- state: import("convex/values").VUnion<"held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
4677
+ state: import("convex/values").VUnion<"canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
4155
4678
  attempts: import("convex/values").VFloat64<number, "required">;
4156
4679
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
4157
4680
  providerIdentifier: import("convex/values").VString<string, "required">;
4158
4681
  dispatch: import("convex/values").VString<string | undefined, "optional">;
4159
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
4682
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
4160
4683
  by_event: ["eventId", "_creationTime"];
4161
4684
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
4162
4685
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -4312,13 +4835,13 @@ export declare function historical(currency?: string): Promise<{
4312
4835
  at: number;
4313
4836
  evidenceJson: string;
4314
4837
  fingerprint: string;
4315
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
4838
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
4316
4839
  purchaseKey?: string | undefined;
4317
4840
  sourceKey: string;
4318
4841
  }, {
4319
4842
  accountKey: import("convex/values").VString<string, "required">;
4320
4843
  purchaseKey: import("convex/values").VString<string | undefined, "optional">;
4321
- 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>;
4844
+ kind: import("convex/values").VUnion<"closure" | "commit" | "correction" | "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">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
4322
4845
  sourceKey: import("convex/values").VString<string, "required">;
4323
4846
  fingerprint: import("convex/values").VString<string, "required">;
4324
4847
  evidenceJson: import("convex/values").VString<string, "required">;
@@ -4867,6 +5390,15 @@ export declare function historical(currency?: string): Promise<{
4867
5390
  activePhase?: "execute" | "reconcile" | undefined;
4868
5391
  allocation?: {
4869
5392
  adjustmentAmount?: number | undefined;
5393
+ creditSource?: {
5394
+ creditGrantId: string;
5395
+ customerAccount: string;
5396
+ livemode: boolean;
5397
+ purchaseId: string;
5398
+ stripeAccountId: string;
5399
+ stripePriceId: string;
5400
+ stripeProductId: string;
5401
+ } | undefined;
4870
5402
  currency: string;
4871
5403
  gross: number;
4872
5404
  paymentId?: string | undefined;
@@ -4880,6 +5412,22 @@ export declare function historical(currency?: string): Promise<{
4880
5412
  destinationAccountId: string;
4881
5413
  role: "affiliate" | "other" | "store";
4882
5414
  }[];
5415
+ usageSource?: {
5416
+ customerAccount: string;
5417
+ invoicePaymentId: string;
5418
+ livemode: boolean;
5419
+ meterId: string;
5420
+ model: "included_overage" | "pay_as_you_go";
5421
+ period: {
5422
+ end: number;
5423
+ start: number;
5424
+ };
5425
+ stripeAccountId: string;
5426
+ stripePriceId: string;
5427
+ stripeProductId: string;
5428
+ subscriptionId: string;
5429
+ subscriptionItemId: string;
5430
+ } | undefined;
4883
5431
  } | undefined;
4884
5432
  cancelRequested: boolean;
4885
5433
  completion?: string | undefined;
@@ -4914,6 +5462,15 @@ export declare function historical(currency?: string): Promise<{
4914
5462
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
4915
5463
  allocation: import("convex/values").VObject<{
4916
5464
  adjustmentAmount?: number | undefined;
5465
+ creditSource?: {
5466
+ creditGrantId: string;
5467
+ customerAccount: string;
5468
+ livemode: boolean;
5469
+ purchaseId: string;
5470
+ stripeAccountId: string;
5471
+ stripePriceId: string;
5472
+ stripeProductId: string;
5473
+ } | undefined;
4917
5474
  currency: string;
4918
5475
  gross: number;
4919
5476
  paymentId?: string | undefined;
@@ -4927,10 +5484,77 @@ export declare function historical(currency?: string): Promise<{
4927
5484
  destinationAccountId: string;
4928
5485
  role: "affiliate" | "other" | "store";
4929
5486
  }[];
5487
+ usageSource?: {
5488
+ customerAccount: string;
5489
+ invoicePaymentId: string;
5490
+ livemode: boolean;
5491
+ meterId: string;
5492
+ model: "included_overage" | "pay_as_you_go";
5493
+ period: {
5494
+ end: number;
5495
+ start: number;
5496
+ };
5497
+ stripeAccountId: string;
5498
+ stripePriceId: string;
5499
+ stripeProductId: string;
5500
+ subscriptionId: string;
5501
+ subscriptionItemId: string;
5502
+ } | undefined;
4930
5503
  } | undefined, {
4931
5504
  sourceChargeId: import("convex/values").VString<string, "required">;
4932
5505
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
4933
5506
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
5507
+ usageSource: import("convex/values").VObject<{
5508
+ customerAccount: string;
5509
+ invoicePaymentId: string;
5510
+ livemode: boolean;
5511
+ meterId: string;
5512
+ model: "included_overage" | "pay_as_you_go";
5513
+ period: {
5514
+ end: number;
5515
+ start: number;
5516
+ };
5517
+ stripeAccountId: string;
5518
+ stripePriceId: string;
5519
+ stripeProductId: string;
5520
+ subscriptionId: string;
5521
+ subscriptionItemId: string;
5522
+ } | undefined, {
5523
+ stripeAccountId: import("convex/values").VString<string, "required">;
5524
+ customerAccount: import("convex/values").VString<string, "required">;
5525
+ livemode: import("convex/values").VBoolean<boolean, "required">;
5526
+ meterId: import("convex/values").VString<string, "required">;
5527
+ stripePriceId: import("convex/values").VString<string, "required">;
5528
+ stripeProductId: import("convex/values").VString<string, "required">;
5529
+ subscriptionId: import("convex/values").VString<string, "required">;
5530
+ subscriptionItemId: import("convex/values").VString<string, "required">;
5531
+ invoicePaymentId: import("convex/values").VString<string, "required">;
5532
+ period: import("convex/values").VObject<{
5533
+ end: number;
5534
+ start: number;
5535
+ }, {
5536
+ start: import("convex/values").VFloat64<number, "required">;
5537
+ end: import("convex/values").VFloat64<number, "required">;
5538
+ }, "required", "end" | "start">;
5539
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
5540
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
5541
+ creditSource: import("convex/values").VObject<{
5542
+ creditGrantId: string;
5543
+ customerAccount: string;
5544
+ livemode: boolean;
5545
+ purchaseId: string;
5546
+ stripeAccountId: string;
5547
+ stripePriceId: string;
5548
+ stripeProductId: string;
5549
+ } | undefined, {
5550
+ stripeAccountId: import("convex/values").VString<string, "required">;
5551
+ customerAccount: import("convex/values").VString<string, "required">;
5552
+ livemode: import("convex/values").VBoolean<boolean, "required">;
5553
+ purchaseId: import("convex/values").VString<string, "required">;
5554
+ creditGrantId: import("convex/values").VString<string, "required">;
5555
+ stripePriceId: import("convex/values").VString<string, "required">;
5556
+ stripeProductId: import("convex/values").VString<string, "required">;
5557
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
4934
5558
  gross: import("convex/values").VFloat64<number, "required">;
4935
5559
  currency: import("convex/values").VString<string, "required">;
4936
5560
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -4950,7 +5574,7 @@ export declare function historical(currency?: string): Promise<{
4950
5574
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
4951
5575
  amount: import("convex/values").VFloat64<number, "required">;
4952
5576
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
4953
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
5577
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
4954
5578
  version: import("convex/values").VFloat64<number, "required">;
4955
5579
  sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
4956
5580
  sourceId: import("convex/values").VString<string, "required">;
@@ -4961,7 +5585,7 @@ export declare function historical(currency?: string): Promise<{
4961
5585
  activePhase: import("convex/values").VUnion<"execute" | "reconcile" | undefined, [import("convex/values").VLiteral<"execute", "required">, import("convex/values").VLiteral<"reconcile", "required">], "optional", never>;
4962
5586
  resumeQueued: import("convex/values").VBoolean<boolean, "required">;
4963
5587
  outcome: import("convex/values").VUnion<"collect" | "release" | undefined, [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "optional", never>;
4964
- }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
5588
+ }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
4965
5589
  by_group: ["groupKey", "_creationTime"];
4966
5590
  by_source: ["sourceKind", "sourceId", "_creationTime"];
4967
5591
  }, {}, {}>;
@@ -4970,6 +5594,15 @@ export declare function historical(currency?: string): Promise<{
4970
5594
  accountId: string;
4971
5595
  allocation?: {
4972
5596
  adjustmentAmount?: number | undefined;
5597
+ creditSource?: {
5598
+ creditGrantId: string;
5599
+ customerAccount: string;
5600
+ livemode: boolean;
5601
+ purchaseId: string;
5602
+ stripeAccountId: string;
5603
+ stripePriceId: string;
5604
+ stripeProductId: string;
5605
+ } | undefined;
4973
5606
  currency: string;
4974
5607
  gross: number;
4975
5608
  paymentId?: string | undefined;
@@ -4983,6 +5616,22 @@ export declare function historical(currency?: string): Promise<{
4983
5616
  destinationAccountId: string;
4984
5617
  role: "affiliate" | "other" | "store";
4985
5618
  }[];
5619
+ usageSource?: {
5620
+ customerAccount: string;
5621
+ invoicePaymentId: string;
5622
+ livemode: boolean;
5623
+ meterId: string;
5624
+ model: "included_overage" | "pay_as_you_go";
5625
+ period: {
5626
+ end: number;
5627
+ start: number;
5628
+ };
5629
+ stripeAccountId: string;
5630
+ stripePriceId: string;
5631
+ stripeProductId: string;
5632
+ subscriptionId: string;
5633
+ subscriptionItemId: string;
5634
+ } | undefined;
4986
5635
  } | undefined;
4987
5636
  completion?: string | undefined;
4988
5637
  currency: string;
@@ -5003,6 +5652,15 @@ export declare function historical(currency?: string): Promise<{
5003
5652
  accountId: string;
5004
5653
  allocation?: {
5005
5654
  adjustmentAmount?: number | undefined;
5655
+ creditSource?: {
5656
+ creditGrantId: string;
5657
+ customerAccount: string;
5658
+ livemode: boolean;
5659
+ purchaseId: string;
5660
+ stripeAccountId: string;
5661
+ stripePriceId: string;
5662
+ stripeProductId: string;
5663
+ } | undefined;
5006
5664
  currency: string;
5007
5665
  gross: number;
5008
5666
  paymentId?: string | undefined;
@@ -5016,6 +5674,22 @@ export declare function historical(currency?: string): Promise<{
5016
5674
  destinationAccountId: string;
5017
5675
  role: "affiliate" | "other" | "store";
5018
5676
  }[];
5677
+ usageSource?: {
5678
+ customerAccount: string;
5679
+ invoicePaymentId: string;
5680
+ livemode: boolean;
5681
+ meterId: string;
5682
+ model: "included_overage" | "pay_as_you_go";
5683
+ period: {
5684
+ end: number;
5685
+ start: number;
5686
+ };
5687
+ stripeAccountId: string;
5688
+ stripePriceId: string;
5689
+ stripeProductId: string;
5690
+ subscriptionId: string;
5691
+ subscriptionItemId: string;
5692
+ } | undefined;
5019
5693
  } | undefined;
5020
5694
  completion?: string | undefined;
5021
5695
  currency: string;
@@ -5041,6 +5715,15 @@ export declare function historical(currency?: string): Promise<{
5041
5715
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
5042
5716
  allocation: import("convex/values").VObject<{
5043
5717
  adjustmentAmount?: number | undefined;
5718
+ creditSource?: {
5719
+ creditGrantId: string;
5720
+ customerAccount: string;
5721
+ livemode: boolean;
5722
+ purchaseId: string;
5723
+ stripeAccountId: string;
5724
+ stripePriceId: string;
5725
+ stripeProductId: string;
5726
+ } | undefined;
5044
5727
  currency: string;
5045
5728
  gross: number;
5046
5729
  paymentId?: string | undefined;
@@ -5054,10 +5737,77 @@ export declare function historical(currency?: string): Promise<{
5054
5737
  destinationAccountId: string;
5055
5738
  role: "affiliate" | "other" | "store";
5056
5739
  }[];
5740
+ usageSource?: {
5741
+ customerAccount: string;
5742
+ invoicePaymentId: string;
5743
+ livemode: boolean;
5744
+ meterId: string;
5745
+ model: "included_overage" | "pay_as_you_go";
5746
+ period: {
5747
+ end: number;
5748
+ start: number;
5749
+ };
5750
+ stripeAccountId: string;
5751
+ stripePriceId: string;
5752
+ stripeProductId: string;
5753
+ subscriptionId: string;
5754
+ subscriptionItemId: string;
5755
+ } | undefined;
5057
5756
  } | undefined, {
5058
5757
  sourceChargeId: import("convex/values").VString<string, "required">;
5059
5758
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
5060
5759
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
5760
+ usageSource: import("convex/values").VObject<{
5761
+ customerAccount: string;
5762
+ invoicePaymentId: string;
5763
+ livemode: boolean;
5764
+ meterId: string;
5765
+ model: "included_overage" | "pay_as_you_go";
5766
+ period: {
5767
+ end: number;
5768
+ start: number;
5769
+ };
5770
+ stripeAccountId: string;
5771
+ stripePriceId: string;
5772
+ stripeProductId: string;
5773
+ subscriptionId: string;
5774
+ subscriptionItemId: string;
5775
+ } | undefined, {
5776
+ stripeAccountId: import("convex/values").VString<string, "required">;
5777
+ customerAccount: import("convex/values").VString<string, "required">;
5778
+ livemode: import("convex/values").VBoolean<boolean, "required">;
5779
+ meterId: import("convex/values").VString<string, "required">;
5780
+ stripePriceId: import("convex/values").VString<string, "required">;
5781
+ stripeProductId: import("convex/values").VString<string, "required">;
5782
+ subscriptionId: import("convex/values").VString<string, "required">;
5783
+ subscriptionItemId: import("convex/values").VString<string, "required">;
5784
+ invoicePaymentId: import("convex/values").VString<string, "required">;
5785
+ period: import("convex/values").VObject<{
5786
+ end: number;
5787
+ start: number;
5788
+ }, {
5789
+ start: import("convex/values").VFloat64<number, "required">;
5790
+ end: import("convex/values").VFloat64<number, "required">;
5791
+ }, "required", "end" | "start">;
5792
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
5793
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
5794
+ creditSource: import("convex/values").VObject<{
5795
+ creditGrantId: string;
5796
+ customerAccount: string;
5797
+ livemode: boolean;
5798
+ purchaseId: string;
5799
+ stripeAccountId: string;
5800
+ stripePriceId: string;
5801
+ stripeProductId: string;
5802
+ } | undefined, {
5803
+ stripeAccountId: import("convex/values").VString<string, "required">;
5804
+ customerAccount: import("convex/values").VString<string, "required">;
5805
+ livemode: import("convex/values").VBoolean<boolean, "required">;
5806
+ purchaseId: import("convex/values").VString<string, "required">;
5807
+ creditGrantId: import("convex/values").VString<string, "required">;
5808
+ stripePriceId: import("convex/values").VString<string, "required">;
5809
+ stripeProductId: import("convex/values").VString<string, "required">;
5810
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
5061
5811
  gross: import("convex/values").VFloat64<number, "required">;
5062
5812
  currency: import("convex/values").VString<string, "required">;
5063
5813
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -5077,10 +5827,10 @@ export declare function historical(currency?: string): Promise<{
5077
5827
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
5078
5828
  amount: import("convex/values").VFloat64<number, "required">;
5079
5829
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
5080
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
5081
- }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
5830
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
5831
+ }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
5082
5832
  operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
5083
- }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
5833
+ }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.creditSource" | "binding.allocation.creditSource.creditGrantId" | "binding.allocation.creditSource.customerAccount" | "binding.allocation.creditSource.livemode" | "binding.allocation.creditSource.purchaseId" | "binding.allocation.creditSource.stripeAccountId" | "binding.allocation.creditSource.stripePriceId" | "binding.allocation.creditSource.stripeProductId" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.allocation.usageSource" | "binding.allocation.usageSource.customerAccount" | "binding.allocation.usageSource.invoicePaymentId" | "binding.allocation.usageSource.livemode" | "binding.allocation.usageSource.meterId" | "binding.allocation.usageSource.model" | "binding.allocation.usageSource.period" | "binding.allocation.usageSource.period.end" | "binding.allocation.usageSource.period.start" | "binding.allocation.usageSource.stripeAccountId" | "binding.allocation.usageSource.stripePriceId" | "binding.allocation.usageSource.stripeProductId" | "binding.allocation.usageSource.subscriptionId" | "binding.allocation.usageSource.subscriptionItemId" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
5084
5834
  by_key: ["requestKey", "_creationTime"];
5085
5835
  }, {}, {}>;
5086
5836
  balanceFundingPreparations: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -5388,14 +6138,6 @@ export declare function historical(currency?: string): Promise<{
5388
6138
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
5389
6139
  requestKey: string;
5390
6140
  result?: {
5391
- reason: "identity_changed" | "revision_changed" | "scope_busy";
5392
- retryable: false;
5393
- status: "conflict";
5394
- } | {
5395
- reason: "policy_invalid";
5396
- retryable: false;
5397
- status: "rejected";
5398
- } | {
5399
6141
  operation: {
5400
6142
  accountId: string;
5401
6143
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -5406,6 +6148,14 @@ export declare function historical(currency?: string): Promise<{
5406
6148
  } | {
5407
6149
  enabled: boolean;
5408
6150
  status: "unchanged";
6151
+ } | {
6152
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
6153
+ retryable: false;
6154
+ status: "conflict";
6155
+ } | {
6156
+ reason: "policy_invalid";
6157
+ retryable: false;
6158
+ status: "rejected";
5409
6159
  } | {
5410
6160
  reason: "provider_pending";
5411
6161
  retryable: true;
@@ -5416,14 +6166,6 @@ export declare function historical(currency?: string): Promise<{
5416
6166
  payload: import("convex/values").VString<string, "required">;
5417
6167
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
5418
6168
  result: import("convex/values").VUnion<{
5419
- reason: "identity_changed" | "revision_changed" | "scope_busy";
5420
- retryable: false;
5421
- status: "conflict";
5422
- } | {
5423
- reason: "policy_invalid";
5424
- retryable: false;
5425
- status: "rejected";
5426
- } | {
5427
6169
  operation: {
5428
6170
  accountId: string;
5429
6171
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -5434,6 +6176,14 @@ export declare function historical(currency?: string): Promise<{
5434
6176
  } | {
5435
6177
  enabled: boolean;
5436
6178
  status: "unchanged";
6179
+ } | {
6180
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
6181
+ retryable: false;
6182
+ status: "conflict";
6183
+ } | {
6184
+ reason: "policy_invalid";
6185
+ retryable: false;
6186
+ status: "rejected";
5437
6187
  } | {
5438
6188
  reason: "provider_pending";
5439
6189
  retryable: true;
@@ -6878,6 +7628,15 @@ export declare function historical(currency?: string): Promise<{
6878
7628
  }, {}, {}>;
6879
7629
  settlementAllocations: import("convex/server").TableDefinition<import("convex/values").VObject<{
6880
7630
  adjustmentAmount?: number | undefined;
7631
+ creditSource?: {
7632
+ creditGrantId: string;
7633
+ customerAccount: string;
7634
+ livemode: boolean;
7635
+ purchaseId: string;
7636
+ stripeAccountId: string;
7637
+ stripePriceId: string;
7638
+ stripeProductId: string;
7639
+ } | undefined;
6881
7640
  currency: string;
6882
7641
  gross: number;
6883
7642
  paymentId?: string | undefined;
@@ -6891,10 +7650,77 @@ export declare function historical(currency?: string): Promise<{
6891
7650
  destinationAccountId: string;
6892
7651
  role: "affiliate" | "other" | "store";
6893
7652
  }[];
7653
+ usageSource?: {
7654
+ customerAccount: string;
7655
+ invoicePaymentId: string;
7656
+ livemode: boolean;
7657
+ meterId: string;
7658
+ model: "included_overage" | "pay_as_you_go";
7659
+ period: {
7660
+ end: number;
7661
+ start: number;
7662
+ };
7663
+ stripeAccountId: string;
7664
+ stripePriceId: string;
7665
+ stripeProductId: string;
7666
+ subscriptionId: string;
7667
+ subscriptionItemId: string;
7668
+ } | undefined;
6894
7669
  }, {
6895
7670
  sourceChargeId: import("convex/values").VString<string, "required">;
6896
7671
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
6897
7672
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
7673
+ usageSource: import("convex/values").VObject<{
7674
+ customerAccount: string;
7675
+ invoicePaymentId: string;
7676
+ livemode: boolean;
7677
+ meterId: string;
7678
+ model: "included_overage" | "pay_as_you_go";
7679
+ period: {
7680
+ end: number;
7681
+ start: number;
7682
+ };
7683
+ stripeAccountId: string;
7684
+ stripePriceId: string;
7685
+ stripeProductId: string;
7686
+ subscriptionId: string;
7687
+ subscriptionItemId: string;
7688
+ } | undefined, {
7689
+ stripeAccountId: import("convex/values").VString<string, "required">;
7690
+ customerAccount: import("convex/values").VString<string, "required">;
7691
+ livemode: import("convex/values").VBoolean<boolean, "required">;
7692
+ meterId: import("convex/values").VString<string, "required">;
7693
+ stripePriceId: import("convex/values").VString<string, "required">;
7694
+ stripeProductId: import("convex/values").VString<string, "required">;
7695
+ subscriptionId: import("convex/values").VString<string, "required">;
7696
+ subscriptionItemId: import("convex/values").VString<string, "required">;
7697
+ invoicePaymentId: import("convex/values").VString<string, "required">;
7698
+ period: import("convex/values").VObject<{
7699
+ end: number;
7700
+ start: number;
7701
+ }, {
7702
+ start: import("convex/values").VFloat64<number, "required">;
7703
+ end: import("convex/values").VFloat64<number, "required">;
7704
+ }, "required", "end" | "start">;
7705
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
7706
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
7707
+ creditSource: import("convex/values").VObject<{
7708
+ creditGrantId: string;
7709
+ customerAccount: string;
7710
+ livemode: boolean;
7711
+ purchaseId: string;
7712
+ stripeAccountId: string;
7713
+ stripePriceId: string;
7714
+ stripeProductId: string;
7715
+ } | undefined, {
7716
+ stripeAccountId: import("convex/values").VString<string, "required">;
7717
+ customerAccount: import("convex/values").VString<string, "required">;
7718
+ livemode: import("convex/values").VBoolean<boolean, "required">;
7719
+ purchaseId: import("convex/values").VString<string, "required">;
7720
+ creditGrantId: import("convex/values").VString<string, "required">;
7721
+ stripePriceId: import("convex/values").VString<string, "required">;
7722
+ stripeProductId: import("convex/values").VString<string, "required">;
7723
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
6898
7724
  gross: import("convex/values").VFloat64<number, "required">;
6899
7725
  currency: import("convex/values").VString<string, "required">;
6900
7726
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -6914,7 +7740,7 @@ export declare function historical(currency?: string): Promise<{
6914
7740
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
6915
7741
  amount: import("convex/values").VFloat64<number, "required">;
6916
7742
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
6917
- }, "required", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">, {
7743
+ }, "required", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">, {
6918
7744
  by_source_charge: ["sourceChargeId", "_creationTime"];
6919
7745
  }, {}, {}>;
6920
7746
  commissionTerms: import("convex/server").TableDefinition<import("convex/values").VObject<{