@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
@@ -372,14 +372,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
372
372
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
373
373
  requestKey: string;
374
374
  result?: {
375
- reason: "identity_changed" | "revision_changed" | "scope_busy";
376
- retryable: false;
377
- status: "conflict";
378
- } | {
379
- reason: "policy_invalid";
380
- retryable: false;
381
- status: "rejected";
382
- } | {
383
375
  operation: {
384
376
  accountId: string;
385
377
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -390,6 +382,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
390
382
  } | {
391
383
  enabled: boolean;
392
384
  status: "unchanged";
385
+ } | {
386
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
387
+ retryable: false;
388
+ status: "conflict";
389
+ } | {
390
+ reason: "policy_invalid";
391
+ retryable: false;
392
+ status: "rejected";
393
393
  } | {
394
394
  reason: "provider_pending";
395
395
  retryable: true;
@@ -1700,6 +1700,15 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1700
1700
  activePhase?: "execute" | "reconcile" | undefined;
1701
1701
  allocation?: {
1702
1702
  adjustmentAmount?: number | undefined;
1703
+ creditSource?: {
1704
+ creditGrantId: string;
1705
+ customerAccount: string;
1706
+ livemode: boolean;
1707
+ purchaseId: string;
1708
+ stripeAccountId: string;
1709
+ stripePriceId: string;
1710
+ stripeProductId: string;
1711
+ } | undefined;
1703
1712
  currency: string;
1704
1713
  gross: number;
1705
1714
  paymentId?: string | undefined;
@@ -1713,6 +1722,22 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1713
1722
  destinationAccountId: string;
1714
1723
  role: "affiliate" | "other" | "store";
1715
1724
  }[];
1725
+ usageSource?: {
1726
+ customerAccount: string;
1727
+ invoicePaymentId: string;
1728
+ livemode: boolean;
1729
+ meterId: string;
1730
+ model: "included_overage" | "pay_as_you_go";
1731
+ period: {
1732
+ end: number;
1733
+ start: number;
1734
+ };
1735
+ stripeAccountId: string;
1736
+ stripePriceId: string;
1737
+ stripeProductId: string;
1738
+ subscriptionId: string;
1739
+ subscriptionItemId: string;
1740
+ } | undefined;
1716
1741
  } | undefined;
1717
1742
  cancelRequested: boolean;
1718
1743
  completion?: string | undefined;
@@ -1734,7 +1759,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1734
1759
  version: number;
1735
1760
  workflowId?: string | undefined;
1736
1761
  };
1737
- fieldPaths: "_id" | ("_creationTime" | "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");
1762
+ fieldPaths: "_id" | ("_creationTime" | "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");
1738
1763
  indexes: {
1739
1764
  by_id: ["_id"];
1740
1765
  by_creation_time: ["_creationTime"];
@@ -1752,6 +1777,15 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1752
1777
  accountId: string;
1753
1778
  allocation?: {
1754
1779
  adjustmentAmount?: number | undefined;
1780
+ creditSource?: {
1781
+ creditGrantId: string;
1782
+ customerAccount: string;
1783
+ livemode: boolean;
1784
+ purchaseId: string;
1785
+ stripeAccountId: string;
1786
+ stripePriceId: string;
1787
+ stripeProductId: string;
1788
+ } | undefined;
1755
1789
  currency: string;
1756
1790
  gross: number;
1757
1791
  paymentId?: string | undefined;
@@ -1765,6 +1799,22 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1765
1799
  destinationAccountId: string;
1766
1800
  role: "affiliate" | "other" | "store";
1767
1801
  }[];
1802
+ usageSource?: {
1803
+ customerAccount: string;
1804
+ invoicePaymentId: string;
1805
+ livemode: boolean;
1806
+ meterId: string;
1807
+ model: "included_overage" | "pay_as_you_go";
1808
+ period: {
1809
+ end: number;
1810
+ start: number;
1811
+ };
1812
+ stripeAccountId: string;
1813
+ stripePriceId: string;
1814
+ stripeProductId: string;
1815
+ subscriptionId: string;
1816
+ subscriptionItemId: string;
1817
+ } | undefined;
1768
1818
  } | undefined;
1769
1819
  completion?: string | undefined;
1770
1820
  currency: string;
@@ -1780,7 +1830,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1780
1830
  operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
1781
1831
  requestKey: string;
1782
1832
  };
1783
- fieldPaths: "_id" | ("_creationTime" | "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");
1833
+ fieldPaths: "_id" | ("_creationTime" | "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");
1784
1834
  indexes: {
1785
1835
  by_id: ["_id"];
1786
1836
  by_creation_time: ["_creationTime"];
@@ -1854,6 +1904,15 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1854
1904
  _creationTime: number;
1855
1905
  _id: import("convex/values").GenericId<"settlementAllocations">;
1856
1906
  adjustmentAmount?: number | undefined;
1907
+ creditSource?: {
1908
+ creditGrantId: string;
1909
+ customerAccount: string;
1910
+ livemode: boolean;
1911
+ purchaseId: string;
1912
+ stripeAccountId: string;
1913
+ stripePriceId: string;
1914
+ stripeProductId: string;
1915
+ } | undefined;
1857
1916
  currency: string;
1858
1917
  gross: number;
1859
1918
  paymentId?: string | undefined;
@@ -1867,8 +1926,24 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1867
1926
  destinationAccountId: string;
1868
1927
  role: "affiliate" | "other" | "store";
1869
1928
  }[];
1929
+ usageSource?: {
1930
+ customerAccount: string;
1931
+ invoicePaymentId: string;
1932
+ livemode: boolean;
1933
+ meterId: string;
1934
+ model: "included_overage" | "pay_as_you_go";
1935
+ period: {
1936
+ end: number;
1937
+ start: number;
1938
+ };
1939
+ stripeAccountId: string;
1940
+ stripePriceId: string;
1941
+ stripeProductId: string;
1942
+ subscriptionId: string;
1943
+ subscriptionItemId: string;
1944
+ } | undefined;
1870
1945
  };
1871
- fieldPaths: "_id" | ("_creationTime" | "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers");
1946
+ fieldPaths: "_id" | ("_creationTime" | "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");
1872
1947
  indexes: {
1873
1948
  by_id: ["_id"];
1874
1949
  by_creation_time: ["_creationTime"];
@@ -2000,7 +2075,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2000
2075
  at: number;
2001
2076
  evidenceJson: string;
2002
2077
  key: string;
2003
- kind: "commit" | "policy" | "release" | "reservation";
2078
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
2004
2079
  };
2005
2080
  fieldPaths: "_id" | ("_creationTime" | "at" | "evidenceJson" | "key" | "kind");
2006
2081
  indexes: {
@@ -2061,6 +2136,98 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2061
2136
  searchIndexes: {};
2062
2137
  vectorIndexes: {};
2063
2138
  };
2139
+ usageCorrectionClaims: {
2140
+ document: {
2141
+ _creationTime: number;
2142
+ _id: import("convex/values").GenericId<"usageCorrectionClaims">;
2143
+ key: string;
2144
+ operationKey: string;
2145
+ proofJson: string;
2146
+ };
2147
+ fieldPaths: "_id" | ("_creationTime" | "key" | "operationKey" | "proofJson");
2148
+ indexes: {
2149
+ by_id: ["_id"];
2150
+ by_creation_time: ["_creationTime"];
2151
+ by_key: ["key", "_creationTime"];
2152
+ };
2153
+ searchIndexes: {};
2154
+ vectorIndexes: {};
2155
+ };
2156
+ usageCorrectionHistory: {
2157
+ document: {
2158
+ _creationTime: number;
2159
+ _id: import("convex/values").GenericId<"usageCorrectionHistory">;
2160
+ at: number;
2161
+ eventId: import("convex/values").GenericId<"usageEvents">;
2162
+ evidenceJson: string;
2163
+ key: string;
2164
+ occurredAt?: number | undefined;
2165
+ reason: string;
2166
+ recordJson: string;
2167
+ scopeKey: string;
2168
+ sequence: number;
2169
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
2170
+ subscriptionJson: string;
2171
+ };
2172
+ fieldPaths: "_id" | ("_creationTime" | "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson");
2173
+ indexes: {
2174
+ by_id: ["_id"];
2175
+ by_creation_time: ["_creationTime"];
2176
+ by_event: ["eventId", "_creationTime"];
2177
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
2178
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
2179
+ };
2180
+ searchIndexes: {};
2181
+ vectorIndexes: {};
2182
+ };
2183
+ usageCorrections: {
2184
+ document: {
2185
+ _creationTime: number;
2186
+ _id: import("convex/values").GenericId<"usageCorrections">;
2187
+ adjustmentJson?: string | undefined;
2188
+ attempt: number;
2189
+ attemptedAt?: number | undefined;
2190
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
2191
+ correctionId: string;
2192
+ creditNoteId?: string | undefined;
2193
+ customerAccount?: string | undefined;
2194
+ eventId: import("convex/values").GenericId<"usageEvents">;
2195
+ firstAttemptAt: number;
2196
+ historyCount: number;
2197
+ inputJson: string;
2198
+ invoiceId?: string | undefined;
2199
+ key: string;
2200
+ leaseUntil?: number | undefined;
2201
+ nativeAdjustmentId?: string | undefined;
2202
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
2203
+ nativeStatus?: "complete" | "pending" | undefined;
2204
+ observedAt?: number | undefined;
2205
+ quantity: string;
2206
+ reason: string;
2207
+ recordJson: string;
2208
+ refundId?: string | undefined;
2209
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
2210
+ restoredQuantity: string;
2211
+ scaledQuantity: string;
2212
+ scopeKey: string;
2213
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
2214
+ stripeAccountId?: string | undefined;
2215
+ subscriptionJson: string;
2216
+ };
2217
+ fieldPaths: "_id" | ("_creationTime" | "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");
2218
+ indexes: {
2219
+ by_id: ["_id"];
2220
+ by_creation_time: ["_creationTime"];
2221
+ by_event: ["eventId", "_creationTime"];
2222
+ by_key: ["key", "_creationTime"];
2223
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
2224
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
2225
+ by_scope: ["scopeKey", "_creationTime"];
2226
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
2227
+ };
2228
+ searchIndexes: {};
2229
+ vectorIndexes: {};
2230
+ };
2064
2231
  usageCreditAccounts: {
2065
2232
  document: {
2066
2233
  _creationTime: number;
@@ -2129,7 +2296,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2129
2296
  at: number;
2130
2297
  evidenceJson: string;
2131
2298
  fingerprint: string;
2132
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
2299
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
2133
2300
  purchaseKey?: string | undefined;
2134
2301
  sourceKey: string;
2135
2302
  };
@@ -2268,6 +2435,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2268
2435
  _creationTime: number;
2269
2436
  _id: import("convex/values").GenericId<"usageOutbox">;
2270
2437
  attempts: number;
2438
+ correctionKey?: string | undefined;
2271
2439
  definitionVersion?: 1 | undefined;
2272
2440
  dispatch?: string | undefined;
2273
2441
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -2278,16 +2446,16 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2278
2446
  nextAttemptAt: number;
2279
2447
  provider?: string | undefined;
2280
2448
  providerIdentifier: string;
2281
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
2449
+ 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;
2282
2450
  receipt?: {
2283
2451
  created: number;
2284
2452
  identifier: string;
2285
2453
  } | undefined;
2286
2454
  scopeKey: string;
2287
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
2455
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
2288
2456
  workflowId?: string | undefined;
2289
2457
  };
2290
- fieldPaths: "_id" | ("_creationTime" | "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId");
2458
+ fieldPaths: "_id" | ("_creationTime" | "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId");
2291
2459
  indexes: {
2292
2460
  by_id: ["_id"];
2293
2461
  by_creation_time: ["_creationTime"];
@@ -2847,14 +3015,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2847
3015
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2848
3016
  requestKey: string;
2849
3017
  result?: {
2850
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2851
- retryable: false;
2852
- status: "conflict";
2853
- } | {
2854
- reason: "policy_invalid";
2855
- retryable: false;
2856
- status: "rejected";
2857
- } | {
2858
3018
  operation: {
2859
3019
  accountId: string;
2860
3020
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2865,6 +3025,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2865
3025
  } | {
2866
3026
  enabled: boolean;
2867
3027
  status: "unchanged";
3028
+ } | {
3029
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3030
+ retryable: false;
3031
+ status: "conflict";
3032
+ } | {
3033
+ reason: "policy_invalid";
3034
+ retryable: false;
3035
+ status: "rejected";
2868
3036
  } | {
2869
3037
  reason: "provider_pending";
2870
3038
  retryable: true;
@@ -4175,6 +4343,15 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4175
4343
  activePhase?: "execute" | "reconcile" | undefined;
4176
4344
  allocation?: {
4177
4345
  adjustmentAmount?: number | undefined;
4346
+ creditSource?: {
4347
+ creditGrantId: string;
4348
+ customerAccount: string;
4349
+ livemode: boolean;
4350
+ purchaseId: string;
4351
+ stripeAccountId: string;
4352
+ stripePriceId: string;
4353
+ stripeProductId: string;
4354
+ } | undefined;
4178
4355
  currency: string;
4179
4356
  gross: number;
4180
4357
  paymentId?: string | undefined;
@@ -4188,6 +4365,22 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4188
4365
  destinationAccountId: string;
4189
4366
  role: "affiliate" | "other" | "store";
4190
4367
  }[];
4368
+ usageSource?: {
4369
+ customerAccount: string;
4370
+ invoicePaymentId: string;
4371
+ livemode: boolean;
4372
+ meterId: string;
4373
+ model: "included_overage" | "pay_as_you_go";
4374
+ period: {
4375
+ end: number;
4376
+ start: number;
4377
+ };
4378
+ stripeAccountId: string;
4379
+ stripePriceId: string;
4380
+ stripeProductId: string;
4381
+ subscriptionId: string;
4382
+ subscriptionItemId: string;
4383
+ } | undefined;
4191
4384
  } | undefined;
4192
4385
  cancelRequested: boolean;
4193
4386
  completion?: string | undefined;
@@ -4209,7 +4402,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4209
4402
  version: number;
4210
4403
  workflowId?: string | undefined;
4211
4404
  };
4212
- fieldPaths: "_id" | ("_creationTime" | "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");
4405
+ fieldPaths: "_id" | ("_creationTime" | "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");
4213
4406
  indexes: {
4214
4407
  by_id: ["_id"];
4215
4408
  by_creation_time: ["_creationTime"];
@@ -4227,6 +4420,15 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4227
4420
  accountId: string;
4228
4421
  allocation?: {
4229
4422
  adjustmentAmount?: number | undefined;
4423
+ creditSource?: {
4424
+ creditGrantId: string;
4425
+ customerAccount: string;
4426
+ livemode: boolean;
4427
+ purchaseId: string;
4428
+ stripeAccountId: string;
4429
+ stripePriceId: string;
4430
+ stripeProductId: string;
4431
+ } | undefined;
4230
4432
  currency: string;
4231
4433
  gross: number;
4232
4434
  paymentId?: string | undefined;
@@ -4240,6 +4442,22 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4240
4442
  destinationAccountId: string;
4241
4443
  role: "affiliate" | "other" | "store";
4242
4444
  }[];
4445
+ usageSource?: {
4446
+ customerAccount: string;
4447
+ invoicePaymentId: string;
4448
+ livemode: boolean;
4449
+ meterId: string;
4450
+ model: "included_overage" | "pay_as_you_go";
4451
+ period: {
4452
+ end: number;
4453
+ start: number;
4454
+ };
4455
+ stripeAccountId: string;
4456
+ stripePriceId: string;
4457
+ stripeProductId: string;
4458
+ subscriptionId: string;
4459
+ subscriptionItemId: string;
4460
+ } | undefined;
4243
4461
  } | undefined;
4244
4462
  completion?: string | undefined;
4245
4463
  currency: string;
@@ -4255,7 +4473,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4255
4473
  operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
4256
4474
  requestKey: string;
4257
4475
  };
4258
- fieldPaths: "_id" | ("_creationTime" | "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");
4476
+ fieldPaths: "_id" | ("_creationTime" | "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");
4259
4477
  indexes: {
4260
4478
  by_id: ["_id"];
4261
4479
  by_creation_time: ["_creationTime"];
@@ -4329,6 +4547,15 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4329
4547
  _creationTime: number;
4330
4548
  _id: import("convex/values").GenericId<"settlementAllocations">;
4331
4549
  adjustmentAmount?: number | undefined;
4550
+ creditSource?: {
4551
+ creditGrantId: string;
4552
+ customerAccount: string;
4553
+ livemode: boolean;
4554
+ purchaseId: string;
4555
+ stripeAccountId: string;
4556
+ stripePriceId: string;
4557
+ stripeProductId: string;
4558
+ } | undefined;
4332
4559
  currency: string;
4333
4560
  gross: number;
4334
4561
  paymentId?: string | undefined;
@@ -4342,8 +4569,24 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4342
4569
  destinationAccountId: string;
4343
4570
  role: "affiliate" | "other" | "store";
4344
4571
  }[];
4572
+ usageSource?: {
4573
+ customerAccount: string;
4574
+ invoicePaymentId: string;
4575
+ livemode: boolean;
4576
+ meterId: string;
4577
+ model: "included_overage" | "pay_as_you_go";
4578
+ period: {
4579
+ end: number;
4580
+ start: number;
4581
+ };
4582
+ stripeAccountId: string;
4583
+ stripePriceId: string;
4584
+ stripeProductId: string;
4585
+ subscriptionId: string;
4586
+ subscriptionItemId: string;
4587
+ } | undefined;
4345
4588
  };
4346
- fieldPaths: "_id" | ("_creationTime" | "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers");
4589
+ fieldPaths: "_id" | ("_creationTime" | "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");
4347
4590
  indexes: {
4348
4591
  by_id: ["_id"];
4349
4592
  by_creation_time: ["_creationTime"];
@@ -4475,7 +4718,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4475
4718
  at: number;
4476
4719
  evidenceJson: string;
4477
4720
  key: string;
4478
- kind: "commit" | "policy" | "release" | "reservation";
4721
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
4479
4722
  };
4480
4723
  fieldPaths: "_id" | ("_creationTime" | "at" | "evidenceJson" | "key" | "kind");
4481
4724
  indexes: {
@@ -4536,6 +4779,98 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4536
4779
  searchIndexes: {};
4537
4780
  vectorIndexes: {};
4538
4781
  };
4782
+ usageCorrectionClaims: {
4783
+ document: {
4784
+ _creationTime: number;
4785
+ _id: import("convex/values").GenericId<"usageCorrectionClaims">;
4786
+ key: string;
4787
+ operationKey: string;
4788
+ proofJson: string;
4789
+ };
4790
+ fieldPaths: "_id" | ("_creationTime" | "key" | "operationKey" | "proofJson");
4791
+ indexes: {
4792
+ by_id: ["_id"];
4793
+ by_creation_time: ["_creationTime"];
4794
+ by_key: ["key", "_creationTime"];
4795
+ };
4796
+ searchIndexes: {};
4797
+ vectorIndexes: {};
4798
+ };
4799
+ usageCorrectionHistory: {
4800
+ document: {
4801
+ _creationTime: number;
4802
+ _id: import("convex/values").GenericId<"usageCorrectionHistory">;
4803
+ at: number;
4804
+ eventId: import("convex/values").GenericId<"usageEvents">;
4805
+ evidenceJson: string;
4806
+ key: string;
4807
+ occurredAt?: number | undefined;
4808
+ reason: string;
4809
+ recordJson: string;
4810
+ scopeKey: string;
4811
+ sequence: number;
4812
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
4813
+ subscriptionJson: string;
4814
+ };
4815
+ fieldPaths: "_id" | ("_creationTime" | "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson");
4816
+ indexes: {
4817
+ by_id: ["_id"];
4818
+ by_creation_time: ["_creationTime"];
4819
+ by_event: ["eventId", "_creationTime"];
4820
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
4821
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
4822
+ };
4823
+ searchIndexes: {};
4824
+ vectorIndexes: {};
4825
+ };
4826
+ usageCorrections: {
4827
+ document: {
4828
+ _creationTime: number;
4829
+ _id: import("convex/values").GenericId<"usageCorrections">;
4830
+ adjustmentJson?: string | undefined;
4831
+ attempt: number;
4832
+ attemptedAt?: number | undefined;
4833
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
4834
+ correctionId: string;
4835
+ creditNoteId?: string | undefined;
4836
+ customerAccount?: string | undefined;
4837
+ eventId: import("convex/values").GenericId<"usageEvents">;
4838
+ firstAttemptAt: number;
4839
+ historyCount: number;
4840
+ inputJson: string;
4841
+ invoiceId?: string | undefined;
4842
+ key: string;
4843
+ leaseUntil?: number | undefined;
4844
+ nativeAdjustmentId?: string | undefined;
4845
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
4846
+ nativeStatus?: "complete" | "pending" | undefined;
4847
+ observedAt?: number | undefined;
4848
+ quantity: string;
4849
+ reason: string;
4850
+ recordJson: string;
4851
+ refundId?: string | undefined;
4852
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
4853
+ restoredQuantity: string;
4854
+ scaledQuantity: string;
4855
+ scopeKey: string;
4856
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
4857
+ stripeAccountId?: string | undefined;
4858
+ subscriptionJson: string;
4859
+ };
4860
+ fieldPaths: "_id" | ("_creationTime" | "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");
4861
+ indexes: {
4862
+ by_id: ["_id"];
4863
+ by_creation_time: ["_creationTime"];
4864
+ by_event: ["eventId", "_creationTime"];
4865
+ by_key: ["key", "_creationTime"];
4866
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
4867
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
4868
+ by_scope: ["scopeKey", "_creationTime"];
4869
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
4870
+ };
4871
+ searchIndexes: {};
4872
+ vectorIndexes: {};
4873
+ };
4539
4874
  usageCreditAccounts: {
4540
4875
  document: {
4541
4876
  _creationTime: number;
@@ -4604,7 +4939,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4604
4939
  at: number;
4605
4940
  evidenceJson: string;
4606
4941
  fingerprint: string;
4607
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
4942
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
4608
4943
  purchaseKey?: string | undefined;
4609
4944
  sourceKey: string;
4610
4945
  };
@@ -4743,6 +5078,7 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4743
5078
  _creationTime: number;
4744
5079
  _id: import("convex/values").GenericId<"usageOutbox">;
4745
5080
  attempts: number;
5081
+ correctionKey?: string | undefined;
4746
5082
  definitionVersion?: 1 | undefined;
4747
5083
  dispatch?: string | undefined;
4748
5084
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -4753,16 +5089,16 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
4753
5089
  nextAttemptAt: number;
4754
5090
  provider?: string | undefined;
4755
5091
  providerIdentifier: string;
4756
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
5092
+ 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;
4757
5093
  receipt?: {
4758
5094
  created: number;
4759
5095
  identifier: string;
4760
5096
  } | undefined;
4761
5097
  scopeKey: string;
4762
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
5098
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
4763
5099
  workflowId?: string | undefined;
4764
5100
  };
4765
- fieldPaths: "_id" | ("_creationTime" | "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId");
5101
+ fieldPaths: "_id" | ("_creationTime" | "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId");
4766
5102
  indexes: {
4767
5103
  by_id: ["_id"];
4768
5104
  by_creation_time: ["_creationTime"];