@paygentic/sdk 0.9.7 → 0.9.8
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/funcs/customersList.js +2 -2
- package/dist/commonjs/funcs/customersList.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +1 -1
- package/dist/commonjs/funcs/subscriptionsCreateSubscriptionAdjustment.js +1 -1
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js +2 -2
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/createpercentagediscountadjustment.d.ts +40 -0
- package/dist/commonjs/models/createpercentagediscountadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/createpercentagediscountadjustment.js +54 -0
- package/dist/commonjs/models/createpercentagediscountadjustment.js.map +1 -0
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts +5 -45
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js +7 -18
- package/dist/commonjs/models/createsubscriptionadjustmentrequest.js.map +1 -1
- package/dist/commonjs/models/createusagediscountadjustment.d.ts +45 -0
- package/dist/commonjs/models/createusagediscountadjustment.d.ts.map +1 -0
- package/dist/commonjs/models/createusagediscountadjustment.js +55 -0
- package/dist/commonjs/models/createusagediscountadjustment.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +4 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/lineitem.d.ts +4 -0
- package/dist/commonjs/models/lineitem.d.ts.map +1 -1
- package/dist/commonjs/models/lineitem.js +1 -0
- package/dist/commonjs/models/lineitem.js.map +1 -1
- package/dist/commonjs/models/operations/createprice.d.ts +15 -0
- package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createprice.js +3 -0
- package/dist/commonjs/models/operations/createprice.js.map +1 -1
- package/dist/commonjs/models/operations/updateprice.d.ts +15 -0
- package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateprice.js +3 -0
- package/dist/commonjs/models/operations/updateprice.js.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.d.ts +22 -0
- package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/commonjs/models/planversionpriceslot.js +13 -1
- package/dist/commonjs/models/planversionpriceslot.js.map +1 -1
- package/dist/commonjs/models/price.d.ts +22 -0
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +13 -1
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricetax.d.ts +58 -0
- package/dist/commonjs/models/pricetax.d.ts.map +1 -0
- package/dist/commonjs/models/pricetax.js +82 -0
- package/dist/commonjs/models/pricetax.js.map +1 -0
- package/dist/commonjs/models/ratetype.d.ts +18 -0
- package/dist/commonjs/models/ratetype.d.ts.map +1 -0
- package/dist/commonjs/models/ratetype.js +53 -0
- package/dist/commonjs/models/ratetype.js.map +1 -0
- package/dist/commonjs/models/schemasprice.d.ts +14 -0
- package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
- package/dist/commonjs/models/schemasprice.js +5 -0
- package/dist/commonjs/models/schemasprice.js.map +1 -1
- package/dist/commonjs/models/subscriptionadjustment.d.ts +14 -5
- package/dist/commonjs/models/subscriptionadjustment.d.ts.map +1 -1
- package/dist/commonjs/models/subscriptionadjustment.js +4 -1
- package/dist/commonjs/models/subscriptionadjustment.js.map +1 -1
- package/dist/commonjs/sdk/subscriptions.d.ts +1 -1
- package/dist/commonjs/sdk/subscriptions.js +1 -1
- package/dist/esm/funcs/customersList.js +2 -2
- package/dist/esm/funcs/customersList.js.map +1 -1
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.d.ts +1 -1
- package/dist/esm/funcs/subscriptionsCreateSubscriptionAdjustment.js +1 -1
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js +2 -2
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.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/createpercentagediscountadjustment.d.ts +40 -0
- package/dist/esm/models/createpercentagediscountadjustment.d.ts.map +1 -0
- package/dist/esm/models/createpercentagediscountadjustment.js +17 -0
- package/dist/esm/models/createpercentagediscountadjustment.js.map +1 -0
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts +5 -45
- package/dist/esm/models/createsubscriptionadjustmentrequest.d.ts.map +1 -1
- package/dist/esm/models/createsubscriptionadjustmentrequest.js +6 -17
- package/dist/esm/models/createsubscriptionadjustmentrequest.js.map +1 -1
- package/dist/esm/models/createusagediscountadjustment.d.ts +45 -0
- package/dist/esm/models/createusagediscountadjustment.d.ts.map +1 -0
- package/dist/esm/models/createusagediscountadjustment.js +18 -0
- package/dist/esm/models/createusagediscountadjustment.js.map +1 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/lineitem.d.ts +4 -0
- package/dist/esm/models/lineitem.d.ts.map +1 -1
- package/dist/esm/models/lineitem.js +1 -0
- package/dist/esm/models/lineitem.js.map +1 -1
- package/dist/esm/models/operations/createprice.d.ts +15 -0
- package/dist/esm/models/operations/createprice.d.ts.map +1 -1
- package/dist/esm/models/operations/createprice.js +3 -0
- package/dist/esm/models/operations/createprice.js.map +1 -1
- package/dist/esm/models/operations/updateprice.d.ts +15 -0
- package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
- package/dist/esm/models/operations/updateprice.js +3 -0
- package/dist/esm/models/operations/updateprice.js.map +1 -1
- package/dist/esm/models/planversionpriceslot.d.ts +22 -0
- package/dist/esm/models/planversionpriceslot.d.ts.map +1 -1
- package/dist/esm/models/planversionpriceslot.js +12 -0
- package/dist/esm/models/planversionpriceslot.js.map +1 -1
- package/dist/esm/models/price.d.ts +22 -0
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +12 -0
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricetax.d.ts +58 -0
- package/dist/esm/models/pricetax.d.ts.map +1 -0
- package/dist/esm/models/pricetax.js +44 -0
- package/dist/esm/models/pricetax.js.map +1 -0
- package/dist/esm/models/ratetype.d.ts +18 -0
- package/dist/esm/models/ratetype.d.ts.map +1 -0
- package/dist/esm/models/ratetype.js +17 -0
- package/dist/esm/models/ratetype.js.map +1 -0
- package/dist/esm/models/schemasprice.d.ts +14 -0
- package/dist/esm/models/schemasprice.d.ts.map +1 -1
- package/dist/esm/models/schemasprice.js +5 -0
- package/dist/esm/models/schemasprice.js.map +1 -1
- package/dist/esm/models/subscriptionadjustment.d.ts +14 -5
- package/dist/esm/models/subscriptionadjustment.d.ts.map +1 -1
- package/dist/esm/models/subscriptionadjustment.js +4 -1
- package/dist/esm/models/subscriptionadjustment.js.map +1 -1
- package/dist/esm/sdk/subscriptions.d.ts +1 -1
- package/dist/esm/sdk/subscriptions.js +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/customersList.ts +2 -2
- package/src/funcs/subscriptionsCreateSubscriptionAdjustment.ts +1 -1
- package/src/funcs/subscriptionsReconcileSubscriptionFeatures.ts +2 -2
- package/src/lib/config.ts +2 -2
- package/src/models/createpercentagediscountadjustment.ts +66 -0
- package/src/models/createsubscriptionadjustmentrequest.ts +21 -59
- package/src/models/createusagediscountadjustment.ts +72 -0
- package/src/models/index.ts +4 -0
- package/src/models/lineitem.ts +5 -0
- package/src/models/operations/createprice.ts +18 -0
- package/src/models/operations/updateprice.ts +18 -0
- package/src/models/planversionpriceslot.ts +30 -0
- package/src/models/price.ts +28 -0
- package/src/models/pricetax.ts +100 -0
- package/src/models/ratetype.ts +25 -0
- package/src/models/schemasprice.ts +17 -0
- package/src/models/subscriptionadjustment.ts +17 -6
- package/src/sdk/subscriptions.ts +1 -1
|
@@ -3,76 +3,38 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CreatePercentageDiscountAdjustment,
|
|
8
|
+
CreatePercentageDiscountAdjustment$Outbound,
|
|
9
|
+
CreatePercentageDiscountAdjustment$outboundSchema,
|
|
10
|
+
} from "./createpercentagediscountadjustment.js";
|
|
11
|
+
import {
|
|
12
|
+
CreateUsageDiscountAdjustment,
|
|
13
|
+
CreateUsageDiscountAdjustment$Outbound,
|
|
14
|
+
CreateUsageDiscountAdjustment$outboundSchema,
|
|
15
|
+
} from "./createusagediscountadjustment.js";
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
|
-
*
|
|
18
|
+
* One adjustment to attach to the subscription. The type decides which number the body carries: a rate for percentageDiscount, a unit count and one target price for usageDiscount.
|
|
10
19
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The kind of adjustment. `percentageDiscount` reduces every discountable charge by a rate.
|
|
16
|
-
*/
|
|
17
|
-
export type CreateSubscriptionAdjustmentRequestType = ClosedEnum<
|
|
18
|
-
typeof CreateSubscriptionAdjustmentRequestType
|
|
19
|
-
>;
|
|
20
|
-
|
|
21
|
-
export type CreateSubscriptionAdjustmentRequest = {
|
|
22
|
-
/**
|
|
23
|
-
* The kind of adjustment. `percentageDiscount` reduces every discountable charge by a rate.
|
|
24
|
-
*/
|
|
25
|
-
type: CreateSubscriptionAdjustmentRequestType;
|
|
26
|
-
/**
|
|
27
|
-
* The discount rate as a decimal fraction between 0 and 1, sent as a string. "0.35" means 35 percent. "1" means 100 percent, not 1 percent. At most 6 decimal places. A value of 0 or above 1 is rejected.
|
|
28
|
-
*/
|
|
29
|
-
percentageDiscount: string;
|
|
30
|
-
/**
|
|
31
|
-
* The first instant the discount applies. Inclusive.
|
|
32
|
-
*/
|
|
33
|
-
effectiveFrom: Date;
|
|
34
|
-
/**
|
|
35
|
-
* The instant the discount stops applying. Exclusive, so a window ending on the same date another begins neither overlaps nor leaves a gap. Null means the discount never stops, and it cannot be ended later — set an instant whenever the deal has a known end date. Must be after effectiveFrom.
|
|
36
|
-
*/
|
|
37
|
-
effectiveTo?: Date | null | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* The deal's own name, shown on each discount line of the invoice.
|
|
40
|
-
*/
|
|
41
|
-
description?: string | null | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* A key of your choosing that makes a retry safe. Sending the same key against the same subscription returns the adjustment already created and creates no second one. Without a key a retried request creates a second adjustment, and two percentage discounts compound — two of 0.35 bill 57.75 percent off, not 35 percent.
|
|
44
|
-
*/
|
|
45
|
-
idempotencyKey?: string | undefined;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/** @internal */
|
|
49
|
-
export const CreateSubscriptionAdjustmentRequestType$outboundSchema:
|
|
50
|
-
z.ZodNativeEnum<typeof CreateSubscriptionAdjustmentRequestType> = z
|
|
51
|
-
.nativeEnum(CreateSubscriptionAdjustmentRequestType);
|
|
20
|
+
export type CreateSubscriptionAdjustmentRequest =
|
|
21
|
+
| CreatePercentageDiscountAdjustment
|
|
22
|
+
| CreateUsageDiscountAdjustment;
|
|
52
23
|
|
|
53
24
|
/** @internal */
|
|
54
|
-
export type CreateSubscriptionAdjustmentRequest$Outbound =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
effectiveFrom: string;
|
|
58
|
-
effectiveTo?: string | null | undefined;
|
|
59
|
-
description?: string | null | undefined;
|
|
60
|
-
idempotencyKey?: string | undefined;
|
|
61
|
-
};
|
|
25
|
+
export type CreateSubscriptionAdjustmentRequest$Outbound =
|
|
26
|
+
| CreatePercentageDiscountAdjustment$Outbound
|
|
27
|
+
| CreateUsageDiscountAdjustment$Outbound;
|
|
62
28
|
|
|
63
29
|
/** @internal */
|
|
64
30
|
export const CreateSubscriptionAdjustmentRequest$outboundSchema: z.ZodType<
|
|
65
31
|
CreateSubscriptionAdjustmentRequest$Outbound,
|
|
66
32
|
z.ZodTypeDef,
|
|
67
33
|
CreateSubscriptionAdjustmentRequest
|
|
68
|
-
> = z.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
effectiveTo: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
73
|
-
description: z.nullable(z.string()).optional(),
|
|
74
|
-
idempotencyKey: z.string().optional(),
|
|
75
|
-
});
|
|
34
|
+
> = z.union([
|
|
35
|
+
CreatePercentageDiscountAdjustment$outboundSchema,
|
|
36
|
+
CreateUsageDiscountAdjustment$outboundSchema,
|
|
37
|
+
]);
|
|
76
38
|
|
|
77
39
|
export function createSubscriptionAdjustmentRequestToJSON(
|
|
78
40
|
createSubscriptionAdjustmentRequest: CreateSubscriptionAdjustmentRequest,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type CreateUsageDiscountAdjustment = {
|
|
8
|
+
/**
|
|
9
|
+
* Reduces one metered price's billable quantity by a number of usage units, before the line is priced.
|
|
10
|
+
*/
|
|
11
|
+
type: "usageDiscount";
|
|
12
|
+
/**
|
|
13
|
+
* The number of usage units to take off the billable quantity, sent as a plain decimal string. "300" waives 300 units. Greater than 0, at most 6 decimal places, fewer than 35 digits before the point. Plain notation only — no sign, exponent, hex or digit separators, so "1_000" and "1e3" are rejected rather than read as 1000. Applied in full or not at all — a unit count is never prorated across a partial window — and once per matching line, so an invoice bundling several periods is corrected on each of them. The line is floored at 0, so a discount larger than the billable quantity zeroes it rather than crediting.
|
|
14
|
+
*/
|
|
15
|
+
usageDiscount: string;
|
|
16
|
+
/**
|
|
17
|
+
* Exactly one metered price of this subscription, priced as standard or volume. Usage units are not comparable across metrics, so a usage discount names the one price it reduces. A dynamic or percentage price is refused: its quantity is a monetary amount rather than a unit count. A price billing at a negative rate (a usage-scaled rebate) is refused too, because removing its units would raise the invoice.
|
|
18
|
+
*/
|
|
19
|
+
targetPriceIds: Array<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Opens the window. Exclusive for this type: a metered line is corrected when its period END falls after this instant, so a window opening exactly when a period ends belongs to the next period, not that one. Set it to the start of the period you are correcting.
|
|
22
|
+
*/
|
|
23
|
+
effectiveFrom: Date;
|
|
24
|
+
/**
|
|
25
|
+
* Closes the window. INCLUSIVE for this type, unlike percentageDiscount: a metered line bills in arrears, so set this to the exact period end you are correcting and that period is covered. Null means the discount never stops — it then takes its full unit count off this price on EVERY later invoice, so set both bounds whenever you are correcting one period. Must be after effectiveFrom.
|
|
26
|
+
*/
|
|
27
|
+
effectiveTo?: Date | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Your own name for this correction. A usageDiscount emits no invoice line, so this is printed nowhere on the invoice — it is returned on the adjustment for your own records.
|
|
30
|
+
*/
|
|
31
|
+
description?: string | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* A key of your choosing that makes a retry safe. Sending the same key against the same subscription returns the adjustment already created and creates no second one. Without a key a retried request creates a second adjustment, and usage discounts against one price SUM — two of "300" waive 600 units, not 300. Nothing else detects a duplicate.
|
|
34
|
+
*/
|
|
35
|
+
idempotencyKey?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export type CreateUsageDiscountAdjustment$Outbound = {
|
|
40
|
+
type: "usageDiscount";
|
|
41
|
+
usageDiscount: string;
|
|
42
|
+
targetPriceIds: Array<string>;
|
|
43
|
+
effectiveFrom: string;
|
|
44
|
+
effectiveTo?: string | null | undefined;
|
|
45
|
+
description?: string | null | undefined;
|
|
46
|
+
idempotencyKey?: string | undefined;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const CreateUsageDiscountAdjustment$outboundSchema: z.ZodType<
|
|
51
|
+
CreateUsageDiscountAdjustment$Outbound,
|
|
52
|
+
z.ZodTypeDef,
|
|
53
|
+
CreateUsageDiscountAdjustment
|
|
54
|
+
> = z.object({
|
|
55
|
+
type: z.literal("usageDiscount"),
|
|
56
|
+
usageDiscount: z.string(),
|
|
57
|
+
targetPriceIds: z.array(z.string()),
|
|
58
|
+
effectiveFrom: z.date().transform(v => v.toISOString()),
|
|
59
|
+
effectiveTo: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
60
|
+
description: z.nullable(z.string()).optional(),
|
|
61
|
+
idempotencyKey: z.string().optional(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export function createUsageDiscountAdjustmentToJSON(
|
|
65
|
+
createUsageDiscountAdjustment: CreateUsageDiscountAdjustment,
|
|
66
|
+
): string {
|
|
67
|
+
return JSON.stringify(
|
|
68
|
+
CreateUsageDiscountAdjustment$outboundSchema.parse(
|
|
69
|
+
createUsageDiscountAdjustment,
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -21,8 +21,10 @@ export * from "./createmanuallineitemrequest.js";
|
|
|
21
21
|
export * from "./createorderapprovalrequest.js";
|
|
22
22
|
export * from "./createorderlineitemrequest.js";
|
|
23
23
|
export * from "./createorderrequest.js";
|
|
24
|
+
export * from "./createpercentagediscountadjustment.js";
|
|
24
25
|
export * from "./createrulerequest.js";
|
|
25
26
|
export * from "./createsubscriptionadjustmentrequest.js";
|
|
27
|
+
export * from "./createusagediscountadjustment.js";
|
|
26
28
|
export * from "./currencybreakdownentry.js";
|
|
27
29
|
export * from "./customer.js";
|
|
28
30
|
export * from "./entitlementdetail.js";
|
|
@@ -77,12 +79,14 @@ export * from "./pricefeatureinput.js";
|
|
|
77
79
|
export * from "./pricemodel.js";
|
|
78
80
|
export * from "./pricemodelinput.js";
|
|
79
81
|
export * from "./priceproperties.js";
|
|
82
|
+
export * from "./pricetax.js";
|
|
80
83
|
export * from "./product.js";
|
|
81
84
|
export * from "./profitabilityrow.js";
|
|
82
85
|
export * from "./profitabilitysummaryresponse.js";
|
|
83
86
|
export * from "./profitabilitytrend.js";
|
|
84
87
|
export * from "./purchasegrantrequest.js";
|
|
85
88
|
export * from "./purchasegrantresponse.js";
|
|
89
|
+
export * from "./ratetype.js";
|
|
86
90
|
export * from "./reconciledfeatureadded.js";
|
|
87
91
|
export * from "./reconciledfeaturefailed.js";
|
|
88
92
|
export * from "./reconciledfeatureremoved.js";
|
package/src/models/lineitem.ts
CHANGED
|
@@ -120,6 +120,10 @@ export type LineItem = {
|
|
|
120
120
|
* Raw metered usage. Null for fee/manual lines
|
|
121
121
|
*/
|
|
122
122
|
meteredQuantity?: string | null | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* The subscription adjustments of type `usageDiscount` that reduced this line's billable `quantity`. Empty for every other line. Where this is non-empty, `quantity` is below `meteredQuantity` because an operator waived units, rather than because a grant covered them.
|
|
125
|
+
*/
|
|
126
|
+
usageDiscountIds?: Array<string> | undefined;
|
|
123
127
|
/**
|
|
124
128
|
* 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
129
|
*/
|
|
@@ -196,6 +200,7 @@ export const LineItem$inboundSchema: z.ZodType<
|
|
|
196
200
|
quantity: z.nullable(z.string()).optional(),
|
|
197
201
|
unitPrice: z.string(),
|
|
198
202
|
meteredQuantity: z.nullable(z.string()).optional(),
|
|
203
|
+
usageDiscountIds: z.array(z.string()).optional(),
|
|
199
204
|
paymentTerm: z.nullable(LineItemPaymentTerm$inboundSchema).optional(),
|
|
200
205
|
subtotal: z.string().optional(),
|
|
201
206
|
taxesTotal: z.nullable(z.string()).optional(),
|
|
@@ -39,6 +39,10 @@ export type CreatePriceRequest = {
|
|
|
39
39
|
* Line item label shown on customer invoices. Sample values: 'Claude Token Consumption', 'Storage Usage (GB)', 'Inference API Calls', 'Image Generation Count', 'Training Compute Hours', 'Data Transfer (TB)'
|
|
40
40
|
*/
|
|
41
41
|
invoiceDisplayName: string;
|
|
42
|
+
/**
|
|
43
|
+
* 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'
|
|
44
|
+
*/
|
|
45
|
+
invoiceDisplayGroup?: string | null | undefined;
|
|
42
46
|
/**
|
|
43
47
|
* Billing timing preference: 'in_advance' (prepaid — charged upfront or drawn from a prepaid commitment) or 'in_arrears' (charged at period end).
|
|
44
48
|
*/
|
|
@@ -57,6 +61,14 @@ export type CreatePriceRequest = {
|
|
|
57
61
|
* 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
62
|
*/
|
|
59
63
|
isObligation?: boolean | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* 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.
|
|
66
|
+
*/
|
|
67
|
+
rateType?: models.RateType | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* 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.
|
|
70
|
+
*/
|
|
71
|
+
tax?: models.PriceTax | undefined;
|
|
60
72
|
/**
|
|
61
73
|
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
62
74
|
*/
|
|
@@ -75,12 +87,15 @@ export type CreatePriceRequest$Outbound = {
|
|
|
75
87
|
pricingUnitId?: string | undefined;
|
|
76
88
|
model?: string | undefined;
|
|
77
89
|
invoiceDisplayName: string;
|
|
90
|
+
invoiceDisplayGroup?: string | null | undefined;
|
|
78
91
|
paymentTerm: string;
|
|
79
92
|
billingCadence?: string | null | undefined;
|
|
80
93
|
properties: models.PriceProperties$Outbound;
|
|
81
94
|
feature?: models.PriceFeatureInput$Outbound | undefined;
|
|
82
95
|
grantDiscountEnabled: boolean;
|
|
83
96
|
isObligation: boolean;
|
|
97
|
+
rateType?: string | undefined;
|
|
98
|
+
tax?: models.PriceTax$Outbound | undefined;
|
|
84
99
|
quantity?: number | undefined;
|
|
85
100
|
};
|
|
86
101
|
|
|
@@ -95,12 +110,15 @@ export const CreatePriceRequest$outboundSchema: z.ZodType<
|
|
|
95
110
|
pricingUnitId: z.string().optional(),
|
|
96
111
|
model: models.PriceModelInput$outboundSchema.optional(),
|
|
97
112
|
invoiceDisplayName: z.string(),
|
|
113
|
+
invoiceDisplayGroup: z.nullable(z.string()).optional(),
|
|
98
114
|
paymentTerm: CreatePricePaymentTerm$outboundSchema,
|
|
99
115
|
billingCadence: z.nullable(z.string()).optional(),
|
|
100
116
|
properties: models.PriceProperties$outboundSchema,
|
|
101
117
|
feature: models.PriceFeatureInput$outboundSchema.optional(),
|
|
102
118
|
grantDiscountEnabled: z.boolean().default(false),
|
|
103
119
|
isObligation: z.boolean().default(false),
|
|
120
|
+
rateType: models.RateType$outboundSchema.optional(),
|
|
121
|
+
tax: models.PriceTax$outboundSchema.optional(),
|
|
104
122
|
quantity: z.number().int().optional(),
|
|
105
123
|
});
|
|
106
124
|
|
|
@@ -35,6 +35,10 @@ export type UpdatePriceRequestBody = {
|
|
|
35
35
|
* Updated invoice line item label. Sample values: 'LLM Token Usage', 'Storage Charges', 'API Call Fees'
|
|
36
36
|
*/
|
|
37
37
|
invoiceDisplayName?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* 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'
|
|
40
|
+
*/
|
|
41
|
+
invoiceDisplayGroup?: string | null | undefined;
|
|
38
42
|
/**
|
|
39
43
|
* 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
44
|
*/
|
|
@@ -60,6 +64,14 @@ export type UpdatePriceRequestBody = {
|
|
|
60
64
|
* 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
65
|
*/
|
|
62
66
|
isObligation?: boolean | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* 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.
|
|
69
|
+
*/
|
|
70
|
+
rateType?: models.RateType | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* 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.
|
|
73
|
+
*/
|
|
74
|
+
tax?: models.PriceTax | undefined;
|
|
63
75
|
/**
|
|
64
76
|
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
65
77
|
*/
|
|
@@ -90,6 +102,7 @@ export type UpdatePriceRequestBody$Outbound = {
|
|
|
90
102
|
billableMetricId?: string | undefined;
|
|
91
103
|
pricingUnitId?: string | null | undefined;
|
|
92
104
|
invoiceDisplayName?: string | undefined;
|
|
105
|
+
invoiceDisplayGroup?: string | null | undefined;
|
|
93
106
|
model?: string | undefined;
|
|
94
107
|
properties?: models.PriceProperties$Outbound | undefined;
|
|
95
108
|
paymentTerm?: string | undefined;
|
|
@@ -97,6 +110,8 @@ export type UpdatePriceRequestBody$Outbound = {
|
|
|
97
110
|
feature?: models.PriceFeatureInput$Outbound | null | undefined;
|
|
98
111
|
grantDiscountEnabled?: boolean | undefined;
|
|
99
112
|
isObligation?: boolean | undefined;
|
|
113
|
+
rateType?: string | undefined;
|
|
114
|
+
tax?: models.PriceTax$Outbound | undefined;
|
|
100
115
|
quantity?: number | undefined;
|
|
101
116
|
};
|
|
102
117
|
|
|
@@ -109,6 +124,7 @@ export const UpdatePriceRequestBody$outboundSchema: z.ZodType<
|
|
|
109
124
|
billableMetricId: z.string().optional(),
|
|
110
125
|
pricingUnitId: z.nullable(z.string()).optional(),
|
|
111
126
|
invoiceDisplayName: z.string().optional(),
|
|
127
|
+
invoiceDisplayGroup: z.nullable(z.string()).optional(),
|
|
112
128
|
model: models.PriceModelInput$outboundSchema.optional(),
|
|
113
129
|
properties: models.PriceProperties$outboundSchema.optional(),
|
|
114
130
|
paymentTerm: UpdatePricePaymentTerm$outboundSchema.optional(),
|
|
@@ -116,6 +132,8 @@ export const UpdatePriceRequestBody$outboundSchema: z.ZodType<
|
|
|
116
132
|
feature: z.nullable(models.PriceFeatureInput$outboundSchema).optional(),
|
|
117
133
|
grantDiscountEnabled: z.boolean().optional(),
|
|
118
134
|
isObligation: z.boolean().optional(),
|
|
135
|
+
rateType: models.RateType$outboundSchema.optional(),
|
|
136
|
+
tax: models.PriceTax$outboundSchema.optional(),
|
|
119
137
|
quantity: z.number().int().optional(),
|
|
120
138
|
});
|
|
121
139
|
|
|
@@ -8,6 +8,7 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
8
8
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
10
|
import { PriceFeature, PriceFeature$inboundSchema } from "./pricefeature.js";
|
|
11
|
+
import { PriceTax, PriceTax$inboundSchema } from "./pricetax.js";
|
|
11
12
|
|
|
12
13
|
export const PlanVersionPriceSlotObject = {
|
|
13
14
|
Price: "price",
|
|
@@ -34,6 +35,20 @@ export type PlanVersionPriceSlotPaymentTerm = ClosedEnum<
|
|
|
34
35
|
typeof PlanVersionPriceSlotPaymentTerm
|
|
35
36
|
>;
|
|
36
37
|
|
|
38
|
+
/**
|
|
39
|
+
* 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.
|
|
40
|
+
*/
|
|
41
|
+
export const PlanVersionPriceSlotRateType = {
|
|
42
|
+
Amount: "amount",
|
|
43
|
+
Proportion: "proportion",
|
|
44
|
+
} as const;
|
|
45
|
+
/**
|
|
46
|
+
* 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.
|
|
47
|
+
*/
|
|
48
|
+
export type PlanVersionPriceSlotRateType = ClosedEnum<
|
|
49
|
+
typeof PlanVersionPriceSlotRateType
|
|
50
|
+
>;
|
|
51
|
+
|
|
37
52
|
/**
|
|
38
53
|
* One price slot on a plan version. Every `Price` field is present, plus `priceDeleted` layered on top.
|
|
39
54
|
*/
|
|
@@ -77,6 +92,14 @@ export type PlanVersionPriceSlot = {
|
|
|
77
92
|
* 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
93
|
*/
|
|
79
94
|
isObligation: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* 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.
|
|
97
|
+
*/
|
|
98
|
+
rateType: PlanVersionPriceSlotRateType;
|
|
99
|
+
/**
|
|
100
|
+
* 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.
|
|
101
|
+
*/
|
|
102
|
+
tax: PriceTax;
|
|
80
103
|
/**
|
|
81
104
|
* 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.
|
|
82
105
|
*/
|
|
@@ -102,6 +125,11 @@ export const PlanVersionPriceSlotPaymentTerm$inboundSchema: z.ZodNativeEnum<
|
|
|
102
125
|
typeof PlanVersionPriceSlotPaymentTerm
|
|
103
126
|
> = z.nativeEnum(PlanVersionPriceSlotPaymentTerm);
|
|
104
127
|
|
|
128
|
+
/** @internal */
|
|
129
|
+
export const PlanVersionPriceSlotRateType$inboundSchema: z.ZodNativeEnum<
|
|
130
|
+
typeof PlanVersionPriceSlotRateType
|
|
131
|
+
> = z.nativeEnum(PlanVersionPriceSlotRateType);
|
|
132
|
+
|
|
105
133
|
/** @internal */
|
|
106
134
|
export const PlanVersionPriceSlot$inboundSchema: z.ZodType<
|
|
107
135
|
PlanVersionPriceSlot,
|
|
@@ -126,6 +154,8 @@ export const PlanVersionPriceSlot$inboundSchema: z.ZodType<
|
|
|
126
154
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
127
155
|
grantDiscountEnabled: z.boolean().default(false),
|
|
128
156
|
isObligation: z.boolean().default(false),
|
|
157
|
+
rateType: PlanVersionPriceSlotRateType$inboundSchema.default("amount"),
|
|
158
|
+
tax: PriceTax$inboundSchema,
|
|
129
159
|
quantity: z.number().int().default(1),
|
|
130
160
|
priceDeleted: z.boolean(),
|
|
131
161
|
});
|
package/src/models/price.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
8
8
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
10
|
import { PriceFeature, PriceFeature$inboundSchema } from "./pricefeature.js";
|
|
11
|
+
import { PriceTax, PriceTax$inboundSchema } from "./pricetax.js";
|
|
11
12
|
|
|
12
13
|
export const PriceObject = {
|
|
13
14
|
Price: "price",
|
|
@@ -28,6 +29,18 @@ export const PricePaymentTerm = {
|
|
|
28
29
|
} as const;
|
|
29
30
|
export type PricePaymentTerm = ClosedEnum<typeof PricePaymentTerm>;
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* 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.
|
|
34
|
+
*/
|
|
35
|
+
export const PriceRateType = {
|
|
36
|
+
Amount: "amount",
|
|
37
|
+
Proportion: "proportion",
|
|
38
|
+
} as const;
|
|
39
|
+
/**
|
|
40
|
+
* 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.
|
|
41
|
+
*/
|
|
42
|
+
export type PriceRateType = ClosedEnum<typeof PriceRateType>;
|
|
43
|
+
|
|
31
44
|
export type Price = {
|
|
32
45
|
/**
|
|
33
46
|
* Unique identifier for a price
|
|
@@ -68,6 +81,14 @@ export type Price = {
|
|
|
68
81
|
* 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
82
|
*/
|
|
70
83
|
isObligation: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 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.
|
|
86
|
+
*/
|
|
87
|
+
rateType: PriceRateType;
|
|
88
|
+
/**
|
|
89
|
+
* 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.
|
|
90
|
+
*/
|
|
91
|
+
tax: PriceTax;
|
|
71
92
|
/**
|
|
72
93
|
* 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.
|
|
73
94
|
*/
|
|
@@ -87,6 +108,11 @@ export const PricePaymentTerm$inboundSchema: z.ZodNativeEnum<
|
|
|
87
108
|
typeof PricePaymentTerm
|
|
88
109
|
> = z.nativeEnum(PricePaymentTerm);
|
|
89
110
|
|
|
111
|
+
/** @internal */
|
|
112
|
+
export const PriceRateType$inboundSchema: z.ZodNativeEnum<
|
|
113
|
+
typeof PriceRateType
|
|
114
|
+
> = z.nativeEnum(PriceRateType);
|
|
115
|
+
|
|
90
116
|
/** @internal */
|
|
91
117
|
export const Price$inboundSchema: z.ZodType<Price, z.ZodTypeDef, unknown> = z
|
|
92
118
|
.object({
|
|
@@ -112,6 +138,8 @@ export const Price$inboundSchema: z.ZodType<Price, z.ZodTypeDef, unknown> = z
|
|
|
112
138
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
113
139
|
grantDiscountEnabled: z.boolean().default(false),
|
|
114
140
|
isObligation: z.boolean().default(false),
|
|
141
|
+
rateType: PriceRateType$inboundSchema.default("amount"),
|
|
142
|
+
tax: PriceTax$inboundSchema,
|
|
115
143
|
quantity: z.number().int().default(1),
|
|
116
144
|
});
|
|
117
145
|
|
|
@@ -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
|
|