@paygentic/sdk 0.9.7 → 0.9.9

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 (147) hide show
  1. package/dist/commonjs/funcs/customersList.js +2 -2
  2. package/dist/commonjs/funcs/customersList.js.map +1 -1
  3. package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +1 -1
  4. package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js +1 -1
  5. package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js +2 -2
  6. package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -1
  7. package/dist/commonjs/lib/config.d.ts +2 -2
  8. package/dist/commonjs/lib/config.js +2 -2
  9. package/dist/commonjs/models/createpercentagediscountadjustment.d.ts +40 -0
  10. package/dist/commonjs/models/createpercentagediscountadjustment.d.ts.map +1 -0
  11. package/dist/commonjs/models/createpercentagediscountadjustment.js +54 -0
  12. package/dist/commonjs/models/createpercentagediscountadjustment.js.map +1 -0
  13. package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts +5 -45
  14. package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
  15. package/dist/commonjs/models/createsubscriptionadjustmentrequest.js +7 -18
  16. package/dist/commonjs/models/createsubscriptionadjustmentrequest.js.map +1 -1
  17. package/dist/commonjs/models/createusagediscountadjustment.d.ts +45 -0
  18. package/dist/commonjs/models/createusagediscountadjustment.d.ts.map +1 -0
  19. package/dist/commonjs/models/createusagediscountadjustment.js +55 -0
  20. package/dist/commonjs/models/createusagediscountadjustment.js.map +1 -0
  21. package/dist/commonjs/models/index.d.ts +4 -0
  22. package/dist/commonjs/models/index.d.ts.map +1 -1
  23. package/dist/commonjs/models/index.js +4 -0
  24. package/dist/commonjs/models/index.js.map +1 -1
  25. package/dist/commonjs/models/lineitem.d.ts +4 -0
  26. package/dist/commonjs/models/lineitem.d.ts.map +1 -1
  27. package/dist/commonjs/models/lineitem.js +1 -0
  28. package/dist/commonjs/models/lineitem.js.map +1 -1
  29. package/dist/commonjs/models/operations/createprice.d.ts +15 -0
  30. package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
  31. package/dist/commonjs/models/operations/createprice.js +3 -0
  32. package/dist/commonjs/models/operations/createprice.js.map +1 -1
  33. package/dist/commonjs/models/operations/updateprice.d.ts +15 -0
  34. package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
  35. package/dist/commonjs/models/operations/updateprice.js +3 -0
  36. package/dist/commonjs/models/operations/updateprice.js.map +1 -1
  37. package/dist/commonjs/models/planversionpriceslot.d.ts +30 -0
  38. package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -1
  39. package/dist/commonjs/models/planversionpriceslot.js +15 -1
  40. package/dist/commonjs/models/planversionpriceslot.js.map +1 -1
  41. package/dist/commonjs/models/price.d.ts +30 -0
  42. package/dist/commonjs/models/price.d.ts.map +1 -1
  43. package/dist/commonjs/models/price.js +15 -1
  44. package/dist/commonjs/models/price.js.map +1 -1
  45. package/dist/commonjs/models/priceproperties.d.ts +3 -3
  46. package/dist/commonjs/models/pricetax.d.ts +58 -0
  47. package/dist/commonjs/models/pricetax.d.ts.map +1 -0
  48. package/dist/commonjs/models/pricetax.js +82 -0
  49. package/dist/commonjs/models/pricetax.js.map +1 -0
  50. package/dist/commonjs/models/ratetype.d.ts +18 -0
  51. package/dist/commonjs/models/ratetype.d.ts.map +1 -0
  52. package/dist/commonjs/models/ratetype.js +53 -0
  53. package/dist/commonjs/models/ratetype.js.map +1 -0
  54. package/dist/commonjs/models/schemasprice.d.ts +14 -0
  55. package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
  56. package/dist/commonjs/models/schemasprice.js +5 -0
  57. package/dist/commonjs/models/schemasprice.js.map +1 -1
  58. package/dist/commonjs/models/subscriptionadjustment.d.ts +14 -5
  59. package/dist/commonjs/models/subscriptionadjustment.d.ts.map +1 -1
  60. package/dist/commonjs/models/subscriptionadjustment.js +4 -1
  61. package/dist/commonjs/models/subscriptionadjustment.js.map +1 -1
  62. package/dist/commonjs/sdk/subscriptions.d.ts +1 -1
  63. package/dist/commonjs/sdk/subscriptions.js +1 -1
  64. package/dist/esm/funcs/customersList.js +2 -2
  65. package/dist/esm/funcs/customersList.js.map +1 -1
  66. package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +1 -1
  67. package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js +1 -1
  68. package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js +2 -2
  69. package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -1
  70. package/dist/esm/lib/config.d.ts +2 -2
  71. package/dist/esm/lib/config.js +2 -2
  72. package/dist/esm/models/createpercentagediscountadjustment.d.ts +40 -0
  73. package/dist/esm/models/createpercentagediscountadjustment.d.ts.map +1 -0
  74. package/dist/esm/models/createpercentagediscountadjustment.js +17 -0
  75. package/dist/esm/models/createpercentagediscountadjustment.js.map +1 -0
  76. package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts +5 -45
  77. package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
  78. package/dist/esm/models/createsubscriptionadjustmentrequest.js +6 -17
  79. package/dist/esm/models/createsubscriptionadjustmentrequest.js.map +1 -1
  80. package/dist/esm/models/createusagediscountadjustment.d.ts +45 -0
  81. package/dist/esm/models/createusagediscountadjustment.d.ts.map +1 -0
  82. package/dist/esm/models/createusagediscountadjustment.js +18 -0
  83. package/dist/esm/models/createusagediscountadjustment.js.map +1 -0
  84. package/dist/esm/models/index.d.ts +4 -0
  85. package/dist/esm/models/index.d.ts.map +1 -1
  86. package/dist/esm/models/index.js +4 -0
  87. package/dist/esm/models/index.js.map +1 -1
  88. package/dist/esm/models/lineitem.d.ts +4 -0
  89. package/dist/esm/models/lineitem.d.ts.map +1 -1
  90. package/dist/esm/models/lineitem.js +1 -0
  91. package/dist/esm/models/lineitem.js.map +1 -1
  92. package/dist/esm/models/operations/createprice.d.ts +15 -0
  93. package/dist/esm/models/operations/createprice.d.ts.map +1 -1
  94. package/dist/esm/models/operations/createprice.js +3 -0
  95. package/dist/esm/models/operations/createprice.js.map +1 -1
  96. package/dist/esm/models/operations/updateprice.d.ts +15 -0
  97. package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
  98. package/dist/esm/models/operations/updateprice.js +3 -0
  99. package/dist/esm/models/operations/updateprice.js.map +1 -1
  100. package/dist/esm/models/planversionpriceslot.d.ts +30 -0
  101. package/dist/esm/models/planversionpriceslot.d.ts.map +1 -1
  102. package/dist/esm/models/planversionpriceslot.js +14 -0
  103. package/dist/esm/models/planversionpriceslot.js.map +1 -1
  104. package/dist/esm/models/price.d.ts +30 -0
  105. package/dist/esm/models/price.d.ts.map +1 -1
  106. package/dist/esm/models/price.js +14 -0
  107. package/dist/esm/models/price.js.map +1 -1
  108. package/dist/esm/models/priceproperties.d.ts +3 -3
  109. package/dist/esm/models/pricetax.d.ts +58 -0
  110. package/dist/esm/models/pricetax.d.ts.map +1 -0
  111. package/dist/esm/models/pricetax.js +44 -0
  112. package/dist/esm/models/pricetax.js.map +1 -0
  113. package/dist/esm/models/ratetype.d.ts +18 -0
  114. package/dist/esm/models/ratetype.d.ts.map +1 -0
  115. package/dist/esm/models/ratetype.js +17 -0
  116. package/dist/esm/models/ratetype.js.map +1 -0
  117. package/dist/esm/models/schemasprice.d.ts +14 -0
  118. package/dist/esm/models/schemasprice.d.ts.map +1 -1
  119. package/dist/esm/models/schemasprice.js +5 -0
  120. package/dist/esm/models/schemasprice.js.map +1 -1
  121. package/dist/esm/models/subscriptionadjustment.d.ts +14 -5
  122. package/dist/esm/models/subscriptionadjustment.d.ts.map +1 -1
  123. package/dist/esm/models/subscriptionadjustment.js +4 -1
  124. package/dist/esm/models/subscriptionadjustment.js.map +1 -1
  125. package/dist/esm/sdk/subscriptions.d.ts +1 -1
  126. package/dist/esm/sdk/subscriptions.js +1 -1
  127. package/jsr.json +1 -1
  128. package/package.json +1 -1
  129. package/src/funcs/customersList.ts +2 -2
  130. package/src/funcs/subscriptionsCreateSubscriptionAdjustment.ts +1 -1
  131. package/src/funcs/subscriptionsReconcileSubscriptionFeatures.ts +2 -2
  132. package/src/lib/config.ts +2 -2
  133. package/src/models/createpercentagediscountadjustment.ts +66 -0
  134. package/src/models/createsubscriptionadjustmentrequest.ts +21 -59
  135. package/src/models/createusagediscountadjustment.ts +72 -0
  136. package/src/models/index.ts +4 -0
  137. package/src/models/lineitem.ts +5 -0
  138. package/src/models/operations/createprice.ts +18 -0
  139. package/src/models/operations/updateprice.ts +18 -0
  140. package/src/models/planversionpriceslot.ts +40 -0
  141. package/src/models/price.ts +38 -0
  142. package/src/models/priceproperties.ts +3 -3
  143. package/src/models/pricetax.ts +100 -0
  144. package/src/models/ratetype.ts +25 -0
  145. package/src/models/schemasprice.ts +17 -0
  146. package/src/models/subscriptionadjustment.ts +17 -6
  147. package/src/sdk/subscriptions.ts +1 -1
@@ -0,0 +1,100 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { ClosedEnum } from "../types/enums.js";
8
+ import { Result as SafeParseResult } from "../types/fp.js";
9
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * Whether this price's money is consideration for a supply — the one tax fact only you can state, because it is settled when you agree the deal rather than derived from what was sold. `IN_SCOPE` (the default) is consideration: it enters the taxable amount, positive as a charge or negative as a reduction in the price of the supply it applies to. `OUTSIDE_SCOPE` money is not consideration for anything, so it does not change the taxable amount, carries no tax, does not appear on the tax document, and nets into the amount payable after tax. This means "not consideration for a supply" — it does NOT mean "a supply outside this jurisdiction": exports and place-of-supply answers are worked out from the addresses on the sale by the tax provider, and are never declared on a price. How a supply is then classified — standard, zero-rated, exempt — is the tax provider's determination and is not set here either. Omit the whole `tax` object to leave a price in scope; there is deliberately no schema default on this property, so that a misspelt key is refused rather than silently defaulted.
13
+ */
14
+ export const SupplyScope = {
15
+ InScope: "IN_SCOPE",
16
+ OutsideScope: "OUTSIDE_SCOPE",
17
+ } as const;
18
+ /**
19
+ * Whether this price's money is consideration for a supply — the one tax fact only you can state, because it is settled when you agree the deal rather than derived from what was sold. `IN_SCOPE` (the default) is consideration: it enters the taxable amount, positive as a charge or negative as a reduction in the price of the supply it applies to. `OUTSIDE_SCOPE` money is not consideration for anything, so it does not change the taxable amount, carries no tax, does not appear on the tax document, and nets into the amount payable after tax. This means "not consideration for a supply" — it does NOT mean "a supply outside this jurisdiction": exports and place-of-supply answers are worked out from the addresses on the sale by the tax provider, and are never declared on a price. How a supply is then classified — standard, zero-rated, exempt — is the tax provider's determination and is not set here either. Omit the whole `tax` object to leave a price in scope; there is deliberately no schema default on this property, so that a misspelt key is refused rather than silently defaulted.
20
+ */
21
+ export type SupplyScope = ClosedEnum<typeof SupplyScope>;
22
+
23
+ /**
24
+ * What an `OUTSIDE_SCOPE` amount is called in the invoice totals, so the wording follows the declaration rather than being retyped per price. Required when `supplyScope` is `OUTSIDE_SCOPE`, and rejected otherwise. `CASHBACK` is the only value today, and a price declaring it must use the `standard` model and must not carry a positive `unitPrice` — a cashback is money paid back, not charged.
25
+ */
26
+ export const OutsideScopeLabel = {
27
+ Cashback: "CASHBACK",
28
+ } as const;
29
+ /**
30
+ * What an `OUTSIDE_SCOPE` amount is called in the invoice totals, so the wording follows the declaration rather than being retyped per price. Required when `supplyScope` is `OUTSIDE_SCOPE`, and rejected otherwise. `CASHBACK` is the only value today, and a price declaring it must use the `standard` model and must not carry a positive `unitPrice` — a cashback is money paid back, not charged.
31
+ */
32
+ export type OutsideScopeLabel = ClosedEnum<typeof OutsideScopeLabel>;
33
+
34
+ /**
35
+ * A price's tax declaration. Optional on write — a price that declares nothing is `IN_SCOPE`, and is billed and taxed exactly as it was before this object existed. Always present on read. Replaced as a whole on update: send the object to change it, omit it to leave it alone.
36
+ */
37
+ export type PriceTax = {
38
+ /**
39
+ * Whether this price's money is consideration for a supply — the one tax fact only you can state, because it is settled when you agree the deal rather than derived from what was sold. `IN_SCOPE` (the default) is consideration: it enters the taxable amount, positive as a charge or negative as a reduction in the price of the supply it applies to. `OUTSIDE_SCOPE` money is not consideration for anything, so it does not change the taxable amount, carries no tax, does not appear on the tax document, and nets into the amount payable after tax. This means "not consideration for a supply" — it does NOT mean "a supply outside this jurisdiction": exports and place-of-supply answers are worked out from the addresses on the sale by the tax provider, and are never declared on a price. How a supply is then classified — standard, zero-rated, exempt — is the tax provider's determination and is not set here either. Omit the whole `tax` object to leave a price in scope; there is deliberately no schema default on this property, so that a misspelt key is refused rather than silently defaulted.
40
+ */
41
+ supplyScope: SupplyScope;
42
+ /**
43
+ * What an `OUTSIDE_SCOPE` amount is called in the invoice totals, so the wording follows the declaration rather than being retyped per price. Required when `supplyScope` is `OUTSIDE_SCOPE`, and rejected otherwise. `CASHBACK` is the only value today, and a price declaring it must use the `standard` model and must not carry a positive `unitPrice` — a cashback is money paid back, not charged.
44
+ */
45
+ outsideScopeLabel?: OutsideScopeLabel | null | undefined;
46
+ };
47
+
48
+ /** @internal */
49
+ export const SupplyScope$inboundSchema: z.ZodNativeEnum<typeof SupplyScope> = z
50
+ .nativeEnum(SupplyScope);
51
+ /** @internal */
52
+ export const SupplyScope$outboundSchema: z.ZodNativeEnum<typeof SupplyScope> =
53
+ SupplyScope$inboundSchema;
54
+
55
+ /** @internal */
56
+ export const OutsideScopeLabel$inboundSchema: z.ZodNativeEnum<
57
+ typeof OutsideScopeLabel
58
+ > = z.nativeEnum(OutsideScopeLabel);
59
+ /** @internal */
60
+ export const OutsideScopeLabel$outboundSchema: z.ZodNativeEnum<
61
+ typeof OutsideScopeLabel
62
+ > = OutsideScopeLabel$inboundSchema;
63
+
64
+ /** @internal */
65
+ export const PriceTax$inboundSchema: z.ZodType<
66
+ PriceTax,
67
+ z.ZodTypeDef,
68
+ unknown
69
+ > = z.object({
70
+ supplyScope: SupplyScope$inboundSchema,
71
+ outsideScopeLabel: z.nullable(OutsideScopeLabel$inboundSchema).optional(),
72
+ });
73
+ /** @internal */
74
+ export type PriceTax$Outbound = {
75
+ supplyScope: string;
76
+ outsideScopeLabel?: string | null | undefined;
77
+ };
78
+
79
+ /** @internal */
80
+ export const PriceTax$outboundSchema: z.ZodType<
81
+ PriceTax$Outbound,
82
+ z.ZodTypeDef,
83
+ PriceTax
84
+ > = z.object({
85
+ supplyScope: SupplyScope$outboundSchema,
86
+ outsideScopeLabel: z.nullable(OutsideScopeLabel$outboundSchema).optional(),
87
+ });
88
+
89
+ export function priceTaxToJSON(priceTax: PriceTax): string {
90
+ return JSON.stringify(PriceTax$outboundSchema.parse(priceTax));
91
+ }
92
+ export function priceTaxFromJSON(
93
+ jsonString: string,
94
+ ): SafeParseResult<PriceTax, SDKValidationError> {
95
+ return safeParse(
96
+ jsonString,
97
+ (x) => PriceTax$inboundSchema.parse(JSON.parse(x)),
98
+ `Failed to parse 'PriceTax' from JSON`,
99
+ );
100
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { ClosedEnum } from "../types/enums.js";
7
+
8
+ /**
9
+ * What properties.unitPrice is denominated in. 'amount' (the default) is an amount of the invoice currency for each unit metered, so the quantity is the multiplier. 'proportion' is the reverse: a dimensionless share of a currency-denominated quantity, so '0.02' is 2% and the invoice prints '2.00%'. Presentation only. Requires a standard metered price in real currency.
10
+ */
11
+ export const RateType = {
12
+ Amount: "amount",
13
+ Proportion: "proportion",
14
+ } as const;
15
+ /**
16
+ * What properties.unitPrice is denominated in. 'amount' (the default) is an amount of the invoice currency for each unit metered, so the quantity is the multiplier. 'proportion' is the reverse: a dimensionless share of a currency-denominated quantity, so '0.02' is 2% and the invoice prints '2.00%'. Presentation only. Requires a standard metered price in real currency.
17
+ */
18
+ export type RateType = ClosedEnum<typeof RateType>;
19
+
20
+ /** @internal */
21
+ export const RateType$inboundSchema: z.ZodNativeEnum<typeof RateType> = z
22
+ .nativeEnum(RateType);
23
+ /** @internal */
24
+ export const RateType$outboundSchema: z.ZodNativeEnum<typeof RateType> =
25
+ RateType$inboundSchema;
@@ -13,6 +13,8 @@ import {
13
13
  PriceProperties,
14
14
  PriceProperties$inboundSchema,
15
15
  } from "./priceproperties.js";
16
+ import { PriceTax, PriceTax$inboundSchema } from "./pricetax.js";
17
+ import { RateType, RateType$inboundSchema } from "./ratetype.js";
16
18
 
17
19
  export const SchemasPriceObject = {
18
20
  Price: "price",
@@ -55,6 +57,10 @@ export type SchemasPrice = {
55
57
  billingCadence?: string | null | undefined;
56
58
  createdAt: Date;
57
59
  invoiceDisplayName: string;
60
+ /**
61
+ * Presentation only. Prices sharing this value, within one billing period, print as a single row on the rendered invoice PDF and are described by this string. Every member still bills its own line item on the ledger, this API and the compliance document. The combined row's rate is derived from the members' own rates. Requires the 'standard' pricing model. Sample values: 'Cross Border Fees', 'FX Fees'
62
+ */
63
+ invoiceDisplayGroup?: string | null | undefined;
58
64
  /**
59
65
  * Pricing model of a price as returned by the API. Includes the legacy models ('dynamic', 'percentage') retained for existing prices; 'standard' and 'volume' can be created (see PriceModelInput).
60
66
  */
@@ -74,6 +80,14 @@ export type SchemasPrice = {
74
80
  * A fixed amount owed whole rather than a per-period rate. An obligation is not prorated over a partial first period: when a subscription starts before its billing anchor, no truncated stub is billed and the first charge is the full amount at the next anchor. An obligation also refuses an interval boundary that falls strictly inside one of its own billing periods, since part of an amount owed whole is not a thing to bill. Defaults to false, which is a rate and is today's behaviour for every price. Not supported on a metered price, whose amount resolves from usage at close.
75
81
  */
76
82
  isObligation: boolean;
83
+ /**
84
+ * What properties.unitPrice is denominated in. 'amount' (the default) is an amount of the invoice currency for each unit metered, so the quantity is the multiplier. 'proportion' is the reverse: a dimensionless share of a currency-denominated quantity, so '0.02' is 2% and the invoice prints '2.00%'. Presentation only. Requires a standard metered price in real currency.
85
+ */
86
+ rateType?: RateType | undefined;
87
+ /**
88
+ * A price's tax declaration. Optional on write — a price that declares nothing is `IN_SCOPE`, and is billed and taxed exactly as it was before this object existed. Always present on read. Replaced as a whole on update: send the object to change it, omit it to leave it alone.
89
+ */
90
+ tax: PriceTax;
77
91
  /**
78
92
  * Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
79
93
  */
@@ -105,6 +119,7 @@ export const SchemasPrice$inboundSchema: z.ZodType<
105
119
  billingCadence: z.nullable(z.string()).optional(),
106
120
  createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
107
121
  invoiceDisplayName: z.string(),
122
+ invoiceDisplayGroup: z.nullable(z.string()).optional(),
108
123
  model: PriceModel$inboundSchema.optional(),
109
124
  paymentTerm: SchemasPricePaymentTerm$inboundSchema,
110
125
  properties: PriceProperties$inboundSchema,
@@ -112,6 +127,8 @@ export const SchemasPrice$inboundSchema: z.ZodType<
112
127
  features: z.array(PriceFeature$inboundSchema).optional(),
113
128
  grantDiscountEnabled: z.boolean().default(false),
114
129
  isObligation: z.boolean().default(false),
130
+ rateType: RateType$inboundSchema.optional(),
131
+ tax: PriceTax$inboundSchema,
115
132
  quantity: z.number().int(),
116
133
  });
117
134
 
@@ -17,6 +17,7 @@ export type SubscriptionAdjustmentObject = ClosedEnum<
17
17
 
18
18
  export const SubscriptionAdjustmentType = {
19
19
  PercentageDiscount: "percentageDiscount",
20
+ UsageDiscount: "usageDiscount",
20
21
  } as const;
21
22
  export type SubscriptionAdjustmentType = ClosedEnum<
22
23
  typeof SubscriptionAdjustmentType
@@ -34,19 +35,27 @@ export type SubscriptionAdjustment = {
34
35
  subscriptionId: string;
35
36
  type: SubscriptionAdjustmentType;
36
37
  /**
37
- * The discount rate as a decimal fraction between 0 and 1. "0.35" means 35 percent.
38
+ * The discount rate as a decimal fraction between 0 and 1. "0.35" means 35 percent. Null on a usageDiscount, which carries a unit count instead.
38
39
  */
39
- percentageDiscount: string;
40
+ percentageDiscount: string | null;
40
41
  /**
41
- * The first instant the discount applies. Inclusive.
42
+ * The number of usage units taken off the targeted line's billable quantity. Null on a percentageDiscount, which carries a rate instead.
43
+ */
44
+ usageDiscount: string | null;
45
+ /**
46
+ * The prices this adjustment reduces. Exactly one metered price on a usageDiscount; empty on a percentageDiscount, which reduces every discountable charge.
47
+ */
48
+ targetPriceIds: Array<string>;
49
+ /**
50
+ * Opens the window. Read per type: INCLUSIVE on a percentageDiscount, whose window is prorated by day overlap; EXCLUSIVE on a usageDiscount, which corrects a line whose period END falls strictly after this instant.
42
51
  */
43
52
  effectiveFrom: Date;
44
53
  /**
45
- * The instant the discount stops applying. Exclusive. Null means the discount never stops.
54
+ * Closes the window, or null for never. Read per type: EXCLUSIVE on a percentageDiscount; INCLUSIVE on a usageDiscount, which corrects a line whose period END falls on or before this instant.
46
55
  */
47
56
  effectiveTo: Date | null;
48
57
  /**
49
- * The deal's own name, shown on each discount line of the invoice.
58
+ * The deal's own name. Shown on each discount line a percentageDiscount emits; a usageDiscount emits no line, so its description is carried here only.
50
59
  */
51
60
  description: string | null;
52
61
  createdAt: Date;
@@ -72,7 +81,9 @@ export const SubscriptionAdjustment$inboundSchema: z.ZodType<
72
81
  id: z.string(),
73
82
  subscriptionId: z.string(),
74
83
  type: SubscriptionAdjustmentType$inboundSchema,
75
- percentageDiscount: z.string(),
84
+ percentageDiscount: z.nullable(z.string()),
85
+ usageDiscount: z.nullable(z.string()),
86
+ targetPriceIds: z.array(z.string()),
76
87
  effectiveFrom: z.string().datetime({ offset: true }).transform(v =>
77
88
  new Date(v)
78
89
  ),
@@ -149,7 +149,7 @@ export class Subscriptions extends ClientSDK {
149
149
  * Create Adjustment
150
150
  *
151
151
  * @remarks
152
- * Attaches a percentage discount to the subscription for a dated window. Every invoice calculated while the window is open carries one discount line for each discounted charge, and tax is assessed on the reduced amount. An invoice that already exists is not changed, including one still in draft — the discount reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change a rate before any invoice has issued under the discount, delete the adjustment and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
152
+ * Attaches an adjustment to the subscription for a dated window. A percentageDiscount reduces every discountable charge by a rate and carries one discount line per charge on the invoice. A usageDiscount takes a number of usage units off one metered price's billable quantity before that line is priced, so the line re-slots on a volume ladder and shows the corrected quantity; it emits no line of its own. Tax is assessed on the reduced amount either way. An invoice that already exists is not changed, including one still in draft — the adjustment reaches the periods that close after it is created. There is no update operation, and a window cannot be changed after it is created. To change an adjustment before any invoice has issued under it, delete it and create a replacement. Once an invoice has issued the adjustment is permanent, so set effectiveTo at creation time whenever the deal has a known end date.
153
153
  */
154
154
  async createSubscriptionAdjustment(
155
155
  request: operations.CreateSubscriptionAdjustmentRequest,