@fantastic.dev/better-stripe 0.63.0 → 0.64.1

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 (175) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +21 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +550 -0
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +275 -0
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +582 -32
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +291 -16
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/financialOwnership.d.ts +2 -2
  12. package/dist/client/financialOwnership.d.ts.map +1 -1
  13. package/dist/client/financialOwnership.js +2 -2
  14. package/dist/client/financialOwnership.js.map +1 -1
  15. package/dist/client/payoutRevisionMigration.d.ts +37 -0
  16. package/dist/client/payoutRevisionMigration.d.ts.map +1 -0
  17. package/dist/client/payoutRevisionMigration.js +49 -0
  18. package/dist/client/payoutRevisionMigration.js.map +1 -0
  19. package/dist/client/publicTypes.d.ts +2 -0
  20. package/dist/client/publicTypes.d.ts.map +1 -1
  21. package/dist/client/reversalObservations.d.ts +62 -0
  22. package/dist/client/reversalObservations.d.ts.map +1 -0
  23. package/dist/client/reversalObservations.js +79 -0
  24. package/dist/client/reversalObservations.js.map +1 -0
  25. package/dist/component/_generated/api.d.ts +28 -0
  26. package/dist/component/_generated/api.d.ts.map +1 -1
  27. package/dist/component/_generated/api.js.map +1 -1
  28. package/dist/component/_generated/component.d.ts +354 -0
  29. package/dist/component/_generated/component.d.ts.map +1 -1
  30. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  31. package/dist/component/balanceFunding/mutations.d.ts +16 -16
  32. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  33. package/dist/component/connect/mutations.d.ts.map +1 -1
  34. package/dist/component/connect/mutations.js +2 -0
  35. package/dist/component/connect/mutations.js.map +1 -1
  36. package/dist/component/connect/reversalClaims.d.ts.map +1 -1
  37. package/dist/component/connect/reversalClaims.js +10 -1
  38. package/dist/component/connect/reversalClaims.js.map +1 -1
  39. package/dist/component/earnings/triggers.d.ts +408 -16
  40. package/dist/component/earnings/triggers.d.ts.map +1 -1
  41. package/dist/component/financialObservations/transferSchema.d.ts +1 -0
  42. package/dist/component/financialObservations/transferSchema.d.ts.map +1 -1
  43. package/dist/component/financialObservations/transferSchema.js +1 -0
  44. package/dist/component/financialObservations/transferSchema.js.map +1 -1
  45. package/dist/component/payoutRelease/queries.d.ts +2 -2
  46. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  47. package/dist/component/payoutRevisionJournal/mutations.d.ts +15 -0
  48. package/dist/component/payoutRevisionJournal/mutations.d.ts.map +1 -0
  49. package/dist/component/payoutRevisionJournal/mutations.js +11 -0
  50. package/dist/component/payoutRevisionJournal/mutations.js.map +1 -0
  51. package/dist/component/payoutRevisionJournal/schema.d.ts +45 -0
  52. package/dist/component/payoutRevisionJournal/schema.d.ts.map +1 -0
  53. package/dist/component/payoutRevisionJournal/schema.js +22 -0
  54. package/dist/component/payoutRevisionJournal/schema.js.map +1 -0
  55. package/dist/component/payoutRevisionJournal/state.d.ts +36 -0
  56. package/dist/component/payoutRevisionJournal/state.d.ts.map +1 -0
  57. package/dist/component/payoutRevisionJournal/state.js +111 -0
  58. package/dist/component/payoutRevisionJournal/state.js.map +1 -0
  59. package/dist/component/payoutRevisionMigration/mutations.d.ts +36 -0
  60. package/dist/component/payoutRevisionMigration/mutations.d.ts.map +1 -0
  61. package/dist/component/payoutRevisionMigration/mutations.js +126 -0
  62. package/dist/component/payoutRevisionMigration/mutations.js.map +1 -0
  63. package/dist/component/payoutRevisionMigration/queries.d.ts +38 -0
  64. package/dist/component/payoutRevisionMigration/queries.d.ts.map +1 -0
  65. package/dist/component/payoutRevisionMigration/queries.js +39 -0
  66. package/dist/component/payoutRevisionMigration/queries.js.map +1 -0
  67. package/dist/component/payoutRevisionMigration/schema.d.ts +115 -0
  68. package/dist/component/payoutRevisionMigration/schema.d.ts.map +1 -0
  69. package/dist/component/payoutRevisionMigration/schema.js +52 -0
  70. package/dist/component/payoutRevisionMigration/schema.js.map +1 -0
  71. package/dist/component/payoutSnapshots/legacyRevisionWriter.d.ts +4 -0
  72. package/dist/component/payoutSnapshots/legacyRevisionWriter.d.ts.map +1 -0
  73. package/dist/component/payoutSnapshots/legacyRevisionWriter.js +33 -0
  74. package/dist/component/payoutSnapshots/legacyRevisionWriter.js.map +1 -0
  75. package/dist/component/payoutSnapshots/revisions.d.ts.map +1 -1
  76. package/dist/component/payoutSnapshots/revisions.js +23 -29
  77. package/dist/component/payoutSnapshots/revisions.js.map +1 -1
  78. package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
  79. package/dist/component/refundSync/mutations.d.ts +1 -1
  80. package/dist/component/refundSync/mutations.d.ts.map +1 -1
  81. package/dist/component/reversalObservations/capture.d.ts +6 -0
  82. package/dist/component/reversalObservations/capture.d.ts.map +1 -0
  83. package/dist/component/reversalObservations/capture.js +96 -0
  84. package/dist/component/reversalObservations/capture.js.map +1 -0
  85. package/dist/component/reversalObservations/indexSlice.d.ts +29 -0
  86. package/dist/component/reversalObservations/indexSlice.d.ts.map +1 -0
  87. package/dist/component/reversalObservations/indexSlice.js +101 -0
  88. package/dist/component/reversalObservations/indexSlice.js.map +1 -0
  89. package/dist/component/reversalObservations/integrity.d.ts +25 -0
  90. package/dist/component/reversalObservations/integrity.d.ts.map +1 -0
  91. package/dist/component/reversalObservations/integrity.js +19 -0
  92. package/dist/component/reversalObservations/integrity.js.map +1 -0
  93. package/dist/component/reversalObservations/mutations.d.ts +37 -0
  94. package/dist/component/reversalObservations/mutations.d.ts.map +1 -0
  95. package/dist/component/reversalObservations/mutations.js +181 -0
  96. package/dist/component/reversalObservations/mutations.js.map +1 -0
  97. package/dist/component/reversalObservations/pagination.d.ts +34 -0
  98. package/dist/component/reversalObservations/pagination.d.ts.map +1 -0
  99. package/dist/component/reversalObservations/pagination.js +31 -0
  100. package/dist/component/reversalObservations/pagination.js.map +1 -0
  101. package/dist/component/reversalObservations/queries.d.ts +221 -0
  102. package/dist/component/reversalObservations/queries.d.ts.map +1 -0
  103. package/dist/component/reversalObservations/queries.js +114 -0
  104. package/dist/component/reversalObservations/queries.js.map +1 -0
  105. package/dist/component/reversalObservations/references.d.ts +17 -0
  106. package/dist/component/reversalObservations/references.d.ts.map +1 -0
  107. package/dist/component/reversalObservations/references.js +95 -0
  108. package/dist/component/reversalObservations/references.js.map +1 -0
  109. package/dist/component/reversalObservations/schema.d.ts +525 -0
  110. package/dist/component/reversalObservations/schema.d.ts.map +1 -0
  111. package/dist/component/reversalObservations/schema.js +92 -0
  112. package/dist/component/reversalObservations/schema.js.map +1 -0
  113. package/dist/component/reversalObservations/selectors.d.ts +3 -0
  114. package/dist/component/reversalObservations/selectors.d.ts.map +1 -0
  115. package/dist/component/reversalObservations/selectors.js +8 -0
  116. package/dist/component/reversalObservations/selectors.js.map +1 -0
  117. package/dist/component/reversalObservations/state.d.ts +34 -0
  118. package/dist/component/reversalObservations/state.d.ts.map +1 -0
  119. package/dist/component/reversalObservations/state.js +34 -0
  120. package/dist/component/reversalObservations/state.js.map +1 -0
  121. package/dist/component/schema.d.ts +275 -0
  122. package/dist/component/schema.js +10 -0
  123. package/dist/component/schema.js.map +1 -1
  124. package/dist/component/usage/allowance.fixtures.d.ts +291 -16
  125. package/dist/component/usage/allowance.fixtures.d.ts.map +1 -1
  126. package/dist/component/usageCredits/accounting.fixtures.d.ts +275 -0
  127. package/dist/component/usageCredits/accounting.fixtures.d.ts.map +1 -1
  128. package/docs/README.md +4 -1
  129. package/docs/client-api.md +6 -0
  130. package/docs/financial-observations.md +51 -8
  131. package/docs/payout-revision-migration.md +54 -0
  132. package/docs/react-workflows-audit.md +73 -2
  133. package/docs/usage-example.md +4 -0
  134. package/docs/usage-verification.md +117 -0
  135. package/package.json +4 -2
  136. package/src/client/financialOwnership.ts +2 -2
  137. package/src/client/payoutRevisionMigration.test.ts +40 -0
  138. package/src/client/payoutRevisionMigration.ts +96 -0
  139. package/src/client/publicTypes.ts +15 -0
  140. package/src/client/reversalObservations.test.ts +69 -0
  141. package/src/client/reversalObservations.ts +151 -0
  142. package/src/component/_generated/api.ts +28 -0
  143. package/src/component/_generated/component.ts +423 -0
  144. package/src/component/connect/mutations.ts +2 -0
  145. package/src/component/connect/reversalClaims.ts +13 -1
  146. package/src/component/financialObservations/transferSchema.ts +1 -0
  147. package/src/component/payoutRevisionJournal/mutations.ts +11 -0
  148. package/src/component/payoutRevisionJournal/schema.ts +34 -0
  149. package/src/component/payoutRevisionJournal/state.ts +141 -0
  150. package/src/component/payoutRevisionMigration/mutations.ts +135 -0
  151. package/src/component/payoutRevisionMigration/queries.ts +50 -0
  152. package/src/component/payoutRevisionMigration/schema.ts +51 -0
  153. package/src/component/payoutSnapshots/legacy-revisions.test.ts +246 -0
  154. package/src/component/payoutSnapshots/legacyRevisionWriter.ts +39 -0
  155. package/src/component/payoutSnapshots/revision-journal-callbacks.test.ts +160 -0
  156. package/src/component/payoutSnapshots/revision-journal-held.test.ts +94 -0
  157. package/src/component/payoutSnapshots/revision-journal.test.ts +310 -0
  158. package/src/component/payoutSnapshots/revision-migration.test.ts +128 -0
  159. package/src/component/payoutSnapshots/revisions.ts +22 -30
  160. package/src/component/reversalObservations/boundaries.test.ts +62 -0
  161. package/src/component/reversalObservations/capture-integrity.test.ts +119 -0
  162. package/src/component/reversalObservations/capture.ts +129 -0
  163. package/src/component/reversalObservations/continuation.test.ts +131 -0
  164. package/src/component/reversalObservations/indexSlice.ts +124 -0
  165. package/src/component/reversalObservations/integrity.ts +31 -0
  166. package/src/component/reversalObservations/lifecycle.test.ts +81 -0
  167. package/src/component/reversalObservations/mutations.ts +211 -0
  168. package/src/component/reversalObservations/pagination.ts +40 -0
  169. package/src/component/reversalObservations/provenance.test.ts +167 -0
  170. package/src/component/reversalObservations/queries.ts +121 -0
  171. package/src/component/reversalObservations/references.ts +134 -0
  172. package/src/component/reversalObservations/schema.ts +100 -0
  173. package/src/component/reversalObservations/selectors.ts +9 -0
  174. package/src/component/reversalObservations/state.ts +42 -0
  175. package/src/component/schema.ts +18 -0
@@ -1,5 +1,279 @@
1
1
  export declare function setupCredits(): Promise<{
2
2
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
3
+ reversalObservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
4
+ deleted: boolean;
5
+ fingerprint: string;
6
+ generation: number;
7
+ indexTransferGeneration: number | null;
8
+ indexedCount: number;
9
+ isContradictory: boolean;
10
+ latestIdentityFingerprint: string;
11
+ latestPayloadId: import("convex/values").GenericId<"reversalObservationPayloads">;
12
+ legacy: boolean;
13
+ nextIndex: number;
14
+ operationDigest: string;
15
+ originalFingerprint: string;
16
+ originalIdentityFingerprint: string;
17
+ originalOperationId: import("convex/values").GenericId<"transferReversalOps">;
18
+ originalPayloadId: import("convex/values").GenericId<"reversalObservationPayloads">;
19
+ producer: "reversal_claim_lifecycle";
20
+ producerVersion: 1;
21
+ referenceFingerprints: string[];
22
+ sliceCount: number;
23
+ sourceChargeDigest: string;
24
+ sourceCreatedAt: number;
25
+ status: "complete" | "held" | "pending" | "validating";
26
+ }, {
27
+ originalOperationId: import("convex/values").VId<import("convex/values").GenericId<"transferReversalOps">, "required">;
28
+ sourceCreatedAt: import("convex/values").VFloat64<number, "required">;
29
+ producer: import("convex/values").VLiteral<"reversal_claim_lifecycle", "required">;
30
+ producerVersion: import("convex/values").VLiteral<1, "required">;
31
+ originalPayloadId: import("convex/values").VId<import("convex/values").GenericId<"reversalObservationPayloads">, "required">;
32
+ latestPayloadId: import("convex/values").VId<import("convex/values").GenericId<"reversalObservationPayloads">, "required">;
33
+ referenceFingerprints: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
34
+ originalFingerprint: import("convex/values").VString<string, "required">;
35
+ latestIdentityFingerprint: import("convex/values").VString<string, "required">;
36
+ originalIdentityFingerprint: import("convex/values").VString<string, "required">;
37
+ fingerprint: import("convex/values").VString<string, "required">;
38
+ operationDigest: import("convex/values").VString<string, "required">;
39
+ sourceChargeDigest: import("convex/values").VString<string, "required">;
40
+ generation: import("convex/values").VFloat64<number, "required">;
41
+ deleted: import("convex/values").VBoolean<boolean, "required">;
42
+ sliceCount: import("convex/values").VFloat64<number, "required">;
43
+ indexedCount: import("convex/values").VFloat64<number, "required">;
44
+ nextIndex: import("convex/values").VFloat64<number, "required">;
45
+ status: import("convex/values").VUnion<"complete" | "held" | "pending" | "validating", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"validating", "required">, import("convex/values").VLiteral<"complete", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
46
+ legacy: import("convex/values").VBoolean<boolean, "required">;
47
+ isContradictory: import("convex/values").VBoolean<boolean, "required">;
48
+ indexTransferGeneration: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
49
+ }, "required", "deleted" | "fingerprint" | "generation" | "indexTransferGeneration" | "indexedCount" | "isContradictory" | "latestIdentityFingerprint" | "latestPayloadId" | "legacy" | "nextIndex" | "operationDigest" | "originalFingerprint" | "originalIdentityFingerprint" | "originalOperationId" | "originalPayloadId" | "producer" | "producerVersion" | "referenceFingerprints" | "sliceCount" | "sourceChargeDigest" | "sourceCreatedAt" | "status">, {
50
+ by_operation_digest: ["operationDigest", "_creationTime"];
51
+ by_original_operation: ["originalOperationId", "_creationTime"];
52
+ by_source_charge_digest: ["sourceChargeDigest", "_creationTime"];
53
+ }, {}, {}>;
54
+ reversalObservationPayloads: import("convex/server").TableDefinition<import("convex/values").VObject<{
55
+ commissionExposure?: {
56
+ chargeAmount: number;
57
+ disputeId?: string | undefined;
58
+ disputeState?: "lost" | "open" | "won" | undefined;
59
+ finalized: boolean;
60
+ kind: "dispute" | "refund";
61
+ principal: number;
62
+ refundId?: string | undefined;
63
+ refundedPrincipal?: number | undefined;
64
+ } | undefined;
65
+ operationId: string;
66
+ slices: {
67
+ from: number;
68
+ stripeTransferId: string;
69
+ to: number;
70
+ }[];
71
+ sourceChargeId: string;
72
+ }, {
73
+ operationId: import("convex/values").VString<string, "required">;
74
+ sourceChargeId: import("convex/values").VString<string, "required">;
75
+ slices: import("convex/values").VArray<{
76
+ from: number;
77
+ stripeTransferId: string;
78
+ to: number;
79
+ }[], import("convex/values").VObject<{
80
+ from: number;
81
+ stripeTransferId: string;
82
+ to: number;
83
+ }, {
84
+ stripeTransferId: import("convex/values").VString<string, "required">;
85
+ from: import("convex/values").VFloat64<number, "required">;
86
+ to: import("convex/values").VFloat64<number, "required">;
87
+ }, "required", "from" | "stripeTransferId" | "to">, "required">;
88
+ commissionExposure: import("convex/values").VObject<{
89
+ chargeAmount: number;
90
+ disputeId?: string | undefined;
91
+ disputeState?: "lost" | "open" | "won" | undefined;
92
+ finalized: boolean;
93
+ kind: "dispute" | "refund";
94
+ principal: number;
95
+ refundId?: string | undefined;
96
+ refundedPrincipal?: number | undefined;
97
+ } | undefined, {
98
+ kind: import("convex/values").VUnion<"dispute" | "refund", [import("convex/values").VLiteral<"refund", "required">, import("convex/values").VLiteral<"dispute", "required">], "required", never>;
99
+ chargeAmount: import("convex/values").VFloat64<number, "required">;
100
+ principal: import("convex/values").VFloat64<number, "required">;
101
+ finalized: import("convex/values").VBoolean<boolean, "required">;
102
+ disputeState: import("convex/values").VUnion<"lost" | "open" | "won" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"lost", "required">, import("convex/values").VLiteral<"won", "required">], "optional", never>;
103
+ disputeId: import("convex/values").VString<string | undefined, "optional">;
104
+ refundedPrincipal: import("convex/values").VFloat64<number | undefined, "optional">;
105
+ refundId: import("convex/values").VString<string | undefined, "optional">;
106
+ }, "optional", "chargeAmount" | "disputeId" | "disputeState" | "finalized" | "kind" | "principal" | "refundId" | "refundedPrincipal">;
107
+ }, "required", "commissionExposure" | "commissionExposure.chargeAmount" | "commissionExposure.disputeId" | "commissionExposure.disputeState" | "commissionExposure.finalized" | "commissionExposure.kind" | "commissionExposure.principal" | "commissionExposure.refundId" | "commissionExposure.refundedPrincipal" | "operationId" | "slices" | "sourceChargeId">, {}, {}, {}>;
108
+ reversalObservationRefs: import("convex/server").TableDefinition<import("convex/values").VObject<{
109
+ chunkIndex: number;
110
+ observationId: import("convex/values").GenericId<"reversalObservations">;
111
+ refs: ({
112
+ ambiguous: boolean;
113
+ bucketDigest: string;
114
+ identityFingerprint: string;
115
+ markerGeneration?: number | undefined;
116
+ markerId?: import("convex/values").GenericId<"financialTransferObservations"> | undefined;
117
+ markerIdentityFingerprint?: string | undefined;
118
+ ownerDigest?: string | undefined;
119
+ ownershipFingerprint?: string | undefined;
120
+ registrationId?: import("convex/values").GenericId<"financialOwnership"> | undefined;
121
+ transferId: import("convex/values").GenericId<"transfers">;
122
+ } | null)[];
123
+ }, {
124
+ observationId: import("convex/values").VId<import("convex/values").GenericId<"reversalObservations">, "required">;
125
+ chunkIndex: import("convex/values").VFloat64<number, "required">;
126
+ refs: import("convex/values").VArray<({
127
+ ambiguous: boolean;
128
+ bucketDigest: string;
129
+ identityFingerprint: string;
130
+ markerGeneration?: number | undefined;
131
+ markerId?: import("convex/values").GenericId<"financialTransferObservations"> | undefined;
132
+ markerIdentityFingerprint?: string | undefined;
133
+ ownerDigest?: string | undefined;
134
+ ownershipFingerprint?: string | undefined;
135
+ registrationId?: import("convex/values").GenericId<"financialOwnership"> | undefined;
136
+ transferId: import("convex/values").GenericId<"transfers">;
137
+ } | null)[], import("convex/values").VUnion<{
138
+ ambiguous: boolean;
139
+ bucketDigest: string;
140
+ identityFingerprint: string;
141
+ markerGeneration?: number | undefined;
142
+ markerId?: import("convex/values").GenericId<"financialTransferObservations"> | undefined;
143
+ markerIdentityFingerprint?: string | undefined;
144
+ ownerDigest?: string | undefined;
145
+ ownershipFingerprint?: string | undefined;
146
+ registrationId?: import("convex/values").GenericId<"financialOwnership"> | undefined;
147
+ transferId: import("convex/values").GenericId<"transfers">;
148
+ } | null, [import("convex/values").VObject<{
149
+ ambiguous: boolean;
150
+ bucketDigest: string;
151
+ identityFingerprint: string;
152
+ markerGeneration?: number | undefined;
153
+ markerId?: import("convex/values").GenericId<"financialTransferObservations"> | undefined;
154
+ markerIdentityFingerprint?: string | undefined;
155
+ ownerDigest?: string | undefined;
156
+ ownershipFingerprint?: string | undefined;
157
+ registrationId?: import("convex/values").GenericId<"financialOwnership"> | undefined;
158
+ transferId: import("convex/values").GenericId<"transfers">;
159
+ }, {
160
+ transferId: import("convex/values").VId<import("convex/values").GenericId<"transfers">, "required">;
161
+ bucketDigest: import("convex/values").VString<string, "required">;
162
+ ownerDigest: import("convex/values").VString<string | undefined, "optional">;
163
+ identityFingerprint: import("convex/values").VString<string, "required">;
164
+ ambiguous: import("convex/values").VBoolean<boolean, "required">;
165
+ markerId: import("convex/values").VId<import("convex/values").GenericId<"financialTransferObservations"> | undefined, "optional">;
166
+ markerGeneration: import("convex/values").VFloat64<number | undefined, "optional">;
167
+ markerIdentityFingerprint: import("convex/values").VString<string | undefined, "optional">;
168
+ ownershipFingerprint: import("convex/values").VString<string | undefined, "optional">;
169
+ registrationId: import("convex/values").VId<import("convex/values").GenericId<"financialOwnership"> | undefined, "optional">;
170
+ }, "required", "ambiguous" | "bucketDigest" | "identityFingerprint" | "markerGeneration" | "markerId" | "markerIdentityFingerprint" | "ownerDigest" | "ownershipFingerprint" | "registrationId" | "transferId">, import("convex/values").VNull<null, "required">], "required", "ambiguous" | "bucketDigest" | "identityFingerprint" | "markerGeneration" | "markerId" | "markerIdentityFingerprint" | "ownerDigest" | "ownershipFingerprint" | "registrationId" | "transferId">, "required">;
171
+ }, "required", "chunkIndex" | "observationId" | "refs">, {
172
+ by_observation_chunk: ["observationId", "chunkIndex", "_creationTime"];
173
+ }, {}, {}>;
174
+ reversalObservationSlices: import("convex/server").TableDefinition<import("convex/values").VObject<{
175
+ bucketDigest?: string | undefined;
176
+ bucketKey?: string | undefined;
177
+ generation: number;
178
+ identityStatus: "contradictory" | "matched" | "unknown";
179
+ observationId: import("convex/values").GenericId<"reversalObservations">;
180
+ orgId?: string | undefined;
181
+ originalOperationId: import("convex/values").GenericId<"transferReversalOps">;
182
+ ownerDigest?: string | undefined;
183
+ ownershipStatus: "ambiguous" | "contradictory" | "registered" | "unknown";
184
+ registrationId?: import("convex/values").GenericId<"financialOwnership"> | undefined;
185
+ sliceIndex: number;
186
+ transferGeneration: number | null;
187
+ transferId?: import("convex/values").GenericId<"transfers"> | undefined;
188
+ userId?: string | undefined;
189
+ }, {
190
+ originalOperationId: import("convex/values").VId<import("convex/values").GenericId<"transferReversalOps">, "required">;
191
+ observationId: import("convex/values").VId<import("convex/values").GenericId<"reversalObservations">, "required">;
192
+ sliceIndex: import("convex/values").VFloat64<number, "required">;
193
+ generation: import("convex/values").VFloat64<number, "required">;
194
+ bucketDigest: import("convex/values").VString<string | undefined, "optional">;
195
+ ownerDigest: import("convex/values").VString<string | undefined, "optional">;
196
+ transferId: import("convex/values").VId<import("convex/values").GenericId<"transfers"> | undefined, "optional">;
197
+ bucketKey: import("convex/values").VString<string | undefined, "optional">;
198
+ registrationId: import("convex/values").VId<import("convex/values").GenericId<"financialOwnership"> | undefined, "optional">;
199
+ userId: import("convex/values").VString<string | undefined, "optional">;
200
+ orgId: import("convex/values").VString<string | undefined, "optional">;
201
+ ownershipStatus: import("convex/values").VUnion<"ambiguous" | "contradictory" | "registered" | "unknown", [import("convex/values").VLiteral<"registered", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"ambiguous", "required">, import("convex/values").VLiteral<"contradictory", "required">], "required", never>;
202
+ identityStatus: import("convex/values").VUnion<"contradictory" | "matched" | "unknown", [import("convex/values").VLiteral<"matched", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"contradictory", "required">], "required", never>;
203
+ transferGeneration: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
204
+ }, "required", "bucketDigest" | "bucketKey" | "generation" | "identityStatus" | "observationId" | "orgId" | "originalOperationId" | "ownerDigest" | "ownershipStatus" | "registrationId" | "sliceIndex" | "transferGeneration" | "transferId" | "userId">, {
205
+ by_bucket: ["bucketDigest", "_creationTime"];
206
+ by_observation_slice: ["observationId", "sliceIndex", "_creationTime"];
207
+ by_owner: ["ownerDigest", "_creationTime"];
208
+ }, {}, {}>;
209
+ payoutRevisionJournal: import("convex/server").TableDefinition<import("convex/values").VObject<{
210
+ accountId: string;
211
+ fenceStream: boolean;
212
+ financialPresent: boolean;
213
+ financialRiskRevision: number;
214
+ kind: "baseline" | "bump";
215
+ legacyFinancialId?: import("convex/values").GenericId<"payoutFinancialRevisions"> | undefined;
216
+ legacyRiskId?: import("convex/values").GenericId<"payoutRiskRevisions"> | undefined;
217
+ revision: number;
218
+ riskRevision: number;
219
+ }, {
220
+ accountId: import("convex/values").VString<string, "required">;
221
+ revision: import("convex/values").VFloat64<number, "required">;
222
+ riskRevision: import("convex/values").VFloat64<number, "required">;
223
+ financialRiskRevision: import("convex/values").VFloat64<number, "required">;
224
+ financialPresent: import("convex/values").VBoolean<boolean, "required">;
225
+ fenceStream: import("convex/values").VBoolean<boolean, "required">;
226
+ kind: import("convex/values").VUnion<"baseline" | "bump", [import("convex/values").VLiteral<"baseline", "required">, import("convex/values").VLiteral<"bump", "required">], "required", never>;
227
+ legacyFinancialId: import("convex/values").VId<import("convex/values").GenericId<"payoutFinancialRevisions"> | undefined, "optional">;
228
+ legacyRiskId: import("convex/values").VId<import("convex/values").GenericId<"payoutRiskRevisions"> | undefined, "optional">;
229
+ }, "required", "accountId" | "fenceStream" | "financialPresent" | "financialRiskRevision" | "kind" | "legacyFinancialId" | "legacyRiskId" | "revision" | "riskRevision">, {
230
+ by_account_fence_revision: ["accountId", "fenceStream", "revision", "_creationTime"];
231
+ by_account_revision: ["accountId", "revision", "_creationTime"];
232
+ }, {}, {}>;
233
+ payoutRevisionMigrations: import("convex/server").TableDefinition<import("convex/values").VObject<{
234
+ activated: number;
235
+ cursor: string | null;
236
+ held: number;
237
+ operationKey: string;
238
+ phase: number;
239
+ scanned: number;
240
+ status: "finished" | "running";
241
+ step: number;
242
+ unchanged: number;
243
+ visited: number;
244
+ }, {
245
+ operationKey: import("convex/values").VString<string, "required">;
246
+ phase: import("convex/values").VFloat64<number, "required">;
247
+ cursor: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
248
+ step: import("convex/values").VFloat64<number, "required">;
249
+ status: import("convex/values").VUnion<"finished" | "running", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"finished", "required">], "required", never>;
250
+ scanned: import("convex/values").VFloat64<number, "required">;
251
+ visited: import("convex/values").VFloat64<number, "required">;
252
+ activated: import("convex/values").VFloat64<number, "required">;
253
+ unchanged: import("convex/values").VFloat64<number, "required">;
254
+ held: import("convex/values").VFloat64<number, "required">;
255
+ }, "required", "activated" | "cursor" | "held" | "operationKey" | "phase" | "scanned" | "status" | "step" | "unchanged" | "visited">, {
256
+ by_operation: ["operationKey", "_creationTime"];
257
+ }, {}, {}>;
258
+ payoutRevisionMigrationResults: import("convex/server").TableDefinition<import("convex/values").VObject<{
259
+ accountDigest: string;
260
+ accountId?: string | undefined;
261
+ jobId: import("convex/values").GenericId<"payoutRevisionMigrations">;
262
+ reason?: "legacy_ambiguous" | "legacy_disagreement" | "legacy_invalid" | "representation_unavailable" | undefined;
263
+ sourceId: string;
264
+ sourceTable: string;
265
+ status: "activated" | "held" | "unchanged";
266
+ }, {
267
+ status: import("convex/values").VUnion<"activated" | "held" | "unchanged", [import("convex/values").VLiteral<"activated", "required">, import("convex/values").VLiteral<"unchanged", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
268
+ reason: import("convex/values").VUnion<"legacy_ambiguous" | "legacy_disagreement" | "legacy_invalid" | "representation_unavailable" | undefined, [import("convex/values").VLiteral<"legacy_ambiguous", "required">, import("convex/values").VLiteral<"legacy_invalid", "required">, import("convex/values").VLiteral<"legacy_disagreement", "required">, import("convex/values").VLiteral<"representation_unavailable", "required">], "optional", never>;
269
+ jobId: import("convex/values").VId<import("convex/values").GenericId<"payoutRevisionMigrations">, "required">;
270
+ accountId: import("convex/values").VString<string | undefined, "optional">;
271
+ accountDigest: import("convex/values").VString<string, "required">;
272
+ sourceId: import("convex/values").VString<string, "required">;
273
+ sourceTable: import("convex/values").VString<string, "required">;
274
+ }, "required", "accountDigest" | "accountId" | "jobId" | "reason" | "sourceId" | "sourceTable" | "status">, {
275
+ by_job_account: ["jobId", "accountDigest", "_creationTime"];
276
+ }, {}, {}>;
3
277
  usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
4
278
  key: string;
5
279
  operationKey: string;
@@ -2118,6 +2392,7 @@ export declare function setupCredits(): Promise<{
2118
2392
  }, "required", "bucketKey" | "fingerprint" | "generation" | "isContradictory" | "observedFingerprint" | "orgId" | "ownershipFingerprint" | "ownershipStatus" | "producer" | "producerVersion" | "registrationId" | "role" | "sourceChargeId" | "sourceInvoiceId" | "stripeTransferId" | "transferId" | "userId">, {
2119
2393
  by_bucket_key: ["bucketKey", "_creationTime"];
2120
2394
  by_owner: ["userId", "orgId", "_creationTime"];
2395
+ by_source_charge_id: ["sourceChargeId", "_creationTime"];
2121
2396
  by_transfer_id: ["transferId", "_creationTime"];
2122
2397
  }, {}, {}>;
2123
2398
  financialTransferBatches: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"accounting.fixtures.d.ts","sourceRoot":"","sources":["../../../src/component/usageCredits/accounting.fixtures.ts"],"names":[],"mappings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;;;;;;YAuDvB,KAAK;YAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU5B"}
package/docs/README.md CHANGED
@@ -34,7 +34,8 @@ guide for your integration.
34
34
  - [Refund context](refund-context.md) and [refund command evidence](refund-command-evidence.md).
35
35
  - [Processing cost reconciliation](processing-cost-reconciliation.md).
36
36
  - [Personal account mapping](personal-account-mapping.md).
37
- - [Financial ownership](financial-ownership.md) and [financial observations](financial-observations.md).
37
+ - [Financial ownership](financial-ownership.md) and [financial observations](financial-observations.md), including claimed reversal history.
38
+ - [Payout revision migration](payout-revision-migration.md), explicit bounded activation before large reversal operations.
38
39
  - [Example recovery cutover](example-recovery-cutover.md).
39
40
 
40
41
  ## Architecture and contributing
@@ -82,3 +83,5 @@ Start with the [native Stripe setup guide](metering-setup.md), then read the
82
83
  - [Native usage configuration UI](usage-configuration.md) covers reusable forms, managed meter selection, price rows and authorized adapters.
83
84
 
84
85
  - [Native metered billing example](usage-example.md), three runnable models, paid evidence and scoped cleanup.
86
+
87
+ - [Metered usage verification](usage-verification.md), three-model acceptance, packed consumers, native proof and failure limits.
@@ -584,3 +584,9 @@ This does not establish customer-only preview eligibility for another account.
584
584
  See the [sandbox setup findings](accounts-v2-preview.md#connect-sandbox-setup-findings-2026-10-15),
585
585
  [authentication and reuse results](react-workflows.md#live-authentication-and-reuse-results-2026-10-15),
586
586
  and [uploaded screenshots and provider records](https://github.com/FantasticDevHQ/better-stripe/pull/166#issuecomment-6185124292).
587
+
588
+ ## Reversal history and revision maintenance
589
+
590
+ `stripe.reversalObservations` reads original claimed-slice history and maintains a bounded diagnostic index. Its physical operation references survive release/deletion and distinguish reuse of a business operation ID. Exact bucket/owner pages, original/latest payloads and generation-aware continuation remain unknown coverage. These methods do not execute reversals, certify current ownership or authorize closure. See [financial observations](financial-observations.md#claimed-reversal-history).
591
+
592
+ `stripe.payoutRevisionMigration` exposes trusted-host `activateAccount`, `begin`, `resume`, `get` and `results`. Existing destinations keep legacy revision authority until explicitly activated. Activation and inventory are bounded storage maintenance, with held outcomes for ambiguous or unrepresentable legacy authority. Installing the package does not run a migration. See the [migration guide](payout-revision-migration.md) before relying on the tested large-operation path or changing component versions.
@@ -102,9 +102,12 @@ Native checks preserve the previously supported 1,000-transfer claim across four
102
102
  shared destination buckets, with registered personal/organization and unknown
103
103
  ownership, and the 100-transfer synchronous boundary. Historical public claims
104
104
  with 1,001 transfers can still be released without per-row observation work.
105
- The accepted baseline separately exceeds native read limits for a claim with
106
- 1,000 distinct destinations because of existing earnings-summary work; this
107
- observation contract does not fix or claim support for that shape.
105
+ The published 0.50.1 baseline separately exceeds native read limits for a claim
106
+ with 1,000 distinct destinations. The explicitly activated payout revision
107
+ journal now preserves that shape in the tested native fixture. See the
108
+ [payout revision migration](./payout-revision-migration.md) for its operational
109
+ precondition and aggregate-limit caveats. Transfer observations alone do not
110
+ provide that capacity.
108
111
 
109
112
  Observations rely on package-owned append/patch writers and their transactional
110
113
  generation changes. They do not certify arbitrary privileged database edits,
@@ -237,8 +240,48 @@ a final patch; zero-count deletion and malformed-summary errors remain required.
237
240
  Moved buckets, unrecorded transfers, payout summaries and financial/risk callbacks
238
241
  retain their existing behavior.
239
242
 
240
- This is a private derived-summary optimization. Accepted and earnings-only
241
- candidates still exceed the native read limit for 1,000 distinct destinations.
242
- It does not lower the admitted financial maximum, establish complete observation
243
- coverage or prove aggregate financial-hook capacity. Distinct-destination source
244
- read reuse and complete capacity verification remain separate work.
243
+ This private derived-summary optimization alone does not resolve the
244
+ 1,000-distinct-destination read limit. The separately activated
245
+ [payout revision journal](./payout-revision-migration.md) supplies the tested
246
+ large-operation path. Neither optimization grants complete observation coverage
247
+ or changes financial admission or money calculations.
248
+
249
+ ## Claimed reversal slice history
250
+
251
+ `stripe.reversalObservations` reports the lifecycle of actual component reversal claims. Claim, exposure replay, frontier updates, release and deletion capture diagnostic history in the same transaction as the existing financial writer, including direct calls to the registered handler. The writer keeps its existing slice arithmetic, financial selectors, rollback and provider behavior.
252
+
253
+ History is keyed by the **original operation document ID**, not its reusable business `operationId`. A released operation retains a tombstone. Reusing the business ID creates a separate history entry. Exact original and latest operation bodies live in separate payload records, with full and identity fingerprints checked before returning or indexing their contents. The original body, transfer references and owner evidence are immutable across exposure updates and deletion.
254
+
255
+ ```ts
256
+ const history = await stripe.reversalObservations.history(ctx, {
257
+ selector: "sourceChargeId", // or "operationId" for the business identifier
258
+ value: chargeId,
259
+ paginationOpts: { numItems: 25, cursor: null },
260
+ });
261
+ const originalOperationId = history.page[0].originalOperationId;
262
+ let observed = await stripe.reversalObservations.operation(ctx, {
263
+ operationId: originalOperationId,
264
+ });
265
+ // Schedule separate bounded host mutations until complete or held.
266
+ observed = await stripe.reversalObservations.resume(ctx, {
267
+ operationId: originalOperationId,
268
+ expectedGeneration: observed.observation!.generation,
269
+ batchSize: 10, // 1–20 original positions per transaction
270
+ });
271
+ const slices = await stripe.reversalObservations.slices(ctx, {
272
+ operationId: originalOperationId,
273
+ paginationOpts: { numItems: 25, cursor: null },
274
+ });
275
+ ```
276
+
277
+ `bucket` discovers original destination references using an exact bucket selector. `owner` accepts `userId` and optional `orgId` for historical owner evidence. Both use bounded component-compatible pagination. Each slice includes `originalOperationId`, so a hit can be opened with `operation` and `payload`. `payload` accepts `version: "original" | "latest"`.
278
+
279
+ All original slice positions are retained, including empty operations without invented recipients. Compact, chunked references retain original transfer document IDs and identity digests. Destination digests keep the original bucket discoverable if its transfer later disappears. A single byte-bounded marker page may capture existing owner evidence atomically. Missing, omitted, contradictory or ambiguous original pins remain unknown. A later registration never retroactively fills an originally unpinned owner.
280
+
281
+ Continuation checks the exact original transfer, global transfer and marker correspondence, captured owner evidence and immutable registration. Missing or changed sources remain `unknown` or `contradictory`; they do not get reassigned to replacements. Legacy operations first observed on replay or release have no invented claim-time provenance and stay held. No public backfill declares historical coverage complete.
282
+
283
+ Bucket and owner discovery use digests and fixed source/registration references. Literal bucket, user and organization labels are included only when each fits within 256 UTF-8 bytes, avoiding oversized diagnostic documents. A digest is a lookup aid, never proof of authorization. Resolve original references through the trusted host and treat missing sources conservatively.
284
+
285
+ The bounded indexer writes each exact slice slot, then validates its prefix in a second traversal. Each original reference chunk is checked against its immutable header digest before use, including when the original transfer is missing. `expectedGeneration` fences the source lifecycle version; it is not a per-step acknowledgement. Repeating a successful `resume` call may advance another bounded batch of diagnostic work. No money operation is performed or duplicated. Read headroom may reduce the actual batch size; invoke steps in fresh dedicated host transactions rather than an unbounded loop inside one transaction. Exposure changes and deletion advance the operation generation and restart enrichment over the same immutable references. A slice's `generation` is the operation generation when it was indexed. Fetch its owning operation to compare the current generation and indexing status; intermediate pages may contain older-generation slots. Global diagnostic `generation` and `transferGeneration` also expose later transfer facts without pretending a cached slice is the latest receipt. `complete` describes this historical index traversal, not current ownership, current liabilities, financial closure or producer coverage.
286
+
287
+ Every result remains `coverage: "unknown"`, including completed and exhausted pages. These methods are trusted-host diagnostics. They grant no provider permission, payout eligibility, reversal admission or attempt fencing, and do not replace receipt reconciliation. No Stripe API request is made by the readers or indexer.
@@ -0,0 +1,54 @@
1
+ # Payout revision journal migration
2
+
3
+ BetterStripe can move an account's internal financial and risk revision counters to an append-only journal. This is a storage migration, not a payment, transfer, payout, reconciliation result, or financial coverage certificate. It makes the latest account revision a single indexed read while retaining a separate risk-only read range. Ordinary positive funding does not change that risk range.
4
+
5
+ Existing accounts keep using the legacy counters until explicitly activated. Financial writes do not silently migrate an account. Activate every destination before an operation that relies on the journal's lower read cost, including new destinations added after an inventory pass. Native read and byte limits still apply. A completed migration does not independently guarantee that an operation fits those limits.
6
+
7
+ ## Trusted host API
8
+
9
+ Authorize these methods in your server application. Do not expose unrestricted migration endpoints to customers. No Stripe API key or provider request is needed.
10
+
11
+ ```ts
12
+ // Smallest primitive, useful when provisioning a new destination.
13
+ const result = await betterStripe.payoutRevisionMigration.activateAccount(ctx, {
14
+ accountId: destinationAccountId,
15
+ });
16
+ // result.status is activated, unchanged, or held.
17
+
18
+ // A server-owned inventory pass over the existing component data.
19
+ let job = await betterStripe.payoutRevisionMigration.begin(ctx, {
20
+ operationKey: "revision-layout-rollout-1",
21
+ });
22
+ // Schedule each step as a separate durable host mutation.
23
+ // Do not execute an unbounded loop inside one Convex transaction.
24
+ job = await betterStripe.payoutRevisionMigration.resume(ctx, {
25
+ jobId: job._id,
26
+ expectedStep: job.step,
27
+ });
28
+ ```
29
+
30
+ Each resume reads at most one inventory row and activates at most one account in the same transaction. The component owns the cursor and inventory phase. A repeated stale step returns the current job without processing another row; a future or invalid step fails. Repeating `begin` with the same operation key returns the existing pass. Use a new key for a new pass.
31
+
32
+ The inventory covers both legacy revision tables and accounts in transfers, payouts, recovery balances, payout source allocations, payout release claims, and payout fee balances. Per-pass account digests prevent duplicate counts. Result rows retain the source table and original document ID. They include the account key only when it fits within 256 UTF-8 bytes; larger keys remain in their original source record rather than being duplicated into a potentially oversized diagnostic row. `get` reads the job; `results` pages account outcomes with normal Convex pagination options, bounded to 100 rows and a private byte budget.
33
+
34
+ A finished pass only means its server-owned cursors exhausted the inventory they saw. Records can be added during or after a pass. Re-run inventory and explicitly activate new destinations as part of provisioning. A finished pass and an exhausted results page grant no payout eligibility, closure, attempt admission, or complete financial history.
35
+
36
+ ## Held accounts and compatibility
37
+
38
+ Activation preserves the exact legacy row IDs, timestamps, counters, and source records. It inserts a baseline without incrementing counters or creating risk events. Financial-only, risk-only, absent, signed, and safe maximum counters retain their existing reader semantics. Existing financial callbacks append actual bumps and continue to write the same risk events. The old counters become frozen historical evidence for activated accounts.
39
+
40
+ Duplicate legacy authorities, disagreeing counters, unsafe numeric values, and representations that cannot safely fit a baseline return `held`. Such accounts remain on the existing path. The migration does not repair, normalize, merge, or discard those records. Malformed canonical journal authority aborts the step atomically instead of returning `held`. Inspect outcomes and arrange a separate reviewed repair; do not count held accounts as activated. Re-run a new pass after a repair.
41
+
42
+ An old SDK calling a newly deployed component is different from deploying old component writer code. After activation, the legacy counters are no longer current. **Do not roll component code back to legacy-only writers without a separately reviewed restore migration.** Deploying old writers directly would resume from stale counters.
43
+
44
+ ## Verification boundary
45
+
46
+ The journal's large-operation capacity must be verified on a native Convex backend with the actual callbacks enabled. JavaScript database mocks do not prove native read limits or OCC behavior. Same-database claim, replay, release, rollback, risk-range isolation, and concurrent activation/source writes are required before claiming the capacity issue fixed. No application deployment is migrated by installing the package.
47
+
48
+ ## Native regression results
49
+
50
+ The isolated native regression retained the same SQLite database and 1,000 original transfers across published 0.50.1 and the candidate. The published claim failed the 4,096-read limit with full rollback. After explicit activation of all destinations, claim, matching replay and release succeeded with every original slice and per-currency earnings preserved. Original row IDs, frozen legacy counters and transfer observations remained intact. Claim wrote exactly 1,000 risk events; releasing unused claims advanced financial counters again while preserving risk revision 1.
51
+
52
+ Release used 4,077 of 4,096 reads in that fixture. This narrow margin is evidence for the tested shape, not a promise that arbitrary near-limit documents or extra host work fit. Run large financial operations in dedicated transactions. Do not increase limits, skip callbacks, truncate recipients or count held destinations as activated. The admitted claim limit remains 1,000 transfers. A historical imported operation with 1,001 positive slices also released successfully; its missing original diagnostic provenance remained held and unknown.
53
+
54
+ Native controls also verified 250/500/750 distinct destinations, 1,000 legs sharing four destinations, a complete 8,711-step inventory pass with stale-step replay and paginated outcomes, and actual OCC retries. Ordinary positive funding left the risk-only read range stable. A real risk change retried the reader; activation racing a source write retried against the changed legacy counter. These are local backend checks with synthetic data and zero Stripe requests. They do not replace application authorization, deployment-specific capacity testing or independent release acceptance.
@@ -97,11 +97,82 @@ defaults all use the public `AffiliatePayoutEditor`. It owns percentage/fixed
97
97
  amount validation, commission-term selection, clear/inherit behavior, edit
98
98
  versions, pending state, and errors. `PlanPricingEditor` owns the monthly-price
99
99
  and sale-fee form. The example binds both to Convex functions and supplies shadcn
100
- markup. Rule resolution, Stripe metadata, first-invoice claims, fee accounting,
101
- and transfer execution remain backend application policy.
100
+ markup. The host resolves inherited rules, chooses referral attribution and
101
+ commission terms, and supplies the resulting policy to the package. BetterStripe
102
+ owns financial allocation, transfer execution, replay safety and recovery. These
103
+ server responsibilities are detailed in the boundary audit below.
102
104
 
103
105
  Browser regression checks cover equal cards/layouts in API and package views,
104
106
  referral-sales pagination, inline payout controls, and plan pricing. Sandbox QA
105
107
  covers all five checkout integrations, declined-card retries, inherited and fixed
106
108
  commissions, and Forever/One-time subscription renewals using Stripe test clocks.
107
109
  Existing subscriptions keep their monthly price and saved commission term.
110
+
111
+ ## Package and example boundary
112
+
113
+ This source audit covers checkout, catalog, buyer billing, accounts/onboarding,
114
+ seller and affiliate reporting, payouts, refunds, disputes, recovery, and setup.
115
+ It checks ownership of the implementation; the historical sandbox checks above
116
+ are separate evidence, not a claim that every live flow ran again for this audit.
117
+
118
+ | Concern | Package implementation | Example wiring that remains |
119
+ | ----------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
120
+ | Checkout | `CheckoutChooser`, session/PaymentIntent workflows, email validation and payment confirmation | `components/checkout-types.tsx`, session/payment-intent adapters, route selection, buyer/store lookup and referral metadata |
121
+ | Catalog and billing | Product/price controllers, subscription commands, invoice readers, portal creation | Authorized Convex bindings, allowed products, tier names, plan selection and proration policy |
122
+ | Accounts and onboarding | Account configuration, requirements, onboarding workflows and Connect embeds | Persona/store selection, account ownership and navigation |
123
+ | Reporting and payouts | Earnings derivation, currency formatting, payout classification, pagination and payout workers | Store/user joins, collection bindings, cron installation and styled rows/cards |
124
+ | Refunds and disputes | Refund commands and observations, evidence controllers, clawback/recovery records and execution | Original-owner authorization, source routing, selected liability policy and case links |
125
+ | Durable financial work | `balanceFundingWorkflow`, `costRecoveryWorkflow`, provider execution, stable operation identities and reconciliation | Credential-bearing provider action adapters, consent records, host request status and explicit scheduling policy |
126
+ | Setup and testing | Reusable task/action state and setup UI | Sandbox-only accounts, prices, cards, test clocks, reset/seed orchestration and fixture assertions |
127
+
128
+ ### Concrete adapters
129
+
130
+ - `example/src/components/checkout-form-fields.tsx` renders the package's
131
+ `CheckoutFormState`. It forwards `submit`, input values, pending state and errors.
132
+ It must not confirm a payment or duplicate email validation.
133
+ - `example/src/lib/stripe-hooks.ts` binds package hook factories and pagination to Convex
134
+ function references. `current-subscription.ts` and `store-earnings.ts` re-export
135
+ package selectors.
136
+ - `example/src/lib/format-amount.ts` re-exports the package's `formatPrice` as a local name.
137
+ Buyer billing, checkout previews and product pickers also use `formatPrice`.
138
+ Seller payout history uses `formatPayoutAmount`, including its explicit fallback
139
+ for unsupported display precision. Currency conversion
140
+ must not assume `amount / 100`; JPY has different units, and observed ISK/UGX
141
+ fractional balances need the package's display rules. Charge eligibility and
142
+ bank-payout eligibility still use their respective package validators.
143
+ - `example/convex/storefront/checkout.ts` selects the authorized buyer, seller, eligible
144
+ product and referral policy before calling `stripe.createCheckoutSession`.
145
+ The demo's `avery` code and store-plan metadata are application policy.
146
+ - `example/convex/settlement/workflow/actions.ts` and
147
+ `example/convex/sellerCosts/recoveryInvoices/workflow/actions.ts` authorize the original
148
+ host job and pass credentials to `stripe.costRecovery.executeGroupProvider`.
149
+ Provider write/reconciliation behavior stays in the package.
150
+ - `example/convex/storeBalance/workflow/internal/actions.ts` joins the seller's consent and
151
+ request to package preparation/apply operations. Its bounded observation cadence
152
+ and host status projection remain local. It uses `financialRetryDecision` and
153
+ does not reinterpret an unknown provider write as success.
154
+ - `example/convex/sellerCosts/invoiceRecoverySource.ts` and `unsettledCostSource.ts` read
155
+ provider objects to find the demo's original recovery group or store sale. Their
156
+ `example:store:*` and `sale_v1` bindings are application-specific. Package
157
+ reconciliation still verifies funding and allocations before moving money.
158
+
159
+ ### Rules for changes
160
+
161
+ Add a reusable Stripe protocol, monetary validator, workflow controller, pagination
162
+ controller or unstyled renderer under `src/client`, `src/component` or `src/react`.
163
+ Expose it through the appropriate public entry point and test it without example
164
+ personas, routes or schema. Use it from the example through a small binding or
165
+ render-prop adapter. Different integration tabs may have different markup, but
166
+ should share package-owned validation, units and action state.
167
+
168
+ Keep authentication, ownership checks, business policy and application joins on
169
+ the host server. A component ID, account ID, role switch or metadata field never
170
+ authorizes a caller. The demo's identity model is not production authentication.
171
+ Do not move store/user tables or sandbox fixture orchestration into the package
172
+ just to reduce the example's line count.
173
+
174
+ Payment acceptance and fulfillment are separate responsibilities. BetterStripe
175
+ supplies verified payment records and hooks; the consuming application decides
176
+ whether payment unlocks a file, account access, a license or another benefit.
177
+ It must make those effects idempotent and choose its refund/access policy. The
178
+ example should not grow a download service, entitlement engine or shipping system.
@@ -132,6 +132,10 @@ policy, never seller or collaborator redemption.
132
132
 
133
133
  ## Scoped cleanup and reset
134
134
 
135
+ Cleanup re-reads the original paid invoice, payment and settlement before stopping
136
+ resources. Saved success alone cannot authorize a reset after a refund, dispute or
137
+ incomplete settlement recovery. Unavailable fresh evidence keeps the run retained.
138
+
135
139
  Use Archive or resume scoped cleanup after the original invoice and cash evidence
136
140
  are verified. It refuses unresolved delivery, corrections, reservations, purchases,
137
141
  credit backing or settlement. Unspent paid credits require verified refund or