@paid-ai/paid-node 1.0.1-alpha0 → 1.0.1-alpha1

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 (56) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/plans/client/Client.d.ts +12 -0
  3. package/dist/cjs/api/resources/plans/client/Client.js +62 -2
  4. package/dist/cjs/api/resources/usage/client/Client.d.ts +3 -3
  5. package/dist/cjs/api/resources/usage/client/Client.js +3 -3
  6. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.ts +3 -3
  7. package/dist/cjs/api/types/PlanWithFeatures.d.ts +34 -0
  8. package/dist/cjs/api/types/PlanWithFeatures.js +3 -0
  9. package/dist/cjs/api/types/SignalV2.d.ts +5 -5
  10. package/dist/cjs/api/types/index.d.ts +1 -0
  11. package/dist/cjs/api/types/index.js +1 -0
  12. package/dist/cjs/integrations/adapters/expressjs/index.d.ts +2 -2
  13. package/dist/cjs/integrations/adapters/expressjs/index.js +2 -1
  14. package/dist/cjs/integrations/adapters/expressjs/routes.d.ts +16 -0
  15. package/dist/cjs/integrations/adapters/expressjs/routes.js +28 -0
  16. package/dist/cjs/integrations/adapters/nextjs/index.d.ts +1 -1
  17. package/dist/cjs/integrations/adapters/nextjs/index.js +2 -1
  18. package/dist/cjs/integrations/adapters/nextjs/routes.d.ts +15 -0
  19. package/dist/cjs/integrations/adapters/nextjs/routes.js +21 -0
  20. package/dist/cjs/integrations/controllers/index.d.ts +1 -0
  21. package/dist/cjs/integrations/controllers/index.js +3 -1
  22. package/dist/cjs/integrations/controllers/orders.js +52 -17
  23. package/dist/cjs/integrations/controllers/plans.d.ts +50 -0
  24. package/dist/cjs/integrations/controllers/plans.js +88 -0
  25. package/dist/cjs/integrations/types.d.ts +5 -2
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/Client.mjs +2 -2
  29. package/dist/esm/api/resources/plans/client/Client.d.mts +12 -0
  30. package/dist/esm/api/resources/plans/client/Client.mjs +62 -2
  31. package/dist/esm/api/resources/usage/client/Client.d.mts +3 -3
  32. package/dist/esm/api/resources/usage/client/Client.mjs +3 -3
  33. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.mts +3 -3
  34. package/dist/esm/api/types/PlanWithFeatures.d.mts +34 -0
  35. package/dist/esm/api/types/PlanWithFeatures.mjs +2 -0
  36. package/dist/esm/api/types/SignalV2.d.mts +5 -5
  37. package/dist/esm/api/types/index.d.mts +1 -0
  38. package/dist/esm/api/types/index.mjs +1 -0
  39. package/dist/esm/integrations/adapters/expressjs/index.d.mts +2 -2
  40. package/dist/esm/integrations/adapters/expressjs/index.mjs +2 -2
  41. package/dist/esm/integrations/adapters/expressjs/routes.d.mts +16 -0
  42. package/dist/esm/integrations/adapters/expressjs/routes.mjs +27 -0
  43. package/dist/esm/integrations/adapters/nextjs/index.d.mts +1 -1
  44. package/dist/esm/integrations/adapters/nextjs/index.mjs +1 -1
  45. package/dist/esm/integrations/adapters/nextjs/routes.d.mts +15 -0
  46. package/dist/esm/integrations/adapters/nextjs/routes.mjs +20 -0
  47. package/dist/esm/integrations/controllers/index.d.mts +1 -0
  48. package/dist/esm/integrations/controllers/index.mjs +1 -0
  49. package/dist/esm/integrations/controllers/orders.mjs +52 -17
  50. package/dist/esm/integrations/controllers/plans.d.mts +50 -0
  51. package/dist/esm/integrations/controllers/plans.mjs +84 -0
  52. package/dist/esm/integrations/types.d.mts +5 -2
  53. package/dist/esm/version.d.mts +1 -1
  54. package/dist/esm/version.mjs +1 -1
  55. package/package.json +36 -2
  56. package/reference.md +52 -3
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getPlanById = getPlanById;
13
+ exports.getPlanGroupById = getPlanGroupById;
14
+ exports.createGetPlanGroupByIdHandler = createGetPlanGroupByIdHandler;
15
+ const base_handler_js_1 = require("../utils/base-handler.js");
16
+ /**
17
+ * Get a plan by ID
18
+ *
19
+ * @param client - PaidClient instance
20
+ * @param planId - Plan's ID
21
+ * @returns Plan data
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const plan = await getPlanById(client, 'plan-123');
26
+ * console.log(plan.name, plan.id);
27
+ * ```
28
+ */
29
+ function getPlanById(client, planId) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const plan = yield client.plans.getById(planId);
32
+ return plan;
33
+ });
34
+ }
35
+ /**
36
+ * Get a plan group by ID
37
+ *
38
+ * @param client - PaidClient instance
39
+ * @param planGroupId - Plan group's ID
40
+ * @returns Plan group data
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const planGroup = await getPlanGroupById(client, 'plan-group-123');
45
+ * console.log(planGroup.name, planGroup.id);
46
+ * ```
47
+ */
48
+ function getPlanGroupById(client, planGroupId) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const planGroup = yield client.plans.getGroupById(planGroupId);
51
+ return planGroup;
52
+ });
53
+ }
54
+ /**
55
+ * Create a framework-agnostic handler for fetching a plan group by ID
56
+ *
57
+ * This handler can be used with any framework adapter.
58
+ * The plan group ID should be provided either in params or query string.
59
+ *
60
+ * @returns Handler function
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * // In Next.js route: /api/plans/[planGroupId]/route.ts
65
+ * import { createGetPlanGroupByIdHandler } from '@paid-ai/paid-node/integrations';
66
+ * import { nextjsAdapter } from '@paid-ai/paid-node/integrations/nextjs';
67
+ *
68
+ * const handler = createGetPlanGroupByIdHandler();
69
+ * export const GET = nextjsAdapter(handler);
70
+ * ```
71
+ */
72
+ function createGetPlanGroupByIdHandler() {
73
+ return (0, base_handler_js_1.createHandler)((client, _body, params) => __awaiter(this, void 0, void 0, function* () {
74
+ const planGroupId = params === null || params === void 0 ? void 0 : params.planGroupId;
75
+ if (!planGroupId) {
76
+ return {
77
+ success: false,
78
+ error: "planGroupId is required",
79
+ status: 400,
80
+ };
81
+ }
82
+ const planGroup = yield getPlanGroupById(client, planGroupId);
83
+ return { success: true, data: planGroup };
84
+ }), {
85
+ allowedMethods: ['GET'],
86
+ requireOrganizationId: false,
87
+ });
88
+ }
@@ -41,18 +41,20 @@ export interface OrderConfig {
41
41
  customerId: string;
42
42
  customerExternalId: string;
43
43
  billingContactId?: string;
44
- agentExternalId: string;
44
+ agentExternalId?: string;
45
45
  name?: string;
46
46
  description?: string;
47
47
  startDate?: string;
48
48
  endDate?: string;
49
49
  currency?: string;
50
50
  orderLines?: OrderLineConfig[];
51
+ planId?: string;
51
52
  }
52
53
  export interface OrderLineConfig {
53
54
  agentExternalId: string;
54
55
  name?: string;
55
56
  description?: string;
57
+ planProductId?: string;
56
58
  }
57
59
  /**
58
60
  * Note: orderLines is not required because if agentExternalId is provided,
@@ -62,13 +64,14 @@ export interface CompleteOrderConfig {
62
64
  customerId: string;
63
65
  customerExternalId: string;
64
66
  billingContactId?: string;
65
- agentExternalId: string;
67
+ agentExternalId?: string;
66
68
  name: string;
67
69
  description: string;
68
70
  startDate: string;
69
71
  endDate: string;
70
72
  currency: string;
71
73
  orderLines: OrderLineConfig[];
74
+ planId?: string;
72
75
  }
73
76
  export interface OrderOptions {
74
77
  /**
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.1-alpha0";
1
+ export declare const SDK_VERSION = "1.0.1-alpha1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.0.1-alpha0";
4
+ exports.SDK_VERSION = "1.0.1-alpha1";
@@ -14,8 +14,8 @@ export class PaidClient {
14
14
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
15
15
  "X-Fern-Language": "JavaScript",
16
16
  "X-Fern-SDK-Name": "@paid-ai/paid-node",
17
- "X-Fern-SDK-Version": "1.0.1-alpha0",
18
- "User-Agent": "@paid-ai/paid-node/1.0.1-alpha0",
17
+ "X-Fern-SDK-Version": "1.0.1-alpha1",
18
+ "User-Agent": "@paid-ai/paid-node/1.0.1-alpha1",
19
19
  "X-Fern-Runtime": core.RUNTIME.type,
20
20
  "X-Fern-Runtime-Version": core.RUNTIME.version,
21
21
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -54,5 +54,17 @@ export declare class Plans {
54
54
  */
55
55
  getGroupById(planGroupId: string, requestOptions?: Plans.RequestOptions): core.HttpResponsePromise<Paid.PlanGroup>;
56
56
  private __getGroupById;
57
+ /**
58
+ * @param {string} planGroupId - The ID of the plan group
59
+ * @param {Plans.RequestOptions} requestOptions - Request-specific configuration.
60
+ *
61
+ * @throws {@link Paid.ForbiddenError}
62
+ * @throws {@link Paid.NotFoundError}
63
+ *
64
+ * @example
65
+ * await client.plans.getGroupPlans("planGroupId")
66
+ */
67
+ getGroupPlans(planGroupId: string, requestOptions?: Plans.RequestOptions): core.HttpResponsePromise<Paid.PlanWithFeatures[]>;
68
+ private __getGroupPlans;
57
69
  protected _getAuthorizationHeader(): Promise<string | undefined>;
58
70
  }
@@ -180,7 +180,7 @@ export class Plans {
180
180
  var _a, _b, _c, _d, _e, _f, _g, _h;
181
181
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
182
182
  const _response = yield core.fetcher({
183
- url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `plans/group/${core.url.encodePathParam(planGroupId)}`),
183
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `plans/planGroup/${core.url.encodePathParam(planGroupId)}`),
184
184
  method: "GET",
185
185
  headers: _headers,
186
186
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
@@ -213,7 +213,67 @@ export class Plans {
213
213
  rawResponse: _response.rawResponse,
214
214
  });
215
215
  case "timeout":
216
- throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /plans/group/{planGroupId}.");
216
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /plans/planGroup/{planGroupId}.");
217
+ case "unknown":
218
+ throw new errors.PaidError({
219
+ message: _response.error.errorMessage,
220
+ rawResponse: _response.rawResponse,
221
+ });
222
+ }
223
+ });
224
+ }
225
+ /**
226
+ * @param {string} planGroupId - The ID of the plan group
227
+ * @param {Plans.RequestOptions} requestOptions - Request-specific configuration.
228
+ *
229
+ * @throws {@link Paid.ForbiddenError}
230
+ * @throws {@link Paid.NotFoundError}
231
+ *
232
+ * @example
233
+ * await client.plans.getGroupPlans("planGroupId")
234
+ */
235
+ getGroupPlans(planGroupId, requestOptions) {
236
+ return core.HttpResponsePromise.fromPromise(this.__getGroupPlans(planGroupId, requestOptions));
237
+ }
238
+ __getGroupPlans(planGroupId, requestOptions) {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ var _a, _b, _c, _d, _e, _f, _g, _h;
241
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
242
+ const _response = yield core.fetcher({
243
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Production, `plans/planGroup/${core.url.encodePathParam(planGroupId)}/plans`),
244
+ method: "GET",
245
+ headers: _headers,
246
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
247
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
248
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
249
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
250
+ });
251
+ if (_response.ok) {
252
+ return { data: _response.body, rawResponse: _response.rawResponse };
253
+ }
254
+ if (_response.error.reason === "status-code") {
255
+ switch (_response.error.statusCode) {
256
+ case 403:
257
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
258
+ case 404:
259
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
260
+ default:
261
+ throw new errors.PaidError({
262
+ statusCode: _response.error.statusCode,
263
+ body: _response.error.body,
264
+ rawResponse: _response.rawResponse,
265
+ });
266
+ }
267
+ }
268
+ switch (_response.error.reason) {
269
+ case "non-json":
270
+ throw new errors.PaidError({
271
+ statusCode: _response.error.statusCode,
272
+ body: _response.error.rawBody,
273
+ rawResponse: _response.rawResponse,
274
+ });
275
+ case "timeout":
276
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /plans/planGroup/{planGroupId}/plans.");
217
277
  case "unknown":
218
278
  throw new errors.PaidError({
219
279
  message: _response.error.errorMessage,
@@ -33,15 +33,15 @@ export declare class Usage {
33
33
  * await client.usage.usageRecordBulkV2({
34
34
  * signals: [{
35
35
  * event_name: "emails_sent",
36
- * product_id: "63fd642c-569d-44f9-8d67-5cf4944a16cc",
37
- * customer_id: "7d0b6fce-d82a-433d-8315-c994f8f1d68d"
36
+ * product_id: "prod_abc123def",
37
+ * customer_id: "cus_xyz789ghi"
38
38
  * }, {
39
39
  * event_name: "emails_sent",
40
40
  * external_product_id: "acme-product",
41
41
  * external_customer_id: "acme-inc"
42
42
  * }, {
43
43
  * event_name: "meeting_booked",
44
- * product_id: "63fd642c-569d-44f9-8d67-5cf4944a16cc",
44
+ * product_id: "prod_abc123def",
45
45
  * external_customer_id: "acme-inc",
46
46
  * data: {
47
47
  * "meeting_duration": 30,
@@ -84,15 +84,15 @@ export class Usage {
84
84
  * await client.usage.usageRecordBulkV2({
85
85
  * signals: [{
86
86
  * event_name: "emails_sent",
87
- * product_id: "63fd642c-569d-44f9-8d67-5cf4944a16cc",
88
- * customer_id: "7d0b6fce-d82a-433d-8315-c994f8f1d68d"
87
+ * product_id: "prod_abc123def",
88
+ * customer_id: "cus_xyz789ghi"
89
89
  * }, {
90
90
  * event_name: "emails_sent",
91
91
  * external_product_id: "acme-product",
92
92
  * external_customer_id: "acme-inc"
93
93
  * }, {
94
94
  * event_name: "meeting_booked",
95
- * product_id: "63fd642c-569d-44f9-8d67-5cf4944a16cc",
95
+ * product_id: "prod_abc123def",
96
96
  * external_customer_id: "acme-inc",
97
97
  * data: {
98
98
  * "meeting_duration": 30,
@@ -4,15 +4,15 @@ import type * as Paid from "../../../../index.mjs";
4
4
  * {
5
5
  * signals: [{
6
6
  * event_name: "emails_sent",
7
- * product_id: "63fd642c-569d-44f9-8d67-5cf4944a16cc",
8
- * customer_id: "7d0b6fce-d82a-433d-8315-c994f8f1d68d"
7
+ * product_id: "prod_abc123def",
8
+ * customer_id: "cus_xyz789ghi"
9
9
  * }, {
10
10
  * event_name: "emails_sent",
11
11
  * external_product_id: "acme-product",
12
12
  * external_customer_id: "acme-inc"
13
13
  * }, {
14
14
  * event_name: "meeting_booked",
15
- * product_id: "63fd642c-569d-44f9-8d67-5cf4944a16cc",
15
+ * product_id: "prod_abc123def",
16
16
  * external_customer_id: "acme-inc",
17
17
  * data: {
18
18
  * "meeting_duration": 30,
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A plan with its features (product-attribute pairs) for display
3
+ */
4
+ export interface PlanWithFeatures {
5
+ /** The unique identifier of the plan */
6
+ id: string;
7
+ /** The name of the plan */
8
+ name: string;
9
+ /** The description of the plan */
10
+ description?: string;
11
+ /** When the plan was created */
12
+ createdAt: string;
13
+ /** When the plan was last updated */
14
+ updatedAt: string;
15
+ /** The ID of the next plan in the sequence */
16
+ nextPlanId?: string;
17
+ /** The ID of the previous plan in the sequence */
18
+ prevPlanId?: string;
19
+ /** The features (product-attribute pairs) included in this plan */
20
+ features: PlanWithFeatures.Features.Item[];
21
+ }
22
+ export declare namespace PlanWithFeatures {
23
+ type Features = Features.Item[];
24
+ namespace Features {
25
+ interface Item {
26
+ /** The name of the product */
27
+ productName: string;
28
+ /** The name of the product attribute */
29
+ attributeName: string;
30
+ /** The pricing configuration for this feature */
31
+ pricing: Record<string, unknown>;
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,16 +1,16 @@
1
1
  /**
2
- * V2 signal schema with clean field names. Use either internal IDs (product_id, customer_id) or external IDs (external_product_id, external_customer_id).
2
+ * V2 signal schema with clean field names. IMPORTANT: Exactly one customer ID field (customer_id OR external_customer_id) and exactly one product ID field (product_id OR external_product_id) must be provided per signal.
3
3
  */
4
4
  export interface SignalV2 {
5
5
  /** The name of the event being tracked */
6
6
  event_name: string;
7
- /** Paid's internal product ID. Use either this OR external_product_id. */
7
+ /** Paid's display ID for the product (e.g., prod_abc123). Cannot be used with external_product_id. Either this or external_product_id is required. */
8
8
  product_id?: string;
9
- /** Your system's product ID. Use either this OR product_id. */
9
+ /** Your system's product ID. Cannot be used with product_id. Either this or product_id is required. */
10
10
  external_product_id?: string;
11
- /** Paid's internal customer ID. Use either this OR external_customer_id. */
11
+ /** Paid's display ID for the customer (e.g., cus_xyz789). Cannot be used with external_customer_id. Either this or external_customer_id is required. */
12
12
  customer_id?: string;
13
- /** Your system's customer ID. Use either this OR customer_id. */
13
+ /** Your system's customer ID. Cannot be used with customer_id. Either this or customer_id is required. */
14
14
  external_customer_id?: string;
15
15
  /** Optional additional data/metadata for the signal */
16
16
  data?: Record<string, unknown>;
@@ -30,6 +30,7 @@ export * from "./PaginationMeta.mjs";
30
30
  export * from "./PaymentMethod.mjs";
31
31
  export * from "./Plan.mjs";
32
32
  export * from "./PlanGroup.mjs";
33
+ export * from "./PlanWithFeatures.mjs";
33
34
  export * from "./PricePoint.mjs";
34
35
  export * from "./Pricing.mjs";
35
36
  export * from "./PricingModelType.mjs";
@@ -30,6 +30,7 @@ export * from "./PaginationMeta.mjs";
30
30
  export * from "./PaymentMethod.mjs";
31
31
  export * from "./Plan.mjs";
32
32
  export * from "./PlanGroup.mjs";
33
+ export * from "./PlanWithFeatures.mjs";
33
34
  export * from "./PricePoint.mjs";
34
35
  export * from "./Pricing.mjs";
35
36
  export * from "./PricingModelType.mjs";
@@ -2,5 +2,5 @@
2
2
  * ExpressJS integration for Paid SDK
3
3
  * Drop-in handlers for ExpressJS controllers using Express Request/Response
4
4
  */
5
- export { expressjsAdapter, createExpressJSResponseContext } from "./base-adapter.mjs";
6
- export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, type ActivateOrderSyncRouteConfig, type OrdersRouteConfig, type ProvisioningRouteConfig, type SetupIntentRouteConfig, } from "./routes.mjs";
5
+ export { expressjsAdapter, createExpressJSResponseContext, } from "./base-adapter.mjs";
6
+ export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createGetPlanGroupByIdRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, type ActivateOrderSyncRouteConfig, type OrdersRouteConfig, type ProvisioningRouteConfig, type SetupIntentRouteConfig, } from "./routes.mjs";
@@ -2,5 +2,5 @@
2
2
  * ExpressJS integration for Paid SDK
3
3
  * Drop-in handlers for ExpressJS controllers using Express Request/Response
4
4
  */
5
- export { expressjsAdapter, createExpressJSResponseContext } from "./base-adapter.mjs";
6
- export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, } from "./routes.mjs";
5
+ export { expressjsAdapter, createExpressJSResponseContext, } from "./base-adapter.mjs";
6
+ export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createGetPlanGroupByIdRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, } from "./routes.mjs";
@@ -161,4 +161,20 @@ export interface SetupIntentRouteConfig extends BaseHandlerConfig {
161
161
  * ```
162
162
  */
163
163
  export declare function createSetupIntentRoute(config?: SetupIntentRouteConfig): ExpressHandler;
164
+ /**
165
+ * Create an Express handler for getting a plan group by ID
166
+ *
167
+ * @param config - Handler configuration options
168
+ * @returns Express route handler function
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * import express from 'express';
173
+ * import { createGetPlanGroupByIdRoute } from '@paid-ai/paid-node/integrations/express';
174
+ *
175
+ * const app = express();
176
+ * app.get('/paid/plans/:planGroupId', createGetPlanGroupByIdRoute());
177
+ * ```
178
+ */
179
+ export declare function createGetPlanGroupByIdRoute(config?: BaseHandlerConfig): (req: Request, res: Response) => Promise<any>;
164
180
  export {};
@@ -9,6 +9,7 @@ import { createCustomersHandler, createGetCustomerHandler } from "../../controll
9
9
  import { createOrdersHandler } from "../../controllers/orders.mjs";
10
10
  import { createProvisioningHandler } from "../../controllers/provision-users.mjs";
11
11
  import { createActivateOrderSyncHandler, createPayInvoiceHandler, createSetupIntentHandler, } from "../../controllers/billing.mjs";
12
+ import { createGetPlanGroupByIdHandler } from "../../controllers/plans.mjs";
12
13
  /**
13
14
  * Helper to extract headers from Express Request
14
15
  */
@@ -265,3 +266,29 @@ export function createSetupIntentRoute(config = {}) {
265
266
  };
266
267
  return route;
267
268
  }
269
+ /**
270
+ * Create an Express handler for getting a plan group by ID
271
+ *
272
+ * @param config - Handler configuration options
273
+ * @returns Express route handler function
274
+ *
275
+ * @example
276
+ * ```typescript
277
+ * import express from 'express';
278
+ * import { createGetPlanGroupByIdRoute } from '@paid-ai/paid-node/integrations/express';
279
+ *
280
+ * const app = express();
281
+ * app.get('/paid/plans/:planGroupId', createGetPlanGroupByIdRoute());
282
+ * ```
283
+ */
284
+ export function createGetPlanGroupByIdRoute(config = {}) {
285
+ const handler = createGetPlanGroupByIdHandler();
286
+ return (req, res) => {
287
+ return handler({
288
+ body: req.body,
289
+ headers: extractHeaders(req),
290
+ method: "GET",
291
+ params: req.params,
292
+ }, createExpressJSResponseContext(res), config);
293
+ };
294
+ }
@@ -2,4 +2,4 @@
2
2
  * Next.js API Route handlers for Paid integration
3
3
  * Drop-in handlers for Next.js App Router
4
4
  */
5
- export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, type ActivateOrderSyncRouteConfig, type OrdersRouteConfig, type ProvisioningRouteConfig, type SetupIntentRouteConfig, } from './routes.mjs';
5
+ export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createGetPlanGroupByIdRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, type ActivateOrderSyncRouteConfig, type OrdersRouteConfig, type ProvisioningRouteConfig, type SetupIntentRouteConfig, } from "./routes.mjs";
@@ -2,4 +2,4 @@
2
2
  * Next.js API Route handlers for Paid integration
3
3
  * Drop-in handlers for Next.js App Router
4
4
  */
5
- export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, } from './routes.mjs';
5
+ export { createActivateOrderSyncRoute, createContactsRoute, createCustomerInvoicesRoute, createCustomersRoute, createGetCustomerRoute, createGetPlanGroupByIdRoute, createOrdersRoute, createPayInvoiceRoute, createProvisioningRoute, createSetupIntentRoute, } from "./routes.mjs";
@@ -224,4 +224,19 @@ export interface SetupIntentRouteConfig extends BaseHandlerConfig {
224
224
  * ```
225
225
  */
226
226
  export declare function createSetupIntentRoute(config?: SetupIntentRouteConfig): NextJsHandler;
227
+ /**
228
+ * Create a Next.js API route handler for getting a plan group by ID
229
+ *
230
+ * @param config - Handler configuration options
231
+ * @returns Next.js route handler function
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * // src/app/api/plans/[planGroupId]/route.ts
236
+ * import { createGetPlanGroupByIdRoute } from '@paid-ai/paid-node/integrations/nextjs';
237
+ *
238
+ * export const GET = createGetPlanGroupByIdRoute();
239
+ * ```
240
+ */
241
+ export declare function createGetPlanGroupByIdRoute(config?: BaseHandlerConfig): (request: any, context?: any) => Promise<any>;
227
242
  export {};
@@ -5,6 +5,7 @@ import { createCustomersHandler, createGetCustomerHandler } from "../../controll
5
5
  import { createOrdersHandler } from "../../controllers/orders.mjs";
6
6
  import { createProvisioningHandler } from "../../controllers/provision-users.mjs";
7
7
  import { createActivateOrderSyncHandler, createPayInvoiceHandler, createSetupIntentHandler } from "../../controllers/billing.mjs";
8
+ import { createGetPlanGroupByIdHandler } from "../../controllers/plans.mjs";
8
9
  /**
9
10
  * Create a Next.js API route handler for synchronous order activation
10
11
  *
@@ -242,3 +243,22 @@ export function createSetupIntentRoute(config = {}) {
242
243
  const route = (request, context) => adaptedHandler(request, context, config);
243
244
  return route;
244
245
  }
246
+ /**
247
+ * Create a Next.js API route handler for getting a plan group by ID
248
+ *
249
+ * @param config - Handler configuration options
250
+ * @returns Next.js route handler function
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * // src/app/api/plans/[planGroupId]/route.ts
255
+ * import { createGetPlanGroupByIdRoute } from '@paid-ai/paid-node/integrations/nextjs';
256
+ *
257
+ * export const GET = createGetPlanGroupByIdRoute();
258
+ * ```
259
+ */
260
+ export function createGetPlanGroupByIdRoute(config = {}) {
261
+ const handler = createGetPlanGroupByIdHandler();
262
+ const adaptedHandler = nextjsAdapter(handler);
263
+ return (request, context) => adaptedHandler(request, context, config);
264
+ }
@@ -4,3 +4,4 @@ export { createOrder, createOrderWithDefaults, createOrdersHandler, } from "./or
4
4
  export { payInvoice, createPayInvoiceHandler, type PayInvoiceConfig, type PayInvoiceRequest, type PayInvoiceResult, activateOrderSync, createActivateOrderSyncHandler, type ActivateOrderSyncConfig, type ActivateOrderSyncRequest, type ActivateOrderSyncResult, createSetupIntent, createSetupIntentHandler, type SetupIntentConfig, type SetupIntentRequest, type SetupIntentResponse, } from "./billing.mjs";
5
5
  export { getCustomerInvoices, createCustomerInvoicesHandler, type CustomerInvoicesResult, } from "./invoices.mjs";
6
6
  export { provisionNewUser, createProvisioningHandler, } from "./provision-users.mjs";
7
+ export { createGetPlanGroupByIdHandler, } from "./plans.mjs";
@@ -4,3 +4,4 @@ export { createOrder, createOrderWithDefaults, createOrdersHandler, } from "./or
4
4
  export { payInvoice, createPayInvoiceHandler, activateOrderSync, createActivateOrderSyncHandler, createSetupIntent, createSetupIntentHandler, } from "./billing.mjs";
5
5
  export { getCustomerInvoices, createCustomerInvoicesHandler, } from "./invoices.mjs";
6
6
  export { provisionNewUser, createProvisioningHandler, } from "./provision-users.mjs";
7
+ export { createGetPlanGroupByIdHandler, } from "./plans.mjs";