@fantastic.dev/better-stripe 0.66.0 → 0.67.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 (90) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +17 -20
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +126 -12
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +79 -22
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +158 -44
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +63 -6
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/index.d.ts +1 -0
  12. package/dist/client/index.d.ts.map +1 -1
  13. package/dist/client/index.js.map +1 -1
  14. package/dist/client/recoveryWorkflow/provider.fixture.d.ts +21 -0
  15. package/dist/client/recoveryWorkflow/provider.fixture.d.ts.map +1 -0
  16. package/dist/client/recoveryWorkflow/provider.fixture.js +125 -0
  17. package/dist/client/recoveryWorkflow/provider.fixture.js.map +1 -0
  18. package/dist/client/settlement/authorization.d.ts.map +1 -1
  19. package/dist/client/settlement/authorization.fixture.d.ts +10 -0
  20. package/dist/client/settlement/authorization.fixture.d.ts.map +1 -1
  21. package/dist/client/settlement/authorization.js +1 -0
  22. package/dist/client/settlement/authorization.js.map +1 -1
  23. package/dist/client/settlement/execution.d.ts +2 -0
  24. package/dist/client/settlement/execution.d.ts.map +1 -1
  25. package/dist/client/settlement/execution.js +3 -0
  26. package/dist/client/settlement/execution.js.map +1 -1
  27. package/dist/client/settlement/settleSale.d.ts +2 -0
  28. package/dist/client/settlement/settleSale.d.ts.map +1 -1
  29. package/dist/client/settlement/settleSale.js +4 -0
  30. package/dist/client/settlement/settleSale.js.map +1 -1
  31. package/dist/client/usage/observationClient.d.ts +2 -2
  32. package/dist/client/usage/observationClient.d.ts.map +1 -1
  33. package/dist/component/_generated/component.d.ts +25 -0
  34. package/dist/component/_generated/component.d.ts.map +1 -1
  35. package/dist/component/balanceFunding/mutations.d.ts +27 -27
  36. package/dist/component/balanceFunding/queries.d.ts +1 -1
  37. package/dist/component/earnings/triggers.d.ts +36 -6
  38. package/dist/component/earnings/triggers.d.ts.map +1 -1
  39. package/dist/component/payoutRelease/queries.d.ts +2 -2
  40. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  41. package/dist/component/recoveryWorkflow/helpers.d.ts +5 -0
  42. package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -1
  43. package/dist/component/recoveryWorkflow/mutations.d.ts +5 -0
  44. package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -1
  45. package/dist/component/recoveryWorkflow/mutations.js +2 -0
  46. package/dist/component/recoveryWorkflow/mutations.js.map +1 -1
  47. package/dist/component/recoveryWorkflow/queries.d.ts +10 -0
  48. package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -1
  49. package/dist/component/recoveryWorkflow/schema.d.ts +114 -10
  50. package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -1
  51. package/dist/component/schema.d.ts +63 -6
  52. package/dist/component/settlement/mutations.d.ts +10 -0
  53. package/dist/component/settlement/mutations.d.ts.map +1 -1
  54. package/dist/component/settlement/mutations.js +3 -0
  55. package/dist/component/settlement/mutations.js.map +1 -1
  56. package/dist/component/settlement/queries.d.ts +5 -0
  57. package/dist/component/settlement/queries.d.ts.map +1 -1
  58. package/dist/component/settlement/schema.d.ts +24 -1
  59. package/dist/component/settlement/schema.d.ts.map +1 -1
  60. package/dist/component/settlement/schema.js +5 -0
  61. package/dist/component/settlement/schema.js.map +1 -1
  62. package/dist/component/usage/allowance.fixtures.d.ts +79 -22
  63. package/dist/component/usage/allowance.fixtures.d.ts.map +1 -1
  64. package/dist/component/usageCredits/accounting.fixtures.d.ts +63 -6
  65. package/dist/component/usageCredits/accounting.fixtures.d.ts.map +1 -1
  66. package/dist/shared/settlementPolicyContext.d.ts +10 -0
  67. package/dist/shared/settlementPolicyContext.d.ts.map +1 -0
  68. package/dist/shared/settlementPolicyContext.js +40 -0
  69. package/dist/shared/settlementPolicyContext.js.map +1 -0
  70. package/docs/README.md +2 -1
  71. package/docs/metered-usage.md +174 -356
  72. package/docs/metering-setup.md +175 -168
  73. package/docs/settlement.md +38 -0
  74. package/docs/usage-catalog.md +1 -1
  75. package/docs/usage-ledger.md +9 -8
  76. package/docs/usage-rollout.md +147 -0
  77. package/package.json +3 -2
  78. package/src/client/index.ts +1 -0
  79. package/src/client/recoveryWorkflow/provider.fixture.ts +143 -0
  80. package/src/client/recoveryWorkflow/provider.test.ts +83 -140
  81. package/src/client/settlement/authorization.ts +1 -0
  82. package/src/client/settlement/execution.ts +7 -0
  83. package/src/client/settlement/policy-context.test.ts +277 -0
  84. package/src/client/settlement/settleSale.ts +12 -0
  85. package/src/component/_generated/component.ts +25 -0
  86. package/src/component/recoveryWorkflow/mutations.ts +2 -0
  87. package/src/component/settlement/mutations.ts +6 -0
  88. package/src/component/settlement/schema.ts +7 -0
  89. package/src/component/tsconfig.json +5 -0
  90. package/src/shared/settlementPolicyContext.ts +62 -0
@@ -1403,6 +1403,11 @@ export declare function setupCredits(): Promise<{
1403
1403
  paymentId?: string | undefined;
1404
1404
  paymentIntentId?: string | undefined;
1405
1405
  platformNet: number;
1406
+ policyContext?: {
1407
+ fields: Record<string, string>;
1408
+ namespace: string;
1409
+ version: 1;
1410
+ } | undefined;
1406
1411
  processingFee: number;
1407
1412
  sourceChargeId: string;
1408
1413
  sourceInvoiceId?: string | undefined;
@@ -1475,6 +1480,11 @@ export declare function setupCredits(): Promise<{
1475
1480
  paymentId?: string | undefined;
1476
1481
  paymentIntentId?: string | undefined;
1477
1482
  platformNet: number;
1483
+ policyContext?: {
1484
+ fields: Record<string, string>;
1485
+ namespace: string;
1486
+ version: 1;
1487
+ } | undefined;
1478
1488
  processingFee: number;
1479
1489
  sourceChargeId: string;
1480
1490
  sourceInvoiceId?: string | undefined;
@@ -1500,6 +1510,15 @@ export declare function setupCredits(): Promise<{
1500
1510
  subscriptionItemId: string;
1501
1511
  } | undefined;
1502
1512
  } | undefined, {
1513
+ policyContext: import("convex/values").VObject<{
1514
+ fields: Record<string, string>;
1515
+ namespace: string;
1516
+ version: 1;
1517
+ } | undefined, {
1518
+ namespace: import("convex/values").VString<string, "required">;
1519
+ version: import("convex/values").VLiteral<1, "required">;
1520
+ fields: import("convex/values").VRecord<Record<string, string>, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "required", string>;
1521
+ }, "optional", "fields" | "namespace" | "version" | `fields.${string}`>;
1503
1522
  sourceChargeId: import("convex/values").VString<string, "required">;
1504
1523
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1505
1524
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
@@ -1573,7 +1592,7 @@ export declare function setupCredits(): Promise<{
1573
1592
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1574
1593
  amount: import("convex/values").VFloat64<number, "required">;
1575
1594
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1576
- }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1595
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "policyContext" | "policyContext.fields" | "policyContext.namespace" | "policyContext.version" | "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" | `policyContext.fields.${string}`>;
1577
1596
  version: import("convex/values").VFloat64<number, "required">;
1578
1597
  sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
1579
1598
  sourceId: import("convex/values").VString<string, "required">;
@@ -1584,7 +1603,7 @@ export declare function setupCredits(): Promise<{
1584
1603
  activePhase: import("convex/values").VUnion<"execute" | "reconcile" | undefined, [import("convex/values").VLiteral<"execute", "required">, import("convex/values").VLiteral<"reconcile", "required">], "optional", never>;
1585
1604
  resumeQueued: import("convex/values").VBoolean<boolean, "required">;
1586
1605
  outcome: import("convex/values").VUnion<"collect" | "release" | undefined, [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "optional", never>;
1587
- }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
1606
+ }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.policyContext" | "allocation.policyContext.fields" | "allocation.policyContext.namespace" | "allocation.policyContext.version" | "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" | `allocation.policyContext.fields.${string}`>, {
1588
1607
  by_group: ["groupKey", "_creationTime"];
1589
1608
  by_source: ["sourceKind", "sourceId", "_creationTime"];
1590
1609
  }, {}, {}>;
@@ -1607,6 +1626,11 @@ export declare function setupCredits(): Promise<{
1607
1626
  paymentId?: string | undefined;
1608
1627
  paymentIntentId?: string | undefined;
1609
1628
  platformNet: number;
1629
+ policyContext?: {
1630
+ fields: Record<string, string>;
1631
+ namespace: string;
1632
+ version: 1;
1633
+ } | undefined;
1610
1634
  processingFee: number;
1611
1635
  sourceChargeId: string;
1612
1636
  sourceInvoiceId?: string | undefined;
@@ -1665,6 +1689,11 @@ export declare function setupCredits(): Promise<{
1665
1689
  paymentId?: string | undefined;
1666
1690
  paymentIntentId?: string | undefined;
1667
1691
  platformNet: number;
1692
+ policyContext?: {
1693
+ fields: Record<string, string>;
1694
+ namespace: string;
1695
+ version: 1;
1696
+ } | undefined;
1668
1697
  processingFee: number;
1669
1698
  sourceChargeId: string;
1670
1699
  sourceInvoiceId?: string | undefined;
@@ -1728,6 +1757,11 @@ export declare function setupCredits(): Promise<{
1728
1757
  paymentId?: string | undefined;
1729
1758
  paymentIntentId?: string | undefined;
1730
1759
  platformNet: number;
1760
+ policyContext?: {
1761
+ fields: Record<string, string>;
1762
+ namespace: string;
1763
+ version: 1;
1764
+ } | undefined;
1731
1765
  processingFee: number;
1732
1766
  sourceChargeId: string;
1733
1767
  sourceInvoiceId?: string | undefined;
@@ -1753,6 +1787,15 @@ export declare function setupCredits(): Promise<{
1753
1787
  subscriptionItemId: string;
1754
1788
  } | undefined;
1755
1789
  } | undefined, {
1790
+ policyContext: import("convex/values").VObject<{
1791
+ fields: Record<string, string>;
1792
+ namespace: string;
1793
+ version: 1;
1794
+ } | undefined, {
1795
+ namespace: import("convex/values").VString<string, "required">;
1796
+ version: import("convex/values").VLiteral<1, "required">;
1797
+ fields: import("convex/values").VRecord<Record<string, string>, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "required", string>;
1798
+ }, "optional", "fields" | "namespace" | "version" | `fields.${string}`>;
1756
1799
  sourceChargeId: import("convex/values").VString<string, "required">;
1757
1800
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1758
1801
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
@@ -1826,10 +1869,10 @@ export declare function setupCredits(): Promise<{
1826
1869
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1827
1870
  amount: import("convex/values").VFloat64<number, "required">;
1828
1871
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1829
- }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1830
- }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
1872
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "policyContext" | "policyContext.fields" | "policyContext.namespace" | "policyContext.version" | "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" | `policyContext.fields.${string}`>;
1873
+ }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.policyContext" | "allocation.policyContext.fields" | "allocation.policyContext.namespace" | "allocation.policyContext.version" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey" | `allocation.policyContext.fields.${string}`>;
1831
1874
  operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
1832
- }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.creditSource" | "binding.allocation.creditSource.creditGrantId" | "binding.allocation.creditSource.customerAccount" | "binding.allocation.creditSource.livemode" | "binding.allocation.creditSource.purchaseId" | "binding.allocation.creditSource.stripeAccountId" | "binding.allocation.creditSource.stripePriceId" | "binding.allocation.creditSource.stripeProductId" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.allocation.usageSource" | "binding.allocation.usageSource.customerAccount" | "binding.allocation.usageSource.invoicePaymentId" | "binding.allocation.usageSource.livemode" | "binding.allocation.usageSource.meterId" | "binding.allocation.usageSource.model" | "binding.allocation.usageSource.period" | "binding.allocation.usageSource.period.end" | "binding.allocation.usageSource.period.start" | "binding.allocation.usageSource.stripeAccountId" | "binding.allocation.usageSource.stripePriceId" | "binding.allocation.usageSource.stripeProductId" | "binding.allocation.usageSource.subscriptionId" | "binding.allocation.usageSource.subscriptionItemId" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
1875
+ }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.creditSource" | "binding.allocation.creditSource.creditGrantId" | "binding.allocation.creditSource.customerAccount" | "binding.allocation.creditSource.livemode" | "binding.allocation.creditSource.purchaseId" | "binding.allocation.creditSource.stripeAccountId" | "binding.allocation.creditSource.stripePriceId" | "binding.allocation.creditSource.stripeProductId" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.policyContext" | "binding.allocation.policyContext.fields" | "binding.allocation.policyContext.namespace" | "binding.allocation.policyContext.version" | "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" | `binding.allocation.policyContext.fields.${string}`>, {
1833
1876
  by_key: ["requestKey", "_creationTime"];
1834
1877
  }, {}, {}>;
1835
1878
  balanceFundingPreparations: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -3642,6 +3685,11 @@ export declare function setupCredits(): Promise<{
3642
3685
  paymentId?: string | undefined;
3643
3686
  paymentIntentId?: string | undefined;
3644
3687
  platformNet: number;
3688
+ policyContext?: {
3689
+ fields: Record<string, string>;
3690
+ namespace: string;
3691
+ version: 1;
3692
+ } | undefined;
3645
3693
  processingFee: number;
3646
3694
  sourceChargeId: string;
3647
3695
  sourceInvoiceId?: string | undefined;
@@ -3667,6 +3715,15 @@ export declare function setupCredits(): Promise<{
3667
3715
  subscriptionItemId: string;
3668
3716
  } | undefined;
3669
3717
  }, {
3718
+ policyContext: import("convex/values").VObject<{
3719
+ fields: Record<string, string>;
3720
+ namespace: string;
3721
+ version: 1;
3722
+ } | undefined, {
3723
+ namespace: import("convex/values").VString<string, "required">;
3724
+ version: import("convex/values").VLiteral<1, "required">;
3725
+ fields: import("convex/values").VRecord<Record<string, string>, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "required", string>;
3726
+ }, "optional", "fields" | "namespace" | "version" | `fields.${string}`>;
3670
3727
  sourceChargeId: import("convex/values").VString<string, "required">;
3671
3728
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
3672
3729
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
@@ -3740,7 +3797,7 @@ export declare function setupCredits(): Promise<{
3740
3797
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
3741
3798
  amount: import("convex/values").VFloat64<number, "required">;
3742
3799
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
3743
- }, "required", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">, {
3800
+ }, "required", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "policyContext" | "policyContext.fields" | "policyContext.namespace" | "policyContext.version" | "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" | `policyContext.fields.${string}`>, {
3744
3801
  by_source_charge: ["sourceChargeId", "_creationTime"];
3745
3802
  }, {}, {}>;
3746
3803
  commissionTerms: 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":"AAgBA,wBAAsB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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O;yBACZ,OAAO,EAAE,IAAI;yBACb,KAAK,EAAE,SAAS;yBAChB,IAAI;6BAAI,IAAI,EAAE,MAAM;6BAAE,SAAS,EAAE,CAAC;;yBAClC,IAAI;6BAAI,QAAQ,EAAE,KAAK;6BAAE,iBAAiB,EAAE,GAAG;;yBAC/C,mBAAmB,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuDvB,KAAK;YAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU5B"}
@@ -0,0 +1,10 @@
1
+ /** Nonsecret host provenance. The SDK never interprets this as authorization. */
2
+ export type SettlementPolicyContext = Readonly<{
3
+ namespace: string;
4
+ version: 1;
5
+ fields: Readonly<Record<string, string>>;
6
+ }>;
7
+ /** Canonical, bounded binding shared by SDK entry and component reservation. */
8
+ export declare function policyContextBinding(context?: SettlementPolicyContext): string;
9
+ export declare function assertPolicyContextMatches(saved: SettlementPolicyContext | undefined, requested: SettlementPolicyContext | undefined): void;
10
+ //# sourceMappingURL=settlementPolicyContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settlementPolicyContext.d.ts","sourceRoot":"","sources":["../../src/shared/settlementPolicyContext.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC1C,CAAC,CAAC;AAEH,gFAAgF;AAChF,wBAAgB,oBAAoB,CAClC,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,CA2CR;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,uBAAuB,GAAG,SAAS,EAC1C,SAAS,EAAE,uBAAuB,GAAG,SAAS,QAI/C"}
@@ -0,0 +1,40 @@
1
+ /** Canonical, bounded binding shared by SDK entry and component reservation. */
2
+ export function policyContextBinding(context) {
3
+ if (context === undefined)
4
+ return "absent";
5
+ if (!context ||
6
+ typeof context !== "object" ||
7
+ ![Object.prototype, null].includes(Object.getPrototypeOf(context)) ||
8
+ Object.keys(context).some((key) => !["namespace", "version", "fields"].includes(key)) ||
9
+ typeof context.namespace !== "string" ||
10
+ context.namespace.length < 1 ||
11
+ context.namespace.length > 80 ||
12
+ context.version !== 1 ||
13
+ !context.fields ||
14
+ typeof context.fields !== "object" ||
15
+ Array.isArray(context.fields) ||
16
+ ![Object.prototype, null].includes(Object.getPrototypeOf(context.fields)))
17
+ throw new Error("Invalid settlement policy context.");
18
+ const entries = Object.entries(context.fields).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
19
+ if (entries.length > 32 ||
20
+ entries.some(([key, value]) => key.length < 1 ||
21
+ key.length > 64 ||
22
+ key.startsWith("$") ||
23
+ !/^[ -~]+$/.test(key) ||
24
+ typeof value !== "string" ||
25
+ value.length > 512))
26
+ throw new Error("Invalid settlement policy context fields.");
27
+ const binding = JSON.stringify({
28
+ namespace: context.namespace,
29
+ version: context.version,
30
+ fields: Object.fromEntries(entries),
31
+ });
32
+ if (new TextEncoder().encode(binding).byteLength > 8192)
33
+ throw new Error("Settlement policy context exceeds 8 KiB.");
34
+ return binding;
35
+ }
36
+ export function assertPolicyContextMatches(saved, requested) {
37
+ if (policyContextBinding(saved) !== policyContextBinding(requested))
38
+ throw new Error("Settlement policy context cannot change.");
39
+ }
40
+ //# sourceMappingURL=settlementPolicyContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settlementPolicyContext.js","sourceRoot":"","sources":["../../src/shared/settlementPolicyContext.ts"],"names":[],"mappings":"AAOA,gFAAgF;AAChF,MAAM,UAAU,oBAAoB,CAClC,OAAiC;IAEjC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC3C,IACE,CAAC,OAAO;QACR,OAAO,OAA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AAM,GAAG,CAAC;YACd,GAAG,CAAC,MAAM,GAAG,EAAE;YACf,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;YACnB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;YACrB,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,CAAC,MAAM,GAAG,GAAG,CACrB;QAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QAC7B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;KACpC,CAAC,CAAC;IACH,IAAI,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,UAAU,GAAG,IAAI;QACrD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAA0C,EAC1C,SAA8C;IAE9C,IAAI,oBAAoB,CAAC,KAAK,CAAC,KAAK,oBAAoB,CAAC,SAAS,CAAC;QACjE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAChE,CAAC"}
package/docs/README.md CHANGED
@@ -24,7 +24,8 @@ guide for your integration.
24
24
  - [SetupIntent recovery](setup-intent-recovery.md).
25
25
  - [Balance funding state](balance-funding-state.md) and [workflow](balance-funding-workflow.md).
26
26
  - [Example balance funding cutover](example-balance-funding-cutover.md).
27
- - [Metered usage investigation](metered-usage.md), provider comparison and acceptance requirements. Shared contracts, catalog provisioning and local usage acceptance are available; credit accounting is in progress.
27
+ - [Native metered billing](metered-usage.md), all three models, public recipes and accounting contracts.
28
+ - [Opt-in usage rollout](usage-rollout.md), adoption, drain, backfill limits, model transitions, rollback and release handoff.
28
29
 
29
30
  ## Marketplace, settlement, and recovery
30
31