@fantastic.dev/better-stripe 0.109.0 → 0.110.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 (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/observation/freshActor.d.ts +41 -0
  4. package/dist/client/billing/renewalAttach/internal/observation/freshActor.d.ts.map +1 -1
  5. package/dist/client/billing/renewalAttach/internal/observation/freshActor.js +40 -3
  6. package/dist/client/billing/renewalAttach/internal/observation/freshActor.js.map +1 -1
  7. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.d.ts +10 -1
  8. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.d.ts.map +1 -1
  9. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.js +162 -57
  10. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.js.map +1 -1
  11. package/dist/client/billing/renewalAttach/internal/observation/invoiceAuthorization.d.ts +14 -0
  12. package/dist/client/billing/renewalAttach/internal/observation/invoiceAuthorization.d.ts.map +1 -0
  13. package/dist/client/billing/renewalAttach/internal/observation/invoiceAuthorization.js +109 -0
  14. package/dist/client/billing/renewalAttach/internal/observation/invoiceAuthorization.js.map +1 -0
  15. package/dist/client/billing/renewalAttach/internal/observation/invoicePlan.d.ts +20 -0
  16. package/dist/client/billing/renewalAttach/internal/observation/invoicePlan.d.ts.map +1 -0
  17. package/dist/client/billing/renewalAttach/internal/observation/invoicePlan.js +176 -0
  18. package/dist/client/billing/renewalAttach/internal/observation/invoicePlan.js.map +1 -0
  19. package/dist/client/billing/renewalAttach/internal/observation/profile.js.map +1 -1
  20. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts +1 -1
  21. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts.map +1 -1
  22. package/dist/client/billing/renewalAttach/internal/observation/types.js.map +1 -1
  23. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts +24 -0
  24. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts.map +1 -1
  25. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js +1 -0
  26. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js.map +1 -1
  27. package/dist/client/billing/renewalObservation/evidence-invoice.d.ts.map +1 -1
  28. package/dist/client/billing/renewalObservation/evidence-invoice.js +4 -0
  29. package/dist/client/billing/renewalObservation/evidence-invoice.js.map +1 -1
  30. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +32 -32
  31. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
  32. package/dist/component/balanceFunding/mutations.d.ts +43 -43
  33. package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
  34. package/dist/component/balanceFunding/queries.d.ts +1 -1
  35. package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
  36. package/docs/renewal-invoice-reads.md +85 -0
  37. package/docs/renewal-material-observation.md +4 -1
  38. package/package.json +1 -1
  39. package/src/client/billing/renewalAttach/internal/observation/freshActor.ts +69 -3
  40. package/src/client/billing/renewalAttach/internal/observation/freshTransport.ts +189 -59
  41. package/src/client/billing/renewalAttach/internal/observation/invoiceActor.integration.test.ts +142 -0
  42. package/src/client/billing/renewalAttach/internal/observation/invoiceActorControls.integration.test.ts +495 -0
  43. package/src/client/billing/renewalAttach/internal/observation/invoiceAuthorization.ts +145 -0
  44. package/src/client/billing/renewalAttach/internal/observation/invoicePlan.ts +284 -0
  45. package/src/client/billing/renewalAttach/internal/observation/profile.ts +1 -1
  46. package/src/client/billing/renewalAttach/internal/observation/types.ts +7 -1
  47. package/src/client/billing/renewalAttach/internal/operations/sourceOperations.ts +30 -0
  48. package/src/client/billing/renewalAttach/internal/producer/producerConfigureWriteControls.integration.test.ts +74 -62
  49. package/src/client/billing/renewalAttach/internal/test-fixtures/invoiceObservation.ts +158 -0
  50. package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +11 -1
  51. package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +4 -0
  52. package/src/client/billing/renewalObservation/evidence-invoice-identity.test.ts +61 -0
  53. package/src/client/billing/renewalObservation/evidence-invoice.ts +9 -0
@@ -2641,14 +2641,6 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
2641
2641
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2642
2642
  requestKey: string;
2643
2643
  result?: {
2644
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2645
- retryable: false;
2646
- status: "conflict";
2647
- } | {
2648
- reason: "policy_invalid";
2649
- retryable: false;
2650
- status: "rejected";
2651
- } | {
2652
2644
  operation: {
2653
2645
  accountId: string;
2654
2646
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2659,6 +2651,14 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
2659
2651
  } | {
2660
2652
  enabled: boolean;
2661
2653
  status: "unchanged";
2654
+ } | {
2655
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2656
+ retryable: false;
2657
+ status: "conflict";
2658
+ } | {
2659
+ reason: "policy_invalid";
2660
+ retryable: false;
2661
+ status: "rejected";
2662
2662
  } | {
2663
2663
  reason: "provider_pending";
2664
2664
  retryable: true;
@@ -2669,14 +2669,6 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
2669
2669
  payload: import("convex/values").VString<string, "required">;
2670
2670
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
2671
2671
  result: import("convex/values").VUnion<{
2672
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2673
- retryable: false;
2674
- status: "conflict";
2675
- } | {
2676
- reason: "policy_invalid";
2677
- retryable: false;
2678
- status: "rejected";
2679
- } | {
2680
2672
  operation: {
2681
2673
  accountId: string;
2682
2674
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2687,6 +2679,14 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
2687
2679
  } | {
2688
2680
  enabled: boolean;
2689
2681
  status: "unchanged";
2682
+ } | {
2683
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2684
+ retryable: false;
2685
+ status: "conflict";
2686
+ } | {
2687
+ reason: "policy_invalid";
2688
+ retryable: false;
2689
+ status: "rejected";
2690
2690
  } | {
2691
2691
  reason: "provider_pending";
2692
2692
  retryable: true;
@@ -7777,14 +7777,6 @@ export declare function historical(currency?: string): Promise<{
7777
7777
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
7778
7778
  requestKey: string;
7779
7779
  result?: {
7780
- reason: "identity_changed" | "revision_changed" | "scope_busy";
7781
- retryable: false;
7782
- status: "conflict";
7783
- } | {
7784
- reason: "policy_invalid";
7785
- retryable: false;
7786
- status: "rejected";
7787
- } | {
7788
7780
  operation: {
7789
7781
  accountId: string;
7790
7782
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -7795,6 +7787,14 @@ export declare function historical(currency?: string): Promise<{
7795
7787
  } | {
7796
7788
  enabled: boolean;
7797
7789
  status: "unchanged";
7790
+ } | {
7791
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
7792
+ retryable: false;
7793
+ status: "conflict";
7794
+ } | {
7795
+ reason: "policy_invalid";
7796
+ retryable: false;
7797
+ status: "rejected";
7798
7798
  } | {
7799
7799
  reason: "provider_pending";
7800
7800
  retryable: true;
@@ -7805,14 +7805,6 @@ export declare function historical(currency?: string): Promise<{
7805
7805
  payload: import("convex/values").VString<string, "required">;
7806
7806
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
7807
7807
  result: import("convex/values").VUnion<{
7808
- reason: "identity_changed" | "revision_changed" | "scope_busy";
7809
- retryable: false;
7810
- status: "conflict";
7811
- } | {
7812
- reason: "policy_invalid";
7813
- retryable: false;
7814
- status: "rejected";
7815
- } | {
7816
7808
  operation: {
7817
7809
  accountId: string;
7818
7810
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -7823,6 +7815,14 @@ export declare function historical(currency?: string): Promise<{
7823
7815
  } | {
7824
7816
  enabled: boolean;
7825
7817
  status: "unchanged";
7818
+ } | {
7819
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
7820
+ retryable: false;
7821
+ status: "conflict";
7822
+ } | {
7823
+ reason: "policy_invalid";
7824
+ retryable: false;
7825
+ status: "rejected";
7826
7826
  } | {
7827
7827
  reason: "provider_pending";
7828
7828
  retryable: true;
@@ -2632,6 +2632,14 @@ export declare function large(count?: number, amount?: number): Promise<{
2632
2632
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2633
2633
  requestKey: string;
2634
2634
  result?: {
2635
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2636
+ retryable: false;
2637
+ status: "conflict";
2638
+ } | {
2639
+ reason: "policy_invalid";
2640
+ retryable: false;
2641
+ status: "rejected";
2642
+ } | {
2635
2643
  operation: {
2636
2644
  accountId: string;
2637
2645
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2642,14 +2650,6 @@ export declare function large(count?: number, amount?: number): Promise<{
2642
2650
  } | {
2643
2651
  enabled: boolean;
2644
2652
  status: "unchanged";
2645
- } | {
2646
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2647
- retryable: false;
2648
- status: "conflict";
2649
- } | {
2650
- reason: "policy_invalid";
2651
- retryable: false;
2652
- status: "rejected";
2653
2653
  } | {
2654
2654
  reason: "provider_pending";
2655
2655
  retryable: true;
@@ -2660,6 +2660,14 @@ export declare function large(count?: number, amount?: number): Promise<{
2660
2660
  payload: import("convex/values").VString<string, "required">;
2661
2661
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
2662
2662
  result: import("convex/values").VUnion<{
2663
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2664
+ retryable: false;
2665
+ status: "conflict";
2666
+ } | {
2667
+ reason: "policy_invalid";
2668
+ retryable: false;
2669
+ status: "rejected";
2670
+ } | {
2663
2671
  operation: {
2664
2672
  accountId: string;
2665
2673
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2670,14 +2678,6 @@ export declare function large(count?: number, amount?: number): Promise<{
2670
2678
  } | {
2671
2679
  enabled: boolean;
2672
2680
  status: "unchanged";
2673
- } | {
2674
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2675
- retryable: false;
2676
- status: "conflict";
2677
- } | {
2678
- reason: "policy_invalid";
2679
- retryable: false;
2680
- status: "rejected";
2681
2681
  } | {
2682
2682
  reason: "provider_pending";
2683
2683
  retryable: true;
@@ -7769,6 +7769,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7769
7769
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
7770
7770
  requestKey: string;
7771
7771
  result?: {
7772
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
7773
+ retryable: false;
7774
+ status: "conflict";
7775
+ } | {
7776
+ reason: "policy_invalid";
7777
+ retryable: false;
7778
+ status: "rejected";
7779
+ } | {
7772
7780
  operation: {
7773
7781
  accountId: string;
7774
7782
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -7779,14 +7787,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7779
7787
  } | {
7780
7788
  enabled: boolean;
7781
7789
  status: "unchanged";
7782
- } | {
7783
- reason: "identity_changed" | "revision_changed" | "scope_busy";
7784
- retryable: false;
7785
- status: "conflict";
7786
- } | {
7787
- reason: "policy_invalid";
7788
- retryable: false;
7789
- status: "rejected";
7790
7790
  } | {
7791
7791
  reason: "provider_pending";
7792
7792
  retryable: true;
@@ -7797,6 +7797,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7797
7797
  payload: import("convex/values").VString<string, "required">;
7798
7798
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
7799
7799
  result: import("convex/values").VUnion<{
7800
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
7801
+ retryable: false;
7802
+ status: "conflict";
7803
+ } | {
7804
+ reason: "policy_invalid";
7805
+ retryable: false;
7806
+ status: "rejected";
7807
+ } | {
7800
7808
  operation: {
7801
7809
  accountId: string;
7802
7810
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -7807,14 +7815,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7807
7815
  } | {
7808
7816
  enabled: boolean;
7809
7817
  status: "unchanged";
7810
- } | {
7811
- reason: "identity_changed" | "revision_changed" | "scope_busy";
7812
- retryable: false;
7813
- status: "conflict";
7814
- } | {
7815
- reason: "policy_invalid";
7816
- retryable: false;
7817
- status: "rejected";
7818
7818
  } | {
7819
7819
  reason: "provider_pending";
7820
7820
  retryable: true;
@@ -22,6 +22,14 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
22
22
  requestKey: string;
23
23
  scopeKey: string;
24
24
  }, Promise<{
25
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
26
+ retryable: false;
27
+ status: "conflict";
28
+ } | {
29
+ reason: "policy_invalid";
30
+ retryable: false;
31
+ status: "rejected";
32
+ } | {
25
33
  operation: {
26
34
  accountId: string;
27
35
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -32,14 +40,6 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
32
40
  } | {
33
41
  enabled: boolean;
34
42
  status: "unchanged";
35
- } | {
36
- reason: "identity_changed" | "revision_changed" | "scope_busy";
37
- retryable: false;
38
- status: "conflict";
39
- } | {
40
- reason: "policy_invalid";
41
- retryable: false;
42
- status: "rejected";
43
43
  } | {
44
44
  reason: "provider_pending";
45
45
  retryable: true;
@@ -395,6 +395,14 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
395
395
  requestKey: string;
396
396
  scopeKey: string;
397
397
  }, Promise<{
398
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
399
+ retryable: false;
400
+ status: "conflict";
401
+ } | {
402
+ reason: "policy_invalid";
403
+ retryable: false;
404
+ status: "rejected";
405
+ } | {
398
406
  operation: {
399
407
  accountId: string;
400
408
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -405,14 +413,6 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
405
413
  } | {
406
414
  enabled: boolean;
407
415
  status: "unchanged";
408
- } | {
409
- reason: "identity_changed" | "revision_changed" | "scope_busy";
410
- retryable: false;
411
- status: "conflict";
412
- } | {
413
- reason: "policy_invalid";
414
- retryable: false;
415
- status: "rejected";
416
416
  } | {
417
417
  reason: "provider_pending";
418
418
  retryable: true;
@@ -595,6 +595,22 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
595
595
  } & {
596
596
  providerAction: string;
597
597
  }, Promise<{
598
+ reason: "history_incomplete" | "provider_outcome_unknown";
599
+ retryable: false;
600
+ status: "unknown";
601
+ } | {
602
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
603
+ retryable: false;
604
+ status: "conflict";
605
+ } | {
606
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
607
+ retryable: false;
608
+ status: "rejected";
609
+ } | {
610
+ reason: "provider_pending";
611
+ retryable: true;
612
+ status: "not_ready";
613
+ } | {
598
614
  operation: {
599
615
  accountId: string;
600
616
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -611,7 +627,16 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
611
627
  version: number;
612
628
  };
613
629
  status: "canceled";
614
- } | {
630
+ }>>;
631
+ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
+ accountId: string;
633
+ definitionVersion: string;
634
+ operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
+ providerApiVersion: string;
636
+ scopeKey: string;
637
+ stripeSubscriptionId: string;
638
+ version: number;
639
+ }, Promise<{
615
640
  reason: "history_incomplete" | "provider_outcome_unknown";
616
641
  retryable: false;
617
642
  status: "unknown";
@@ -627,16 +652,7 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
627
652
  reason: "provider_pending";
628
653
  retryable: true;
629
654
  status: "not_ready";
630
- }>>;
631
- export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
- accountId: string;
633
- definitionVersion: string;
634
- operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
- providerApiVersion: string;
636
- scopeKey: string;
637
- stripeSubscriptionId: string;
638
- version: number;
639
- }, Promise<{
655
+ } | {
640
656
  operation: {
641
657
  accountId: string;
642
658
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -653,22 +669,6 @@ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<
653
669
  version: number;
654
670
  };
655
671
  status: "canceled";
656
- } | {
657
- reason: "history_incomplete" | "provider_outcome_unknown";
658
- retryable: false;
659
- status: "unknown";
660
- } | {
661
- reason: "identity_changed" | "revision_changed" | "scope_busy";
662
- retryable: false;
663
- status: "conflict";
664
- } | {
665
- reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
666
- retryable: false;
667
- status: "rejected";
668
- } | {
669
- reason: "provider_pending";
670
- retryable: true;
671
- status: "not_ready";
672
672
  }>>;
673
673
  export declare const cancelWorkflow: import("convex/server").RegisteredMutation<"public", {
674
674
  accountId: string;
@@ -2,14 +2,6 @@ import type { Infer } from "convex/values";
2
2
  import type { MutationCtx } from "../_generated/server.js";
3
3
  import { prepareArgs, finishPreparationArgs } from "./mutationValidators.js";
4
4
  export declare function prepareHandler(ctx: MutationCtx, args: Infer<typeof prepareArgs>): Promise<{
5
- reason: "identity_changed" | "revision_changed" | "scope_busy";
6
- retryable: false;
7
- status: "conflict";
8
- } | {
9
- reason: "policy_invalid";
10
- retryable: false;
11
- status: "rejected";
12
- } | {
13
5
  operation: {
14
6
  accountId: string;
15
7
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -20,6 +12,14 @@ export declare function prepareHandler(ctx: MutationCtx, args: Infer<typeof prep
20
12
  } | {
21
13
  enabled: boolean;
22
14
  status: "unchanged";
15
+ } | {
16
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
17
+ retryable: false;
18
+ status: "conflict";
19
+ } | {
20
+ reason: "policy_invalid";
21
+ retryable: false;
22
+ status: "rejected";
23
23
  } | {
24
24
  reason: "provider_pending";
25
25
  retryable: true;
@@ -180,11 +180,11 @@ export declare const findPreparationOperation: import("convex/server").Registere
180
180
  retryable: false;
181
181
  } | {
182
182
  reason?: undefined;
183
- retryable?: undefined;
184
183
  accountId: string;
185
184
  scopeKey: string;
186
185
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
187
186
  version: number;
187
+ retryable?: undefined;
188
188
  status?: undefined;
189
189
  state: "canceled" | "failed" | "pending" | "running" | "succeeded" | "unknown";
190
190
  cancelRequested: boolean;
@@ -2632,14 +2632,6 @@ export declare function setupCredits(): Promise<{
2632
2632
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2633
2633
  requestKey: string;
2634
2634
  result?: {
2635
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2636
- retryable: false;
2637
- status: "conflict";
2638
- } | {
2639
- reason: "policy_invalid";
2640
- retryable: false;
2641
- status: "rejected";
2642
- } | {
2643
2635
  operation: {
2644
2636
  accountId: string;
2645
2637
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2650,6 +2642,14 @@ export declare function setupCredits(): Promise<{
2650
2642
  } | {
2651
2643
  enabled: boolean;
2652
2644
  status: "unchanged";
2645
+ } | {
2646
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2647
+ retryable: false;
2648
+ status: "conflict";
2649
+ } | {
2650
+ reason: "policy_invalid";
2651
+ retryable: false;
2652
+ status: "rejected";
2653
2653
  } | {
2654
2654
  reason: "provider_pending";
2655
2655
  retryable: true;
@@ -2660,14 +2660,6 @@ export declare function setupCredits(): Promise<{
2660
2660
  payload: import("convex/values").VString<string, "required">;
2661
2661
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
2662
2662
  result: import("convex/values").VUnion<{
2663
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2664
- retryable: false;
2665
- status: "conflict";
2666
- } | {
2667
- reason: "policy_invalid";
2668
- retryable: false;
2669
- status: "rejected";
2670
- } | {
2671
2663
  operation: {
2672
2664
  accountId: string;
2673
2665
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2678,6 +2670,14 @@ export declare function setupCredits(): Promise<{
2678
2670
  } | {
2679
2671
  enabled: boolean;
2680
2672
  status: "unchanged";
2673
+ } | {
2674
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2675
+ retryable: false;
2676
+ status: "conflict";
2677
+ } | {
2678
+ reason: "policy_invalid";
2679
+ retryable: false;
2680
+ status: "rejected";
2681
2681
  } | {
2682
2682
  reason: "provider_pending";
2683
2683
  retryable: true;
@@ -0,0 +1,85 @@
1
+ # Private renewal invoice acquisition
2
+
3
+ The private invoice observer extends fresh renewal evidence with a separately
4
+ authorized invoice pair. It has no public SDK export. Both production profiles
5
+ remain empty; implementing the private path does not activate provider access.
6
+ The original schedule-first 44-GET observer keeps its existing result layout and
7
+ does not fetch invoices.
8
+
9
+ The invoice wrapper uses the same actual Action invocation, selected SDK client
10
+ and original 30-second lifetime as its base observation. Base reads still acquire
11
+ the retained owned schedule, original subscription, target price, billing
12
+ customer and bounded coupon inventory. Invoice acquisition adds at most seven
13
+ GETs, giving a maximum of 51 provider calls. Requests have no body, no idempotency
14
+ key, zero retries and the fixed `2026-09-30.endive` API version.
15
+
16
+ ## Dedicated invoice permission
17
+
18
+ A fixed host query authenticates its own `ctx.auth` and authorizes the exact
19
+ `renewal_invoice_evidence_v1` capability. Its closed arguments bind the trusted
20
+ installation scope, parent/configure operation IDs, platform mode, null connected
21
+ account, livemode, customer account, billing Customer ID, original subscription,
22
+ owned schedule and the two pinned invoice IDs. The Customer ID comes from the
23
+ retained billing customer and must match fresh customer relations. An account ID
24
+ alone does not grant access to its customers' invoice bodies.
25
+
26
+ The response repeats these arguments with the authenticated token identifier,
27
+ authorization ID, positive revision and expiration. Both the original operation
28
+ grant and dedicated invoice grant are rechecked before each additional GET and
29
+ before releasing protected output. Each response must remain equal to its own
30
+ first captured grant. Generated Convex query references are bound by their fixed
31
+ Source association and captured semantic address.
32
+
33
+ The earliest original lifetime, base expiration or invoice expiration wins.
34
+ There is no new timer or renewed expiration. Revocation, context/profile/address
35
+ drift, changed SDK configuration and timeout refuse protected output. The actor
36
+ can be consumed once. Late completion cannot authorize a new read or release.
37
+
38
+ ## Pinned requests and complete inventories
39
+
40
+ The original invoice ID comes only from the retained original subscription's
41
+ `latest_invoice`. The current ID comes only from the first fresh original
42
+ subscription response. Missing pointers leave invoice evidence unavailable.
43
+ Equal IDs cannot establish a distinct-period pair; this does not turn an
44
+ ordinary pending observation into a broader conflict. No search, date inference,
45
+ matching-resource adoption or replacement pointer is used.
46
+
47
+ Malformed, deleted or foreign expanded references refuse without fallback.
48
+ Rich expansions retain all fields and must match the separately fetched complete
49
+ invoice; they do not skip that GET. Each invoice body must match its pinned ID,
50
+ mode, account, customer and original subscription before requesting its lines.
51
+
52
+ For each invoice, the plan fetches the fixed body path and
53
+ `/v1/invoices/{id}/lines?limit=100`. A second page is allowed only when the first
54
+ declares `has_more:true`. Its cursor is the last validated line ID. The plan never
55
+ follows `page.url`; that field must match the fixed invoice-lines pathname.
56
+ Line object, mode and invoice ownership are checked before cursor adoption.
57
+ Duplicate IDs, including aliases across the two invoices, invalid cursors,
58
+ oversize pages, empty continuations and a second page with more data refuse the
59
+ pair. There is no third page or truncation.
60
+
61
+ One final subscription GET must equal the complete earlier fresh subscription
62
+ response. Pointer or material drift refuses the pair; the observer does not
63
+ adopt the fence response or restart acquisition. Partial inventories never enter
64
+ the analyzer as a complete `invoiceContext`.
65
+
66
+ ## Result meaning
67
+
68
+ The invoice wrapper adds `invoiceContext`, `invoiceInventory` and `invoiceReason`
69
+ to its private DATA output. A complete inventory means the bounded resources were
70
+ acquired, not that their billing material qualifies. The existing seven-input,
71
+ twelve-result analyzer checks item/successor identity, native periods, exact
72
+ price/product/currency, non-proration and decimal strings. It preserves full raw
73
+ resources and wire decimal text. Invoice status does not establish payment,
74
+ entitlement, consent or exclusive causality.
75
+
76
+ Actual SDK rejection returns bounded diagnostics and retained receipts only
77
+ after both final grants succeed. Authorization and decoding failures propagate;
78
+ they do not become fabricated provider rejections. No protected DATA is released
79
+ after timeout or revocation.
80
+
81
+ The final authorization and subscription fence are checked points. Sequential
82
+ invoice bodies and line pages do not form an atomic snapshot or prove
83
+ uninterrupted permission. Historical native witness acquisition remains a
84
+ separate requirement. Live provider qualification, genuine generation, deployed
85
+ compatibility, operational binding and Dojo acceptance are still required.
@@ -212,7 +212,10 @@ refuses a match. A valid billing line alone cannot establish full effectiveness.
212
212
 
213
213
  Invoice correlation uses the pinned Endive parent/pricing paths, the original
214
214
  Subscription and its actual item identities, and exact native `(start, end)`
215
- pairs. Original invoice reasons are `subscription_create` or `subscription_cycle`;
215
+ pairs. The retained original and fresh current invoice pointers must name distinct
216
+ invoice IDs. Supplying two period-specific inventories under one invoice ID
217
+ cannot establish paired renewal invoice evidence, including with expanded
218
+ pointers. Original invoice reasons are `subscription_create` or `subscription_cycle`;
216
219
  renewal reason is `subscription_cycle`. The first profile checks every supplied
217
220
  page, at most two pages of 100 rows, and requires one eligible line. Incomplete,
218
221
  duplicate or nonprogressing inventories remain unknown. Decimal strings are
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fantastic.dev/better-stripe",
3
- "version": "0.109.0",
3
+ "version": "0.110.0",
4
4
  "description": "Convex component for Stripe Accounts v2, subscriptions, metered billing and Connect marketplaces, with React workflows.",
5
5
  "keywords": [
6
6
  "stripe",