@tirdad/sdk 2.1.46 → 2.1.47

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 (92) hide show
  1. package/esm/funcs/events-get-usage-analytics.d.ts +5 -0
  2. package/esm/funcs/events-get-usage-analytics.d.ts.map +1 -1
  3. package/esm/funcs/events-get-usage-analytics.js +5 -0
  4. package/esm/funcs/events-get-usage-analytics.js.map +1 -1
  5. package/esm/funcs/prices-get-price-history.d.ts +17 -0
  6. package/esm/funcs/prices-get-price-history.d.ts.map +1 -0
  7. package/esm/funcs/prices-get-price-history.js +91 -0
  8. package/esm/funcs/prices-get-price-history.js.map +1 -0
  9. package/esm/funcs/subscriptions-get-subscription-line-item-history.d.ts +17 -0
  10. package/esm/funcs/subscriptions-get-subscription-line-item-history.d.ts.map +1 -0
  11. package/esm/funcs/subscriptions-get-subscription-line-item-history.js +91 -0
  12. package/esm/funcs/subscriptions-get-subscription-line-item-history.js.map +1 -0
  13. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.d.ts +17 -0
  14. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.d.ts.map +1 -0
  15. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.js +69 -0
  16. package/esm/funcs/webhook-events-post-webhook-events-payment-attempt-failed.js.map +1 -0
  17. package/esm/lib/config.d.ts +3 -3
  18. package/esm/lib/config.d.ts.map +1 -1
  19. package/esm/lib/config.js +10 -2
  20. package/esm/lib/config.js.map +1 -1
  21. package/esm/sdk/events.d.ts +5 -0
  22. package/esm/sdk/events.d.ts.map +1 -1
  23. package/esm/sdk/events.js +5 -0
  24. package/esm/sdk/events.js.map +1 -1
  25. package/esm/sdk/models/get-price-history-op.d.ts +15 -0
  26. package/esm/sdk/models/get-price-history-op.d.ts.map +1 -0
  27. package/esm/sdk/models/get-price-history-op.js +12 -0
  28. package/esm/sdk/models/get-price-history-op.js.map +1 -0
  29. package/esm/sdk/models/get-subscription-line-item-history-op.d.ts +15 -0
  30. package/esm/sdk/models/get-subscription-line-item-history-op.d.ts.map +1 -0
  31. package/esm/sdk/models/get-subscription-line-item-history-op.js +12 -0
  32. package/esm/sdk/models/get-subscription-line-item-history-op.js.map +1 -0
  33. package/esm/sdk/models/grouped-invoicing-child-request.d.ts +3 -0
  34. package/esm/sdk/models/grouped-invoicing-child-request.d.ts.map +1 -1
  35. package/esm/sdk/models/grouped-invoicing-child-request.js +3 -0
  36. package/esm/sdk/models/grouped-invoicing-child-request.js.map +1 -1
  37. package/esm/sdk/models/index.d.ts +4 -0
  38. package/esm/sdk/models/index.d.ts.map +1 -1
  39. package/esm/sdk/models/index.js +4 -0
  40. package/esm/sdk/models/index.js.map +1 -1
  41. package/esm/sdk/models/payment-attempt-response.d.ts +1 -0
  42. package/esm/sdk/models/payment-attempt-response.d.ts.map +1 -1
  43. package/esm/sdk/models/payment-attempt-response.js +2 -0
  44. package/esm/sdk/models/payment-attempt-response.js.map +1 -1
  45. package/esm/sdk/models/update-subscription-request.d.ts +3 -0
  46. package/esm/sdk/models/update-subscription-request.d.ts.map +1 -1
  47. package/esm/sdk/models/update-subscription-request.js +3 -0
  48. package/esm/sdk/models/update-subscription-request.js.map +1 -1
  49. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.d.ts +17 -0
  50. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.d.ts.map +1 -0
  51. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.js +27 -0
  52. package/esm/sdk/models/webhook-dto-payment-attempt-webhook-payload.js.map +1 -0
  53. package/esm/sdk/models/webhook-dto-payment-attempt.d.ts +17 -0
  54. package/esm/sdk/models/webhook-dto-payment-attempt.d.ts.map +1 -0
  55. package/esm/sdk/models/webhook-dto-payment-attempt.js +27 -0
  56. package/esm/sdk/models/webhook-dto-payment-attempt.js.map +1 -0
  57. package/esm/sdk/models/webhook-event-name.d.ts +1 -0
  58. package/esm/sdk/models/webhook-event-name.d.ts.map +1 -1
  59. package/esm/sdk/models/webhook-event-name.js +1 -0
  60. package/esm/sdk/models/webhook-event-name.js.map +1 -1
  61. package/esm/sdk/prices.d.ts +7 -0
  62. package/esm/sdk/prices.d.ts.map +1 -1
  63. package/esm/sdk/prices.js +10 -0
  64. package/esm/sdk/prices.js.map +1 -1
  65. package/esm/sdk/subscriptions.d.ts +7 -0
  66. package/esm/sdk/subscriptions.d.ts.map +1 -1
  67. package/esm/sdk/subscriptions.js +10 -0
  68. package/esm/sdk/subscriptions.js.map +1 -1
  69. package/esm/sdk/webhook-events.d.ts +7 -0
  70. package/esm/sdk/webhook-events.d.ts.map +1 -1
  71. package/esm/sdk/webhook-events.js +10 -0
  72. package/esm/sdk/webhook-events.js.map +1 -1
  73. package/jsr.json +1 -1
  74. package/package.json +1 -1
  75. package/src/funcs/events-get-usage-analytics.ts +5 -0
  76. package/src/funcs/prices-get-price-history.ts +181 -0
  77. package/src/funcs/subscriptions-get-subscription-line-item-history.ts +185 -0
  78. package/src/funcs/webhook-events-post-webhook-events-payment-attempt-failed.ts +144 -0
  79. package/src/lib/config.ts +10 -2
  80. package/src/sdk/events.ts +5 -0
  81. package/src/sdk/models/get-price-history-op.ts +33 -0
  82. package/src/sdk/models/get-subscription-line-item-history-op.ts +36 -0
  83. package/src/sdk/models/grouped-invoicing-child-request.ts +8 -0
  84. package/src/sdk/models/index.ts +4 -0
  85. package/src/sdk/models/payment-attempt-response.ts +3 -0
  86. package/src/sdk/models/update-subscription-request.ts +8 -0
  87. package/src/sdk/models/webhook-dto-payment-attempt-webhook-payload.ts +61 -0
  88. package/src/sdk/models/webhook-dto-payment-attempt.ts +52 -0
  89. package/src/sdk/models/webhook-event-name.ts +1 -0
  90. package/src/sdk/prices.ts +18 -0
  91. package/src/sdk/subscriptions.ts +18 -0
  92. package/src/sdk/webhook-events.ts +16 -0
@@ -0,0 +1,185 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { TirdadCore } from "../core.js";
7
+ import { encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
14
+ import { pathToFunc } from "../lib/url.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../sdk/models/http-client-errors.js";
22
+ import * as models from "../sdk/models/index.js";
23
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
24
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
25
+ import { TirdadError } from "../sdk/models/tirdad-error.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get subscription line item history
31
+ *
32
+ * @remarks
33
+ * Use when you need every version of a subscription line item, oldest first. Pass the ID of any version; the same timeline is returned. Versions cancelled before they started are left out unless requested directly.
34
+ */
35
+ export function subscriptionsGetSubscriptionLineItemHistory(
36
+ client: TirdadCore,
37
+ id: string,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ models.ListSubscriptionLineItemsResponse,
42
+ | models.ErrorsErrorResponse
43
+ | TirdadError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ id,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: TirdadCore,
62
+ id: string,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ models.ListSubscriptionLineItemsResponse,
68
+ | models.ErrorsErrorResponse
69
+ | TirdadError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const input: models.GetSubscriptionLineItemHistoryRequest = {
82
+ id: id,
83
+ };
84
+
85
+ const parsed = safeParse(
86
+ input,
87
+ (value) =>
88
+ z.parse(
89
+ models.GetSubscriptionLineItemHistoryRequest$outboundSchema,
90
+ value,
91
+ ),
92
+ "Input validation failed",
93
+ );
94
+ if (!parsed.ok) {
95
+ return [parsed, { status: "invalid" }];
96
+ }
97
+ const payload = parsed.value;
98
+ const body = null;
99
+
100
+ const pathParams = {
101
+ id: encodeSimple("id", payload.id, {
102
+ explode: false,
103
+ charEncoding: "percent",
104
+ }),
105
+ };
106
+ const path = pathToFunc("/subscriptions/lineitems/{id}/history")(pathParams);
107
+
108
+ const headers = new Headers(compactMap({
109
+ Accept: "application/json",
110
+ }));
111
+
112
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
113
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
114
+ const requestSecurity = resolveGlobalSecurity(securityInput);
115
+
116
+ const context = {
117
+ options: client._options,
118
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
119
+ operationID: "getSubscriptionLineItemHistory",
120
+ oAuth2Scopes: null,
121
+
122
+ resolvedSecurity: requestSecurity,
123
+
124
+ securitySource: client._options.apiKeyAuth,
125
+ retryConfig: options?.retries
126
+ || client._options.retryConfig
127
+ || { strategy: "none" },
128
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
129
+ };
130
+
131
+ const requestRes = client._createRequest(context, {
132
+ security: requestSecurity,
133
+ method: "GET",
134
+ baseURL: options?.serverURL,
135
+ path: path,
136
+ headers: headers,
137
+ body: body,
138
+ userAgent: client._options.userAgent,
139
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
140
+ }, options);
141
+ if (!requestRes.ok) {
142
+ return [requestRes, { status: "invalid" }];
143
+ }
144
+ const req = requestRes.value;
145
+
146
+ const doResult = await client._do(req, {
147
+ context,
148
+ isErrorStatusCode: (statusCode: number) =>
149
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
150
+ retryConfig: context.retryConfig,
151
+ retryCodes: context.retryCodes,
152
+ });
153
+ if (!doResult.ok) {
154
+ return [doResult, { status: "request-error", request: req }];
155
+ }
156
+ const response = doResult.value;
157
+
158
+ const responseFields = {
159
+ HttpMeta: { Response: response, Request: req },
160
+ };
161
+
162
+ const [result] = await M.match<
163
+ models.ListSubscriptionLineItemsResponse,
164
+ | models.ErrorsErrorResponse
165
+ | TirdadError
166
+ | ResponseValidationError
167
+ | ConnectionError
168
+ | RequestAbortedError
169
+ | RequestTimeoutError
170
+ | InvalidRequestError
171
+ | UnexpectedClientError
172
+ | SDKValidationError
173
+ >(
174
+ M.json(200, models.ListSubscriptionLineItemsResponse$inboundSchema),
175
+ M.jsonErr([400, 404], models.ErrorsErrorResponse$inboundSchema),
176
+ M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
177
+ M.fail("4XX"),
178
+ M.fail("5XX"),
179
+ )(response, req, { extraFields: responseFields });
180
+ if (!result.ok) {
181
+ return [result, { status: "complete", request: req, response }];
182
+ }
183
+
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { TirdadCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../sdk/models/http-client-errors.js";
19
+ import * as models from "../sdk/models/index.js";
20
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
21
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
22
+ import { TirdadError } from "../sdk/models/tirdad-error.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * payment.attempt.failed
28
+ *
29
+ * @remarks
30
+ * Fired when one charge attempt is declined and the payment stays open for retry. Doc-only for parsing.
31
+ */
32
+ export function webhookEventsPostWebhookEventsPaymentAttemptFailed(
33
+ client: TirdadCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ models.WebhookDtoPaymentAttemptWebhookPayload,
38
+ | TirdadError
39
+ | ResponseValidationError
40
+ | ConnectionError
41
+ | RequestAbortedError
42
+ | RequestTimeoutError
43
+ | InvalidRequestError
44
+ | UnexpectedClientError
45
+ | SDKValidationError
46
+ >
47
+ > {
48
+ return new APIPromise($do(
49
+ client,
50
+ options,
51
+ ));
52
+ }
53
+
54
+ async function $do(
55
+ client: TirdadCore,
56
+ options?: RequestOptions,
57
+ ): Promise<
58
+ [
59
+ Result<
60
+ models.WebhookDtoPaymentAttemptWebhookPayload,
61
+ | TirdadError
62
+ | ResponseValidationError
63
+ | ConnectionError
64
+ | RequestAbortedError
65
+ | RequestTimeoutError
66
+ | InvalidRequestError
67
+ | UnexpectedClientError
68
+ | SDKValidationError
69
+ >,
70
+ APICall,
71
+ ]
72
+ > {
73
+ const path = pathToFunc("/webhook-events/payment.attempt.failed")();
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
80
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ options: client._options,
85
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
86
+ operationID: "post_/webhook-events/payment.attempt.failed",
87
+ oAuth2Scopes: null,
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.apiKeyAuth,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || { strategy: "none" },
95
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
96
+ };
97
+
98
+ const requestRes = client._createRequest(context, {
99
+ security: requestSecurity,
100
+ method: "POST",
101
+ baseURL: options?.serverURL,
102
+ path: path,
103
+ headers: headers,
104
+ userAgent: client._options.userAgent,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return [requestRes, { status: "invalid" }];
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ isErrorStatusCode: (statusCode: number) =>
115
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
116
+ retryConfig: context.retryConfig,
117
+ retryCodes: context.retryCodes,
118
+ });
119
+ if (!doResult.ok) {
120
+ return [doResult, { status: "request-error", request: req }];
121
+ }
122
+ const response = doResult.value;
123
+
124
+ const [result] = await M.match<
125
+ models.WebhookDtoPaymentAttemptWebhookPayload,
126
+ | TirdadError
127
+ | ResponseValidationError
128
+ | ConnectionError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | InvalidRequestError
132
+ | UnexpectedClientError
133
+ | SDKValidationError
134
+ >(
135
+ M.json(200, models.WebhookDtoPaymentAttemptWebhookPayload$inboundSchema),
136
+ M.fail("4XX"),
137
+ M.fail("5XX"),
138
+ )(response, req);
139
+ if (!result.ok) {
140
+ return [result, { status: "complete", request: req, response }];
141
+ }
142
+
143
+ return [result, { status: "complete", request: req, response }];
144
+ }
package/src/lib/config.ts CHANGED
@@ -19,6 +19,14 @@ export const ServerList = [
19
19
  * India Region
20
20
  */
21
21
  "https://api.cloud.flexprice.io/v1",
22
+ /**
23
+ * Canada Region
24
+ */
25
+ "https://canada.api.flexprice.io/v1",
26
+ /**
27
+ * EU Region
28
+ */
29
+ "https://eu.api.flexprice.io/v1",
22
30
  ] as const;
23
31
 
24
32
  export type SDKOptions = {
@@ -69,7 +77,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
69
77
  export const SDK_METADATA = {
70
78
  language: "typescript",
71
79
  openapiDocVersion: "1.0",
72
- sdkVersion: "2.1.46",
80
+ sdkVersion: "2.1.47",
73
81
  genVersion: "2.948.4",
74
- userAgent: "speakeasy-sdk/typescript 2.1.46 2.948.4 1.0 @tirdad/sdk",
82
+ userAgent: "speakeasy-sdk/typescript 2.1.47 2.948.4 1.0 @tirdad/sdk",
75
83
  } as const;
package/src/sdk/events.ts CHANGED
@@ -37,6 +37,11 @@ export class Events extends ClientSDK {
37
37
  *
38
38
  * @remarks
39
39
  * Use when building analytics views (e.g. usage by feature or customer over time). Supports filtering, grouping, and time-series breakdown.
40
+ * Groups and regular-meter time-series points contain usage-proportional cost allocations, not independently priced charges.
41
+ * Source/property filters return the unfiltered usage charge for the same time range multiplied by filtered quantity / full quantity; groups split that filtered share. Filtered costs exclude commitments and true-up.
42
+ * When full quantity is zero, no proportional rate is defined; costs retain direct per-group/per-bucket pricing.
43
+ * Analytics are eventually consistent: concurrent ingestion or late events can make filtered allocations approximate across separate reads. These allocations are not an invoice preview.
44
+ * For non-additive meters such as MAX, quantities use the meter's aggregation, so individual group shares can change when filtering or grouping changes.
40
45
  */
41
46
  async getUsageAnalytics(
42
47
  request: models.GetUsageAnalyticsRequest,
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+
7
+ export type GetPriceHistoryRequest = {
8
+ /**
9
+ * Price ID
10
+ */
11
+ id: string;
12
+ };
13
+
14
+ /** @internal */
15
+ export type GetPriceHistoryRequest$Outbound = {
16
+ id: string;
17
+ };
18
+
19
+ /** @internal */
20
+ export const GetPriceHistoryRequest$outboundSchema: z.ZodMiniType<
21
+ GetPriceHistoryRequest$Outbound,
22
+ GetPriceHistoryRequest
23
+ > = z.object({
24
+ id: z.string(),
25
+ });
26
+
27
+ export function getPriceHistoryRequestToJSON(
28
+ getPriceHistoryRequest: GetPriceHistoryRequest,
29
+ ): string {
30
+ return JSON.stringify(
31
+ GetPriceHistoryRequest$outboundSchema.parse(getPriceHistoryRequest),
32
+ );
33
+ }
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+
7
+ export type GetSubscriptionLineItemHistoryRequest = {
8
+ /**
9
+ * Line item ID
10
+ */
11
+ id: string;
12
+ };
13
+
14
+ /** @internal */
15
+ export type GetSubscriptionLineItemHistoryRequest$Outbound = {
16
+ id: string;
17
+ };
18
+
19
+ /** @internal */
20
+ export const GetSubscriptionLineItemHistoryRequest$outboundSchema:
21
+ z.ZodMiniType<
22
+ GetSubscriptionLineItemHistoryRequest$Outbound,
23
+ GetSubscriptionLineItemHistoryRequest
24
+ > = z.object({
25
+ id: z.string(),
26
+ });
27
+
28
+ export function getSubscriptionLineItemHistoryRequestToJSON(
29
+ getSubscriptionLineItemHistoryRequest: GetSubscriptionLineItemHistoryRequest,
30
+ ): string {
31
+ return JSON.stringify(
32
+ GetSubscriptionLineItemHistoryRequest$outboundSchema.parse(
33
+ getSubscriptionLineItemHistoryRequest,
34
+ ),
35
+ );
36
+ }
@@ -43,6 +43,10 @@ import {
43
43
  OverrideLineItemRequest$Outbound,
44
44
  OverrideLineItemRequest$outboundSchema,
45
45
  } from "./override-line-item-request.js";
46
+ import {
47
+ ProrationBehavior,
48
+ ProrationBehavior$outboundSchema,
49
+ } from "./proration-behavior.js";
46
50
  import {
47
51
  SubscriptionCouponInput,
48
52
  SubscriptionCouponInput$Outbound,
@@ -90,6 +94,7 @@ export type GroupedInvoicingChildRequest = {
90
94
  overrideLineItems?: Array<OverrideLineItemRequest> | undefined;
91
95
  phases?: Array<SubscriptionPhaseCreateRequest> | undefined;
92
96
  planId: string;
97
+ prorationBehavior?: ProrationBehavior | undefined;
93
98
  /**
94
99
  * SubscriptionCoupons is the preferred way to attach coupons at creation.
95
100
  *
@@ -131,6 +136,7 @@ export type GroupedInvoicingChildRequest$Outbound = {
131
136
  override_line_items?: Array<OverrideLineItemRequest$Outbound> | undefined;
132
137
  phases?: Array<SubscriptionPhaseCreateRequest$Outbound> | undefined;
133
138
  plan_id: string;
139
+ proration_behavior?: string | undefined;
134
140
  subscription_coupons?: Array<SubscriptionCouponInput$Outbound> | undefined;
135
141
  subscription_entitlement_grants?:
136
142
  | Array<CreateSubscriptionEntitlementGrantRequest$Outbound>
@@ -168,6 +174,7 @@ export const GroupedInvoicingChildRequest$outboundSchema: z.ZodMiniType<
168
174
  ),
169
175
  phases: z.optional(z.array(SubscriptionPhaseCreateRequest$outboundSchema)),
170
176
  planId: z.string(),
177
+ prorationBehavior: z.optional(ProrationBehavior$outboundSchema),
171
178
  subscriptionCoupons: z.optional(
172
179
  z.array(SubscriptionCouponInput$outboundSchema),
173
180
  ),
@@ -191,6 +198,7 @@ export const GroupedInvoicingChildRequest$outboundSchema: z.ZodMiniType<
191
198
  overrideEntitlements: "override_entitlements",
192
199
  overrideLineItems: "override_line_items",
193
200
  planId: "plan_id",
201
+ prorationBehavior: "proration_behavior",
194
202
  subscriptionCoupons: "subscription_coupons",
195
203
  subscriptionEntitlementGrants: "subscription_entitlement_grants",
196
204
  taxRateOverrides: "tax_rate_overrides",
@@ -355,6 +355,7 @@ export * from "./get-plan-entitlements-op.js";
355
355
  export * from "./get-plan-op.js";
356
356
  export * from "./get-preview-invoice-request.js";
357
357
  export * from "./get-price-by-lookup-key-op.js";
358
+ export * from "./get-price-history-op.js";
358
359
  export * from "./get-price-op.js";
359
360
  export * from "./get-price-unit-by-code-op.js";
360
361
  export * from "./get-price-unit-op.js";
@@ -364,6 +365,7 @@ export * from "./get-refund-op.js";
364
365
  export * from "./get-scheduled-task-op.js";
365
366
  export * from "./get-subscription-addon-associations-op.js";
366
367
  export * from "./get-subscription-entitlements-op.js";
368
+ export * from "./get-subscription-line-item-history-op.js";
367
369
  export * from "./get-subscription-op.js";
368
370
  export * from "./get-subscription-schedule-op.js";
369
371
  export * from "./get-subscription-upcoming-grants-op.js";
@@ -861,6 +863,8 @@ export * from "./webhook-dto-invoice-sync-webhook-payload.js";
861
863
  export * from "./webhook-dto-invoice-webhook-payload.js";
862
864
  export * from "./webhook-dto-invoice.js";
863
865
  export * from "./webhook-dto-meter.js";
866
+ export * from "./webhook-dto-payment-attempt-webhook-payload.js";
867
+ export * from "./webhook-dto-payment-attempt.js";
864
868
  export * from "./webhook-dto-payment-webhook-payload.js";
865
869
  export * from "./webhook-dto-payment.js";
866
870
  export * from "./webhook-dto-plan.js";
@@ -14,6 +14,7 @@ export type PaymentAttemptResponse = {
14
14
  createdAt?: Date | undefined;
15
15
  createdBy?: string | undefined;
16
16
  errorMessage?: string | undefined;
17
+ gatewayAttemptId?: string | undefined;
17
18
  id?: string | undefined;
18
19
  metadata?: { [k: string]: string } | undefined;
19
20
  paymentId?: string | undefined;
@@ -32,6 +33,7 @@ export const PaymentAttemptResponse$inboundSchema: z.ZodMiniType<
32
33
  created_at: types.optional(types.date()),
33
34
  created_by: types.optional(types.string()),
34
35
  error_message: types.optional(types.string()),
36
+ gateway_attempt_id: types.optional(types.string()),
35
37
  id: types.optional(types.string()),
36
38
  metadata: types.optional(z.record(z.string(), types.string())),
37
39
  payment_id: types.optional(types.string()),
@@ -45,6 +47,7 @@ export const PaymentAttemptResponse$inboundSchema: z.ZodMiniType<
45
47
  "created_at": "createdAt",
46
48
  "created_by": "createdBy",
47
49
  "error_message": "errorMessage",
50
+ "gateway_attempt_id": "gatewayAttemptId",
48
51
  "payment_id": "paymentId",
49
52
  "tenant_id": "tenantId",
50
53
  "updated_at": "updatedAt",
@@ -4,6 +4,10 @@
4
4
 
5
5
  import * as z from "zod/v4-mini";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
+ import {
8
+ ProrationBehavior,
9
+ ProrationBehavior$outboundSchema,
10
+ } from "./proration-behavior.js";
7
11
  import {
8
12
  SubscriptionStatus,
9
13
  SubscriptionStatus$outboundSchema,
@@ -19,6 +23,7 @@ export type UpdateSubscriptionRequest = {
19
23
  * ParentSubscriptionID sets or clears the parent subscription. Omit to leave unchanged; send "" to clear.
20
24
  */
21
25
  parentSubscriptionId?: string | undefined;
26
+ prorationBehavior?: ProrationBehavior | undefined;
22
27
  status?: SubscriptionStatus | undefined;
23
28
  };
24
29
 
@@ -27,6 +32,7 @@ export type UpdateSubscriptionRequest$Outbound = {
27
32
  cancel_at?: string | undefined;
28
33
  cancel_at_period_end?: boolean | undefined;
29
34
  parent_subscription_id?: string | undefined;
35
+ proration_behavior?: string | undefined;
30
36
  status?: string | undefined;
31
37
  };
32
38
 
@@ -39,6 +45,7 @@ export const UpdateSubscriptionRequest$outboundSchema: z.ZodMiniType<
39
45
  cancelAt: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
40
46
  cancelAtPeriodEnd: z.optional(z.boolean()),
41
47
  parentSubscriptionId: z.optional(z.string()),
48
+ prorationBehavior: z.optional(ProrationBehavior$outboundSchema),
42
49
  status: z.optional(SubscriptionStatus$outboundSchema),
43
50
  }),
44
51
  z.transform((v) => {
@@ -46,6 +53,7 @@ export const UpdateSubscriptionRequest$outboundSchema: z.ZodMiniType<
46
53
  cancelAt: "cancel_at",
47
54
  cancelAtPeriodEnd: "cancel_at_period_end",
48
55
  parentSubscriptionId: "parent_subscription_id",
56
+ prorationBehavior: "proration_behavior",
49
57
  });
50
58
  }),
51
59
  );
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+ import {
12
+ WebhookDtoCheckoutSession,
13
+ WebhookDtoCheckoutSession$inboundSchema,
14
+ } from "./webhook-dto-checkout-session.js";
15
+ import {
16
+ WebhookDtoPaymentAttempt,
17
+ WebhookDtoPaymentAttempt$inboundSchema,
18
+ } from "./webhook-dto-payment-attempt.js";
19
+ import {
20
+ WebhookDtoPayment,
21
+ WebhookDtoPayment$inboundSchema,
22
+ } from "./webhook-dto-payment.js";
23
+ import {
24
+ WebhookEventName,
25
+ WebhookEventName$inboundSchema,
26
+ } from "./webhook-event-name.js";
27
+
28
+ export type WebhookDtoPaymentAttemptWebhookPayload = {
29
+ attempt?: WebhookDtoPaymentAttempt | undefined;
30
+ checkoutSession?: WebhookDtoCheckoutSession | undefined;
31
+ eventType?: WebhookEventName | undefined;
32
+ payment?: WebhookDtoPayment | undefined;
33
+ };
34
+
35
+ /** @internal */
36
+ export const WebhookDtoPaymentAttemptWebhookPayload$inboundSchema:
37
+ z.ZodMiniType<WebhookDtoPaymentAttemptWebhookPayload, unknown> = z.pipe(
38
+ z.object({
39
+ attempt: types.optional(WebhookDtoPaymentAttempt$inboundSchema),
40
+ checkout_session: types.optional(WebhookDtoCheckoutSession$inboundSchema),
41
+ event_type: types.optional(WebhookEventName$inboundSchema),
42
+ payment: types.optional(WebhookDtoPayment$inboundSchema),
43
+ }),
44
+ z.transform((v) => {
45
+ return remap$(v, {
46
+ "checkout_session": "checkoutSession",
47
+ "event_type": "eventType",
48
+ });
49
+ }),
50
+ );
51
+
52
+ export function webhookDtoPaymentAttemptWebhookPayloadFromJSON(
53
+ jsonString: string,
54
+ ): SafeParseResult<WebhookDtoPaymentAttemptWebhookPayload, SDKValidationError> {
55
+ return safeParse(
56
+ jsonString,
57
+ (x) =>
58
+ WebhookDtoPaymentAttemptWebhookPayload$inboundSchema.parse(JSON.parse(x)),
59
+ `Failed to parse 'WebhookDtoPaymentAttemptWebhookPayload' from JSON`,
60
+ );
61
+ }
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+
12
+ export type WebhookDtoPaymentAttempt = {
13
+ attemptNumber?: number | undefined;
14
+ createdAt?: Date | undefined;
15
+ errorMessage?: string | undefined;
16
+ gatewayAttemptId?: string | undefined;
17
+ id?: string | undefined;
18
+ metadata?: { [k: string]: string } | undefined;
19
+ };
20
+
21
+ /** @internal */
22
+ export const WebhookDtoPaymentAttempt$inboundSchema: z.ZodMiniType<
23
+ WebhookDtoPaymentAttempt,
24
+ unknown
25
+ > = z.pipe(
26
+ z.object({
27
+ attempt_number: types.optional(types.number()),
28
+ created_at: types.optional(types.date()),
29
+ error_message: types.optional(types.string()),
30
+ gateway_attempt_id: types.optional(types.string()),
31
+ id: types.optional(types.string()),
32
+ metadata: types.optional(z.record(z.string(), types.string())),
33
+ }),
34
+ z.transform((v) => {
35
+ return remap$(v, {
36
+ "attempt_number": "attemptNumber",
37
+ "created_at": "createdAt",
38
+ "error_message": "errorMessage",
39
+ "gateway_attempt_id": "gatewayAttemptId",
40
+ });
41
+ }),
42
+ );
43
+
44
+ export function webhookDtoPaymentAttemptFromJSON(
45
+ jsonString: string,
46
+ ): SafeParseResult<WebhookDtoPaymentAttempt, SDKValidationError> {
47
+ return safeParse(
48
+ jsonString,
49
+ (x) => WebhookDtoPaymentAttempt$inboundSchema.parse(JSON.parse(x)),
50
+ `Failed to parse 'WebhookDtoPaymentAttempt' from JSON`,
51
+ );
52
+ }