@paygentic/sdk 0.9.5 → 0.9.7
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.
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/invoicelineitem.d.ts +25 -0
- package/dist/commonjs/models/invoicelineitem.d.ts.map +1 -1
- package/dist/commonjs/models/invoicelineitem.js +15 -1
- package/dist/commonjs/models/invoicelineitem.js.map +1 -1
- package/dist/commonjs/models/lineitem.d.ts +3 -3
- package/dist/commonjs/models/lineitem.js +1 -1
- package/dist/commonjs/models/operations/createprice.d.ts +6 -1
- package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createprice.js +1 -0
- package/dist/commonjs/models/operations/createprice.js.map +1 -1
- package/dist/commonjs/models/operations/updateprice.d.ts +6 -1
- package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateprice.js +1 -0
- package/dist/commonjs/models/operations/updateprice.js.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.d.ts +4 -0
- package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.js +1 -0
- package/dist/commonjs/models/planversionpriceslot.js.map +1 -1
- package/dist/commonjs/models/price.d.ts +4 -0
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +1 -0
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricemodel.d.ts +2 -2
- package/dist/commonjs/models/pricemodel.js +1 -1
- package/dist/commonjs/models/pricemodelinput.d.ts +3 -2
- package/dist/commonjs/models/pricemodelinput.d.ts.map +1 -1
- package/dist/commonjs/models/pricemodelinput.js +2 -1
- package/dist/commonjs/models/pricemodelinput.js.map +1 -1
- package/dist/commonjs/models/schemasprice.d.ts +5 -1
- package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
- package/dist/commonjs/models/schemasprice.js +1 -0
- package/dist/commonjs/models/schemasprice.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/invoicelineitem.d.ts +25 -0
- package/dist/esm/models/invoicelineitem.d.ts.map +1 -1
- package/dist/esm/models/invoicelineitem.js +14 -0
- package/dist/esm/models/invoicelineitem.js.map +1 -1
- package/dist/esm/models/lineitem.d.ts +3 -3
- package/dist/esm/models/lineitem.js +1 -1
- package/dist/esm/models/operations/createprice.d.ts +6 -1
- package/dist/esm/models/operations/createprice.d.ts.map +1 -1
- package/dist/esm/models/operations/createprice.js +1 -0
- package/dist/esm/models/operations/createprice.js.map +1 -1
- package/dist/esm/models/operations/updateprice.d.ts +6 -1
- package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
- package/dist/esm/models/operations/updateprice.js +1 -0
- package/dist/esm/models/operations/updateprice.js.map +1 -1
- package/dist/esm/models/planversionpriceslot.d.ts +4 -0
- package/dist/esm/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/esm/models/planversionpriceslot.js +1 -0
- package/dist/esm/models/planversionpriceslot.js.map +1 -1
- package/dist/esm/models/price.d.ts +4 -0
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +1 -0
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricemodel.d.ts +2 -2
- package/dist/esm/models/pricemodel.js +1 -1
- package/dist/esm/models/pricemodelinput.d.ts +3 -2
- package/dist/esm/models/pricemodelinput.d.ts.map +1 -1
- package/dist/esm/models/pricemodelinput.js +2 -1
- package/dist/esm/models/pricemodelinput.js.map +1 -1
- package/dist/esm/models/schemasprice.d.ts +5 -1
- package/dist/esm/models/schemasprice.d.ts.map +1 -1
- package/dist/esm/models/schemasprice.js +1 -0
- package/dist/esm/models/schemasprice.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/invoicelineitem.ts +36 -0
- package/src/models/lineitem.ts +3 -3
- package/src/models/operations/createprice.ts +7 -1
- package/src/models/operations/updateprice.ts +7 -1
- package/src/models/planversionpriceslot.ts +5 -0
- package/src/models/price.ts +5 -0
- package/src/models/pricemodel.ts +2 -2
- package/src/models/pricemodelinput.ts +3 -2
- package/src/models/schemasprice.ts +6 -1
|
@@ -21,6 +21,20 @@ export const EventType = {
|
|
|
21
21
|
*/
|
|
22
22
|
export type EventType = ClosedEnum<typeof EventType>;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* When this line falls due relative to the window it covers: `in_advance` at the window's start, `in_arrears` at its end. A metered line is stamped `in_arrears`, because usage is only known once the window closes — but metered rows written before that rule carry `null` and were never backfilled, so do not read a metered line's term as guaranteed. `null` also means the line is not billed on a term of its own: manual, grant-discount and adjustment lines carry no term, and an adjustment instead falls due with the charge it reduces. Treat `null` as an expected value on any line type, not an error.
|
|
26
|
+
*/
|
|
27
|
+
export const InvoiceLineItemPaymentTerm = {
|
|
28
|
+
InAdvance: "in_advance",
|
|
29
|
+
InArrears: "in_arrears",
|
|
30
|
+
} as const;
|
|
31
|
+
/**
|
|
32
|
+
* When this line falls due relative to the window it covers: `in_advance` at the window's start, `in_arrears` at its end. A metered line is stamped `in_arrears`, because usage is only known once the window closes — but metered rows written before that rule carry `null` and were never backfilled, so do not read a metered line's term as guaranteed. `null` also means the line is not billed on a term of its own: manual, grant-discount and adjustment lines carry no term, and an adjustment instead falls due with the charge it reduces. Treat `null` as an expected value on any line type, not an error.
|
|
33
|
+
*/
|
|
34
|
+
export type InvoiceLineItemPaymentTerm = ClosedEnum<
|
|
35
|
+
typeof InvoiceLineItemPaymentTerm
|
|
36
|
+
>;
|
|
37
|
+
|
|
24
38
|
/**
|
|
25
39
|
* Type of line item: 'charge' for regular billing, 'refund' for refunded items (amounts are negated)
|
|
26
40
|
*/
|
|
@@ -60,6 +74,18 @@ export type InvoiceLineItem = {
|
|
|
60
74
|
* The price this line was generated from, or `null` when the line has no originating charge. With `itemId` it says whether a missing tag is fixable: `priceId` set and `itemId` null means the charge was simply untagged, which tagging it and restamping resolves; both null means the line records a grant-credit purchase, which is deferred revenue and is never tagged. Any measure of outstanding mapping work must exclude the latter or it can never reach zero.
|
|
61
75
|
*/
|
|
62
76
|
priceId?: string | null | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Start of the billed window this line covers, inclusive. Distinct from the invoice's own period, which is the union of its lines' windows (earliest start to latest end) and so covers time no single line bills on a mixed-timing invoice.
|
|
79
|
+
*/
|
|
80
|
+
periodStart?: Date | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* End of the billed window this line covers, exclusive — the instant at `periodEnd` belongs to the next window. Equal to `periodStart` on a one-off charge, which bills at an instant and has no period grid.
|
|
83
|
+
*/
|
|
84
|
+
periodEnd?: Date | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* When this line falls due relative to the window it covers: `in_advance` at the window's start, `in_arrears` at its end. A metered line is stamped `in_arrears`, because usage is only known once the window closes — but metered rows written before that rule carry `null` and were never backfilled, so do not read a metered line's term as guaranteed. `null` also means the line is not billed on a term of its own: manual, grant-discount and adjustment lines carry no term, and an adjustment instead falls due with the charge it reduces. Treat `null` as an expected value on any line type, not an error.
|
|
87
|
+
*/
|
|
88
|
+
paymentTerm?: InvoiceLineItemPaymentTerm | null | undefined;
|
|
63
89
|
/**
|
|
64
90
|
* Display name for this line item on invoices
|
|
65
91
|
*/
|
|
@@ -114,6 +140,11 @@ export type InvoiceLineItem = {
|
|
|
114
140
|
export const EventType$inboundSchema: z.ZodNativeEnum<typeof EventType> = z
|
|
115
141
|
.nativeEnum(EventType);
|
|
116
142
|
|
|
143
|
+
/** @internal */
|
|
144
|
+
export const InvoiceLineItemPaymentTerm$inboundSchema: z.ZodNativeEnum<
|
|
145
|
+
typeof InvoiceLineItemPaymentTerm
|
|
146
|
+
> = z.nativeEnum(InvoiceLineItemPaymentTerm);
|
|
147
|
+
|
|
117
148
|
/** @internal */
|
|
118
149
|
export const InvoiceLineItemLineItemType$inboundSchema: z.ZodNativeEnum<
|
|
119
150
|
typeof InvoiceLineItemLineItemType
|
|
@@ -131,6 +162,11 @@ export const InvoiceLineItem$inboundSchema: z.ZodType<
|
|
|
131
162
|
billableMetricId: z.string(),
|
|
132
163
|
itemId: z.nullable(z.string()).optional(),
|
|
133
164
|
priceId: z.nullable(z.string()).optional(),
|
|
165
|
+
periodStart: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
166
|
+
.optional(),
|
|
167
|
+
periodEnd: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
168
|
+
.optional(),
|
|
169
|
+
paymentTerm: z.nullable(InvoiceLineItemPaymentTerm$inboundSchema).optional(),
|
|
134
170
|
invoiceDisplayName: z.string(),
|
|
135
171
|
lineItemType: InvoiceLineItemLineItemType$inboundSchema,
|
|
136
172
|
meterEventId: z.string(),
|
package/src/models/lineitem.ts
CHANGED
|
@@ -36,14 +36,14 @@ export const LineItemStatus = {
|
|
|
36
36
|
export type LineItemStatus = ClosedEnum<typeof LineItemStatus>;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* When the line falls due relative to the window it covers. A fee line carries its price's term; a metered line is stamped `in_arrears`, though metered rows predating that rule carry `null`. Manual, grant-discount and adjustment lines are billed on no term of their own and are `null`. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
40
40
|
*/
|
|
41
41
|
export const LineItemPaymentTerm = {
|
|
42
42
|
InAdvance: "in_advance",
|
|
43
43
|
InArrears: "in_arrears",
|
|
44
44
|
} as const;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* When the line falls due relative to the window it covers. A fee line carries its price's term; a metered line is stamped `in_arrears`, though metered rows predating that rule carry `null`. Manual, grant-discount and adjustment lines are billed on no term of their own and are `null`. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
47
47
|
*/
|
|
48
48
|
export type LineItemPaymentTerm = ClosedEnum<typeof LineItemPaymentTerm>;
|
|
49
49
|
|
|
@@ -121,7 +121,7 @@ export type LineItem = {
|
|
|
121
121
|
*/
|
|
122
122
|
meteredQuantity?: string | null | undefined;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* When the line falls due relative to the window it covers. A fee line carries its price's term; a metered line is stamped `in_arrears`, though metered rows predating that rule carry `null`. Manual, grant-discount and adjustment lines are billed on no term of their own and are `null`. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
125
125
|
*/
|
|
126
126
|
paymentTerm?: LineItemPaymentTerm | null | undefined;
|
|
127
127
|
/**
|
|
@@ -32,7 +32,7 @@ export type CreatePriceRequest = {
|
|
|
32
32
|
*/
|
|
33
33
|
pricingUnitId?: string | undefined;
|
|
34
34
|
/**
|
|
35
|
-
* Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard').
|
|
35
|
+
* Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard'). 'standard' and 'volume' are accepted; fees only support 'standard'. For percentage/revenue-share use 'standard' with a unit-price multiplier. Legacy prices using 'dynamic'/'percentage' stay readable and billable but cannot be created.
|
|
36
36
|
*/
|
|
37
37
|
model?: models.PriceModelInput | undefined;
|
|
38
38
|
/**
|
|
@@ -53,6 +53,10 @@ export type CreatePriceRequest = {
|
|
|
53
53
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
54
54
|
*/
|
|
55
55
|
grantDiscountEnabled?: boolean | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* 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.
|
|
58
|
+
*/
|
|
59
|
+
isObligation?: boolean | undefined;
|
|
56
60
|
/**
|
|
57
61
|
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
58
62
|
*/
|
|
@@ -76,6 +80,7 @@ export type CreatePriceRequest$Outbound = {
|
|
|
76
80
|
properties: models.PriceProperties$Outbound;
|
|
77
81
|
feature?: models.PriceFeatureInput$Outbound | undefined;
|
|
78
82
|
grantDiscountEnabled: boolean;
|
|
83
|
+
isObligation: boolean;
|
|
79
84
|
quantity?: number | undefined;
|
|
80
85
|
};
|
|
81
86
|
|
|
@@ -95,6 +100,7 @@ export const CreatePriceRequest$outboundSchema: z.ZodType<
|
|
|
95
100
|
properties: models.PriceProperties$outboundSchema,
|
|
96
101
|
feature: models.PriceFeatureInput$outboundSchema.optional(),
|
|
97
102
|
grantDiscountEnabled: z.boolean().default(false),
|
|
103
|
+
isObligation: z.boolean().default(false),
|
|
98
104
|
quantity: z.number().int().optional(),
|
|
99
105
|
});
|
|
100
106
|
|
|
@@ -36,7 +36,7 @@ export type UpdatePriceRequestBody = {
|
|
|
36
36
|
*/
|
|
37
37
|
invoiceDisplayName?: string | undefined;
|
|
38
38
|
/**
|
|
39
|
-
* The pricing model to set.
|
|
39
|
+
* The pricing model to set. 'standard' and 'volume' are accepted. Legacy 'dynamic'/'percentage' prices can still be edited (other fields) but cannot be switched back to those models. Percentage/revenue-share is expressed via 'standard' with a unit-price multiplier.
|
|
40
40
|
*/
|
|
41
41
|
model?: models.PriceModelInput | undefined;
|
|
42
42
|
properties?: models.PriceProperties | undefined;
|
|
@@ -56,6 +56,10 @@ export type UpdatePriceRequestBody = {
|
|
|
56
56
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
57
57
|
*/
|
|
58
58
|
grantDiscountEnabled?: boolean | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* 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.
|
|
61
|
+
*/
|
|
62
|
+
isObligation?: boolean | undefined;
|
|
59
63
|
/**
|
|
60
64
|
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
61
65
|
*/
|
|
@@ -92,6 +96,7 @@ export type UpdatePriceRequestBody$Outbound = {
|
|
|
92
96
|
billingCadence?: string | null | undefined;
|
|
93
97
|
feature?: models.PriceFeatureInput$Outbound | null | undefined;
|
|
94
98
|
grantDiscountEnabled?: boolean | undefined;
|
|
99
|
+
isObligation?: boolean | undefined;
|
|
95
100
|
quantity?: number | undefined;
|
|
96
101
|
};
|
|
97
102
|
|
|
@@ -110,6 +115,7 @@ export const UpdatePriceRequestBody$outboundSchema: z.ZodType<
|
|
|
110
115
|
billingCadence: z.nullable(z.string()).optional(),
|
|
111
116
|
feature: z.nullable(models.PriceFeatureInput$outboundSchema).optional(),
|
|
112
117
|
grantDiscountEnabled: z.boolean().optional(),
|
|
118
|
+
isObligation: z.boolean().optional(),
|
|
113
119
|
quantity: z.number().int().optional(),
|
|
114
120
|
});
|
|
115
121
|
|
|
@@ -73,6 +73,10 @@ export type PlanVersionPriceSlot = {
|
|
|
73
73
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
74
74
|
*/
|
|
75
75
|
grantDiscountEnabled: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 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.
|
|
78
|
+
*/
|
|
79
|
+
isObligation: boolean;
|
|
76
80
|
/**
|
|
77
81
|
* Quantity used when generating invoice line items for this price. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
78
82
|
*/
|
|
@@ -121,6 +125,7 @@ export const PlanVersionPriceSlot$inboundSchema: z.ZodType<
|
|
|
121
125
|
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
122
126
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
123
127
|
grantDiscountEnabled: z.boolean().default(false),
|
|
128
|
+
isObligation: z.boolean().default(false),
|
|
124
129
|
quantity: z.number().int().default(1),
|
|
125
130
|
priceDeleted: z.boolean(),
|
|
126
131
|
});
|
package/src/models/price.ts
CHANGED
|
@@ -64,6 +64,10 @@ export type Price = {
|
|
|
64
64
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
65
65
|
*/
|
|
66
66
|
grantDiscountEnabled: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 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.
|
|
69
|
+
*/
|
|
70
|
+
isObligation: boolean;
|
|
67
71
|
/**
|
|
68
72
|
* Quantity used when generating invoice line items for this price. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
69
73
|
*/
|
|
@@ -107,6 +111,7 @@ export const Price$inboundSchema: z.ZodType<Price, z.ZodTypeDef, unknown> = z
|
|
|
107
111
|
),
|
|
108
112
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
109
113
|
grantDiscountEnabled: z.boolean().default(false),
|
|
114
|
+
isObligation: z.boolean().default(false),
|
|
110
115
|
quantity: z.number().int().default(1),
|
|
111
116
|
});
|
|
112
117
|
|
package/src/models/pricemodel.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as openEnums from "../types/enums.js";
|
|
|
7
7
|
import { OpenEnum } from "../types/enums.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Pricing model of a price as returned by the API. Includes legacy models ('dynamic', '
|
|
10
|
+
* 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).
|
|
11
11
|
*/
|
|
12
12
|
export const PriceModel = {
|
|
13
13
|
Standard: "standard",
|
|
@@ -16,7 +16,7 @@ export const PriceModel = {
|
|
|
16
16
|
Percentage: "percentage",
|
|
17
17
|
} as const;
|
|
18
18
|
/**
|
|
19
|
-
* Pricing model of a price as returned by the API. Includes legacy models ('dynamic', '
|
|
19
|
+
* 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).
|
|
20
20
|
*/
|
|
21
21
|
export type PriceModel = OpenEnum<typeof PriceModel>;
|
|
22
22
|
|
|
@@ -6,13 +6,14 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { ClosedEnum } from "../types/enums.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Pricing model accepted when creating or updating a price.
|
|
9
|
+
* Pricing model accepted when creating or updating a price. 'standard' takes a single rate in properties.unitPrice; 'volume' takes a ladder of bands in properties.tiers. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic' and 'percentage' models remain billable and readable on existing prices but can no longer be created.
|
|
10
10
|
*/
|
|
11
11
|
export const PriceModelInput = {
|
|
12
12
|
Standard: "standard",
|
|
13
|
+
Volume: "volume",
|
|
13
14
|
} as const;
|
|
14
15
|
/**
|
|
15
|
-
* Pricing model accepted when creating or updating a price.
|
|
16
|
+
* Pricing model accepted when creating or updating a price. 'standard' takes a single rate in properties.unitPrice; 'volume' takes a ladder of bands in properties.tiers. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic' and 'percentage' models remain billable and readable on existing prices but can no longer be created.
|
|
16
17
|
*/
|
|
17
18
|
export type PriceModelInput = ClosedEnum<typeof PriceModelInput>;
|
|
18
19
|
|
|
@@ -56,7 +56,7 @@ export type SchemasPrice = {
|
|
|
56
56
|
createdAt: Date;
|
|
57
57
|
invoiceDisplayName: string;
|
|
58
58
|
/**
|
|
59
|
-
* Pricing model of a price as returned by the API. Includes legacy models ('dynamic', '
|
|
59
|
+
* 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
60
|
*/
|
|
61
61
|
model?: PriceModel | undefined;
|
|
62
62
|
paymentTerm: SchemasPricePaymentTerm;
|
|
@@ -70,6 +70,10 @@ export type SchemasPrice = {
|
|
|
70
70
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
71
71
|
*/
|
|
72
72
|
grantDiscountEnabled: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* 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
|
+
*/
|
|
76
|
+
isObligation: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
75
79
|
*/
|
|
@@ -107,6 +111,7 @@ export const SchemasPrice$inboundSchema: z.ZodType<
|
|
|
107
111
|
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
108
112
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
109
113
|
grantDiscountEnabled: z.boolean().default(false),
|
|
114
|
+
isObligation: z.boolean().default(false),
|
|
110
115
|
quantity: z.number().int(),
|
|
111
116
|
});
|
|
112
117
|
|