@wix/auto_sdk_payments_checkout-sessions 1.0.3 → 1.0.5

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 (50) hide show
  1. package/build/cjs/index.d.ts +1 -1
  2. package/build/cjs/index.js +12 -0
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +17 -1
  5. package/build/cjs/index.typings.js +12 -0
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +17 -1
  8. package/build/cjs/meta.js +12 -0
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/cjs/schemas.d.ts +57 -0
  11. package/build/cjs/schemas.js +103 -0
  12. package/build/cjs/schemas.js.map +1 -0
  13. package/build/es/index.d.mts +1 -1
  14. package/build/es/index.mjs +11 -0
  15. package/build/es/index.mjs.map +1 -1
  16. package/build/es/index.typings.d.mts +17 -1
  17. package/build/es/index.typings.mjs +11 -0
  18. package/build/es/index.typings.mjs.map +1 -1
  19. package/build/es/meta.d.mts +17 -1
  20. package/build/es/meta.mjs +11 -0
  21. package/build/es/meta.mjs.map +1 -1
  22. package/build/es/schemas.d.mts +57 -0
  23. package/build/es/schemas.mjs +65 -0
  24. package/build/es/schemas.mjs.map +1 -0
  25. package/build/internal/cjs/index.d.ts +1 -1
  26. package/build/internal/cjs/index.js +12 -0
  27. package/build/internal/cjs/index.js.map +1 -1
  28. package/build/internal/cjs/index.typings.d.ts +17 -1
  29. package/build/internal/cjs/index.typings.js +12 -0
  30. package/build/internal/cjs/index.typings.js.map +1 -1
  31. package/build/internal/cjs/meta.d.ts +17 -1
  32. package/build/internal/cjs/meta.js +12 -0
  33. package/build/internal/cjs/meta.js.map +1 -1
  34. package/build/internal/cjs/schemas.d.ts +57 -0
  35. package/build/internal/cjs/schemas.js +103 -0
  36. package/build/internal/cjs/schemas.js.map +1 -0
  37. package/build/internal/es/index.d.mts +1 -1
  38. package/build/internal/es/index.mjs +11 -0
  39. package/build/internal/es/index.mjs.map +1 -1
  40. package/build/internal/es/index.typings.d.mts +17 -1
  41. package/build/internal/es/index.typings.mjs +11 -0
  42. package/build/internal/es/index.typings.mjs.map +1 -1
  43. package/build/internal/es/meta.d.mts +17 -1
  44. package/build/internal/es/meta.mjs +11 -0
  45. package/build/internal/es/meta.mjs.map +1 -1
  46. package/build/internal/es/schemas.d.mts +57 -0
  47. package/build/internal/es/schemas.mjs +65 -0
  48. package/build/internal/es/schemas.mjs.map +1 -0
  49. package/package.json +11 -4
  50. package/schemas/package.json +3 -0
@@ -1,6 +1,6 @@
1
1
  import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
2
  import { Cart, ConstructCheckoutSessionOptions, ConstructCheckoutSessionResponse } from './index.typings.js';
3
- export { CallbackUrls, CancelSubscriptionOptions, CancelSubscriptionRequest, CancelSubscriptionResponse, CheckoutSession, ConstructCheckoutSessionRequest, CustomerInfo, FreeTrialPeriod, LineItem, RegisterCheckoutSessionWebhookRequest, RegisterCheckoutSessionWebhookResponse, SubscriptionFrequency, SubscriptionFrequencyWithLiterals, SubscriptionInfo, SubscriptionSettings } from './index.typings.js';
3
+ export { CallbackUrls, CancelSubscriptionOptions, CancelSubscriptionRequest, CancelSubscriptionResponse, CheckoutSession, ConstructCheckoutSessionRequest, CustomerInfo, FreeTrialPeriod, LineItem, RegisterCheckoutSessionWebhookRequest, RegisterCheckoutSessionWebhookResponse, SubscriptionFrequency, SubscriptionFrequencyWithLiterals, SubscriptionInfo, SubscriptionSettings, WebhookType, WebhookTypeWithLiterals } from './index.typings.js';
4
4
 
5
5
  declare function constructCheckoutSession$1(httpClient: HttpClient): ConstructCheckoutSessionSignature;
6
6
  interface ConstructCheckoutSessionSignature {
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  SubscriptionFrequency: () => SubscriptionFrequency,
24
+ WebhookType: () => WebhookType,
24
25
  cancelSubscription: () => cancelSubscription4,
25
26
  constructCheckoutSession: () => constructCheckoutSession4
26
27
  });
@@ -38,6 +39,10 @@ function resolveWixPaymentsPlatformV1CheckoutSessionsUrl(opts) {
38
39
  {
39
40
  srcPath: "/payments/platform/v1/checkout-sessions",
40
41
  destPath: "/v1/checkout-sessions"
42
+ },
43
+ {
44
+ srcPath: "/payments/base44/v1/subscriptions",
45
+ destPath: "/v1/subscriptions"
41
46
  }
42
47
  ]
43
48
  };
@@ -96,6 +101,12 @@ var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
96
101
  SubscriptionFrequency2["YEAR"] = "YEAR";
97
102
  return SubscriptionFrequency2;
98
103
  })(SubscriptionFrequency || {});
104
+ var WebhookType = /* @__PURE__ */ ((WebhookType2) => {
105
+ WebhookType2["ORDER_APPROVED"] = "ORDER_APPROVED";
106
+ WebhookType2["SUBSCRIPTION_CANCELED"] = "SUBSCRIPTION_CANCELED";
107
+ WebhookType2["SUBSCRIPTION_ENDED"] = "SUBSCRIPTION_ENDED";
108
+ return WebhookType2;
109
+ })(WebhookType || {});
99
110
  async function constructCheckoutSession2(cart, options) {
100
111
  const { httpClient, sideEffects } = arguments[2];
101
112
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
@@ -181,6 +192,7 @@ var cancelSubscription4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTMod
181
192
  // Annotate the CommonJS export names for ESM import in node:
182
193
  0 && (module.exports = {
183
194
  SubscriptionFrequency,
195
+ WebhookType,
184
196
  cancelSubscription,
185
197
  constructCheckoutSession
186
198
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n}\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** Request to cancel a subscription. */\nexport interface CancelSubscriptionRequest {\n /**\n * Ecom subscription contract ID used to resolve the billing subscription.\n * @format GUID\n */\n subscriptionContractId: string;\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n\n/** Response after canceling a subscription. */\nexport interface CancelSubscriptionResponse {}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Cancels a subscription by resolving the billing subscription from the Ecom subscription contract.\n * @param subscriptionContractId - Ecom subscription contract ID used to resolve the billing subscription.\n * @internal\n * @documentationMaturity preview\n * @requiredField subscriptionContractId\n * @permissionId payments:platform:v1:checkout_session:cancel_subscription\n * @returns Response after canceling a subscription.\n * @fqn wix.payments.platform.v1.CheckoutSessions.CancelSubscription\n */\nexport async function cancelSubscription(\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n subscriptionContractId: subscriptionContractId,\n reason: options?.reason,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.cancelSubscription(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n subscriptionContractId: '$[0]',\n reason: '$[1].reason',\n },\n singleArgumentUnchanged: false,\n },\n ['subscriptionContractId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CancelSubscriptionOptions {\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n\n/** Cancels a subscription by resolving the billing subscription from the Ecom subscription contract. */\nexport function cancelSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __cancelSubscription({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn: 'wix.payments.platform.v1.CheckoutSessions.CancelSubscription',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/cancel-subscription',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __cancelSubscription;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n CancelSubscriptionOptions,\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n cancelSubscription as universalCancelSubscription,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\n/** @internal */\nexport function cancelSubscription(\n httpClient: HttpClient\n): CancelSubscriptionSignature {\n return (\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n ) =>\n universalCancelSubscription(\n subscriptionContractId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface CancelSubscriptionSignature {\n /**\n * Cancels a subscription by resolving the billing subscription from the Ecom subscription contract.\n * @param - Ecom subscription contract ID used to resolve the billing subscription.\n * @returns Response after canceling a subscription.\n */\n (\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n ): Promise<void>;\n}\n\nexport {\n CallbackUrls,\n CancelSubscriptionOptions,\n CancelSubscriptionRequest,\n CancelSubscriptionResponse,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import {\n constructCheckoutSession as publicConstructCheckoutSession,\n cancelSubscription as publicCancelSubscription,\n} from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n/** @internal */\nexport const cancelSubscription: MaybeContext<\n BuildRESTFunction<typeof publicCancelSubscription> &\n typeof publicCancelSubscription\n> = /*#__PURE__*/ createRESTModule(publicCancelSubscription);\n\nexport { SubscriptionFrequency } from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n CancelSubscriptionRequest,\n CancelSubscriptionResponse,\n ConstructCheckoutSessionOptions,\n CancelSubscriptionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport { SubscriptionFrequencyWithLiterals } from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,gCAAAC;AAA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mC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA4BO,SAASC,oBACd,YAC6B;AAC7B,SAAO,CACL,wBACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;AC3EA,IAAAC,uBAAiC;AAG1B,IAAMC,4BAGK,2DAAiBA,yBAA8B;AAE1D,IAAMC,sBAGK,2DAAiBA,mBAAwB;","names":["cancelSubscription","constructCheckoutSession","SubscriptionFrequency","constructCheckoutSession","sdkTransformError","cancelSubscription","constructCheckoutSession","cancelSubscription","import_rest_modules","constructCheckoutSession","cancelSubscription"]}
1
+ {"version":3,"sources":["../../index.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** Request to cancel a subscription. */\nexport interface CancelSubscriptionRequest {\n /**\n * Ecom subscription contract ID used to resolve the billing subscription.\n * @format GUID\n */\n subscriptionContractId: string;\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n\n/** Response after canceling a subscription. */\nexport interface CancelSubscriptionResponse {}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Cancels a subscription by resolving the billing subscription from the Ecom subscription contract.\n * @param subscriptionContractId - Ecom subscription contract ID used to resolve the billing subscription.\n * @internal\n * @documentationMaturity preview\n * @requiredField subscriptionContractId\n * @permissionId payments:platform:v1:checkout_session:cancel_subscription\n * @returns Response after canceling a subscription.\n * @fqn wix.payments.platform.v1.CheckoutSessions.CancelSubscription\n */\nexport async function cancelSubscription(\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n subscriptionContractId: subscriptionContractId,\n reason: options?.reason,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.cancelSubscription(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n subscriptionContractId: '$[0]',\n reason: '$[1].reason',\n },\n singleArgumentUnchanged: false,\n },\n ['subscriptionContractId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CancelSubscriptionOptions {\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n\n/** Cancels a subscription by resolving the billing subscription from the Ecom subscription contract. */\nexport function cancelSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __cancelSubscription({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn: 'wix.payments.platform.v1.CheckoutSessions.CancelSubscription',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/cancel-subscription',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __cancelSubscription;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n CancelSubscriptionOptions,\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n cancelSubscription as universalCancelSubscription,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\n/** @internal */\nexport function cancelSubscription(\n httpClient: HttpClient\n): CancelSubscriptionSignature {\n return (\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n ) =>\n universalCancelSubscription(\n subscriptionContractId,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface CancelSubscriptionSignature {\n /**\n * Cancels a subscription by resolving the billing subscription from the Ecom subscription contract.\n * @param - Ecom subscription contract ID used to resolve the billing subscription.\n * @returns Response after canceling a subscription.\n */\n (\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n ): Promise<void>;\n}\n\nexport {\n CallbackUrls,\n CancelSubscriptionOptions,\n CancelSubscriptionRequest,\n CancelSubscriptionResponse,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import {\n constructCheckoutSession as publicConstructCheckoutSession,\n cancelSubscription as publicCancelSubscription,\n} from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n/** @internal */\nexport const cancelSubscription: MaybeContext<\n BuildRESTFunction<typeof publicCancelSubscription> &\n typeof publicCancelSubscription\n> = /*#__PURE__*/ createRESTModule(publicCancelSubscription);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n CancelSubscriptionRequest,\n CancelSubscriptionResponse,\n ConstructCheckoutSessionOptions,\n CancelSubscriptionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,gCAAAC;AAAA;AAAA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,wBAAwB;AAAA,UACxB,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,0BAA0B,SAAS;AAAA,IACtC;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AE5VO,SAASE,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AA4BO,SAASC,oBACd,YAC6B;AAC7B,SAAO,CACL,wBACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;AC3EA,IAAAC,uBAAiC;AAG1B,IAAMC,4BAGK,2DAAiBA,yBAA8B;AAE1D,IAAMC,sBAGK,2DAAiBA,mBAAwB;","names":["cancelSubscription","constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError","cancelSubscription","constructCheckoutSession","cancelSubscription","import_rest_modules","constructCheckoutSession","cancelSubscription"]}
@@ -154,7 +154,23 @@ interface RegisterCheckoutSessionWebhookRequest {
154
154
  * @format WEB_URL
155
155
  */
156
156
  url?: string | null;
157
+ /**
158
+ * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].
159
+ * @maxSize 10
160
+ */
161
+ webhookTypes?: WebhookTypeWithLiterals[];
157
162
  }
163
+ /** Type of webhook event to register. */
164
+ declare enum WebhookType {
165
+ /** Registers wix.ecom.v1.order_approved webhook. */
166
+ ORDER_APPROVED = "ORDER_APPROVED",
167
+ /** Registers wix.billing.v1.subscription_canceled webhook. */
168
+ SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
169
+ /** Registers wix.billing.v1.subscription_ended webhook. */
170
+ SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
171
+ }
172
+ /** @enumType */
173
+ type WebhookTypeWithLiterals = WebhookType | 'ORDER_APPROVED' | 'SUBSCRIPTION_CANCELED' | 'SUBSCRIPTION_ENDED';
158
174
  /** Response after registering a webhook. */
159
175
  interface RegisterCheckoutSessionWebhookResponse {
160
176
  /**
@@ -210,4 +226,4 @@ interface CancelSubscriptionOptions {
210
226
  reason?: string | null;
211
227
  }
212
228
 
213
- export { type CallbackUrls, type CancelSubscriptionOptions, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type Cart, type CheckoutSession, type ConstructCheckoutSessionOptions, type ConstructCheckoutSessionRequest, type ConstructCheckoutSessionResponse, type CustomerInfo, type FreeTrialPeriod, type LineItem, type RegisterCheckoutSessionWebhookRequest, type RegisterCheckoutSessionWebhookResponse, SubscriptionFrequency, type SubscriptionFrequencyWithLiterals, type SubscriptionInfo, type SubscriptionSettings, constructCheckoutSession };
229
+ export { type CallbackUrls, type CancelSubscriptionOptions, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type Cart, type CheckoutSession, type ConstructCheckoutSessionOptions, type ConstructCheckoutSessionRequest, type ConstructCheckoutSessionResponse, type CustomerInfo, type FreeTrialPeriod, type LineItem, type RegisterCheckoutSessionWebhookRequest, type RegisterCheckoutSessionWebhookResponse, SubscriptionFrequency, type SubscriptionFrequencyWithLiterals, type SubscriptionInfo, type SubscriptionSettings, WebhookType, type WebhookTypeWithLiterals, constructCheckoutSession };
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_typings_exports = {};
22
22
  __export(index_typings_exports, {
23
23
  SubscriptionFrequency: () => SubscriptionFrequency,
24
+ WebhookType: () => WebhookType,
24
25
  cancelSubscription: () => cancelSubscription2,
25
26
  constructCheckoutSession: () => constructCheckoutSession2
26
27
  });
@@ -38,6 +39,10 @@ function resolveWixPaymentsPlatformV1CheckoutSessionsUrl(opts) {
38
39
  {
39
40
  srcPath: "/payments/platform/v1/checkout-sessions",
40
41
  destPath: "/v1/checkout-sessions"
42
+ },
43
+ {
44
+ srcPath: "/payments/base44/v1/subscriptions",
45
+ destPath: "/v1/subscriptions"
41
46
  }
42
47
  ]
43
48
  };
@@ -96,6 +101,12 @@ var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
96
101
  SubscriptionFrequency2["YEAR"] = "YEAR";
97
102
  return SubscriptionFrequency2;
98
103
  })(SubscriptionFrequency || {});
104
+ var WebhookType = /* @__PURE__ */ ((WebhookType2) => {
105
+ WebhookType2["ORDER_APPROVED"] = "ORDER_APPROVED";
106
+ WebhookType2["SUBSCRIPTION_CANCELED"] = "SUBSCRIPTION_CANCELED";
107
+ WebhookType2["SUBSCRIPTION_ENDED"] = "SUBSCRIPTION_ENDED";
108
+ return WebhookType2;
109
+ })(WebhookType || {});
99
110
  async function constructCheckoutSession2(cart, options) {
100
111
  const { httpClient, sideEffects } = arguments[2];
101
112
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
@@ -158,6 +169,7 @@ async function cancelSubscription2(subscriptionContractId, options) {
158
169
  // Annotate the CommonJS export names for ESM import in node:
159
170
  0 && (module.exports = {
160
171
  SubscriptionFrequency,
172
+ WebhookType,
161
173
  cancelSubscription,
162
174
  constructCheckoutSession
163
175
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.typings.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n}\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** Request to cancel a subscription. */\nexport interface CancelSubscriptionRequest {\n /**\n * Ecom subscription contract ID used to resolve the billing subscription.\n * @format GUID\n */\n subscriptionContractId: string;\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n\n/** Response after canceling a subscription. */\nexport interface CancelSubscriptionResponse {}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Cancels a subscription by resolving the billing subscription from the Ecom subscription contract.\n * @param subscriptionContractId - Ecom subscription contract ID used to resolve the billing subscription.\n * @internal\n * @documentationMaturity preview\n * @requiredField subscriptionContractId\n * @permissionId payments:platform:v1:checkout_session:cancel_subscription\n * @returns Response after canceling a subscription.\n * @fqn wix.payments.platform.v1.CheckoutSessions.CancelSubscription\n */\nexport async function cancelSubscription(\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n subscriptionContractId: subscriptionContractId,\n reason: options?.reason,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.cancelSubscription(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n subscriptionContractId: '$[0]',\n reason: '$[1].reason',\n },\n singleArgumentUnchanged: false,\n },\n ['subscriptionContractId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CancelSubscriptionOptions {\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n\n/** Cancels a subscription by resolving the billing subscription from the Ecom subscription contract. */\nexport function cancelSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __cancelSubscription({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn: 'wix.payments.platform.v1.CheckoutSessions.CancelSubscription',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/cancel-subscription',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __cancelSubscription;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,gCAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WA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AAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAiBA,eAAsBC,oBACpB,wBACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,QAAQ,SAAS;AAAA,EACnB,CAAC;AAED,QAAM,UAC2C,mBAAmB,OAAO;AAE3E,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,wBAAwB;AAAA,UACxB,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,0BAA0B,SAAS;AAAA,IACtC;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["cancelSubscription","constructCheckoutSession","SubscriptionFrequency","constructCheckoutSession","sdkTransformError","cancelSubscription"]}
1
+ {"version":3,"sources":["../../index.typings.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** Request to cancel a subscription. */\nexport interface CancelSubscriptionRequest {\n /**\n * Ecom subscription contract ID used to resolve the billing subscription.\n * @format GUID\n */\n subscriptionContractId: string;\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n\n/** Response after canceling a subscription. */\nexport interface CancelSubscriptionResponse {}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Cancels a subscription by resolving the billing subscription from the Ecom subscription contract.\n * @param subscriptionContractId - Ecom subscription contract ID used to resolve the billing subscription.\n * @internal\n * @documentationMaturity preview\n * @requiredField subscriptionContractId\n * @permissionId payments:platform:v1:checkout_session:cancel_subscription\n * @returns Response after canceling a subscription.\n * @fqn wix.payments.platform.v1.CheckoutSessions.CancelSubscription\n */\nexport async function cancelSubscription(\n subscriptionContractId: string,\n options?: CancelSubscriptionOptions\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n subscriptionContractId: subscriptionContractId,\n reason: options?.reason,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.cancelSubscription(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n subscriptionContractId: '$[0]',\n reason: '$[1].reason',\n },\n singleArgumentUnchanged: false,\n },\n ['subscriptionContractId', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CancelSubscriptionOptions {\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n\n/** Cancels a subscription by resolving the billing subscription from the Ecom subscription contract. */\nexport function cancelSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __cancelSubscription({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn: 'wix.payments.platform.v1.CheckoutSessions.CancelSubscription',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/cancel-subscription',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __cancelSubscription;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,gCAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGO,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,w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AK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,QAAQ,SAAS;AAAA,EACnB,CAAC;AAED,QAAM,UAC2C,mBAAmB,OAAO;AAE3E,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,wBAAwB;AAAA,UACxB,QAAQ;AAAA,QACV;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,0BAA0B,SAAS;AAAA,IACtC;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["cancelSubscription","constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError","cancelSubscription"]}
@@ -155,7 +155,23 @@ interface RegisterCheckoutSessionWebhookRequest {
155
155
  * @format WEB_URL
156
156
  */
157
157
  url?: string | null;
158
+ /**
159
+ * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].
160
+ * @maxSize 10
161
+ */
162
+ webhookTypes?: WebhookTypeWithLiterals[];
158
163
  }
164
+ /** Type of webhook event to register. */
165
+ declare enum WebhookType {
166
+ /** Registers wix.ecom.v1.order_approved webhook. */
167
+ ORDER_APPROVED = "ORDER_APPROVED",
168
+ /** Registers wix.billing.v1.subscription_canceled webhook. */
169
+ SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
170
+ /** Registers wix.billing.v1.subscription_ended webhook. */
171
+ SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
172
+ }
173
+ /** @enumType */
174
+ type WebhookTypeWithLiterals = WebhookType | 'ORDER_APPROVED' | 'SUBSCRIPTION_CANCELED' | 'SUBSCRIPTION_ENDED';
159
175
  /** Response after registering a webhook. */
160
176
  interface RegisterCheckoutSessionWebhookResponse {
161
177
  /**
@@ -194,4 +210,4 @@ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q
194
210
  declare function constructCheckoutSession(): __PublicMethodMetaInfo<'POST', {}, ConstructCheckoutSessionRequest$1, ConstructCheckoutSessionRequest, ConstructCheckoutSessionResponse$1, ConstructCheckoutSessionResponse>;
195
211
  declare function cancelSubscription(): __PublicMethodMetaInfo<'POST', {}, CancelSubscriptionRequest$1, CancelSubscriptionRequest, CancelSubscriptionResponse$1, CancelSubscriptionResponse>;
196
212
 
197
- export { type CallbackUrls as CallbackUrlsOriginal, type CancelSubscriptionRequest as CancelSubscriptionRequestOriginal, type CancelSubscriptionResponse as CancelSubscriptionResponseOriginal, type Cart as CartOriginal, type CheckoutSession as CheckoutSessionOriginal, type ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal, type ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal, type CustomerInfo as CustomerInfoOriginal, type FreeTrialPeriod as FreeTrialPeriodOriginal, type LineItem as LineItemOriginal, type RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal, type RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal, SubscriptionFrequency as SubscriptionFrequencyOriginal, type SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal, type SubscriptionInfo as SubscriptionInfoOriginal, type SubscriptionSettings as SubscriptionSettingsOriginal, type __PublicMethodMetaInfo, cancelSubscription, constructCheckoutSession };
213
+ export { type CallbackUrls as CallbackUrlsOriginal, type CancelSubscriptionRequest as CancelSubscriptionRequestOriginal, type CancelSubscriptionResponse as CancelSubscriptionResponseOriginal, type Cart as CartOriginal, type CheckoutSession as CheckoutSessionOriginal, type ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal, type ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal, type CustomerInfo as CustomerInfoOriginal, type FreeTrialPeriod as FreeTrialPeriodOriginal, type LineItem as LineItemOriginal, type RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal, type RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal, SubscriptionFrequency as SubscriptionFrequencyOriginal, type SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal, type SubscriptionInfo as SubscriptionInfoOriginal, type SubscriptionSettings as SubscriptionSettingsOriginal, WebhookType as WebhookTypeOriginal, type WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal, type __PublicMethodMetaInfo, cancelSubscription, constructCheckoutSession };
package/build/cjs/meta.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var meta_exports = {};
22
22
  __export(meta_exports, {
23
23
  SubscriptionFrequencyOriginal: () => SubscriptionFrequency,
24
+ WebhookTypeOriginal: () => WebhookType,
24
25
  cancelSubscription: () => cancelSubscription2,
25
26
  constructCheckoutSession: () => constructCheckoutSession2
26
27
  });
@@ -34,6 +35,10 @@ function resolveWixPaymentsPlatformV1CheckoutSessionsUrl(opts) {
34
35
  {
35
36
  srcPath: "/payments/platform/v1/checkout-sessions",
36
37
  destPath: "/v1/checkout-sessions"
38
+ },
39
+ {
40
+ srcPath: "/payments/base44/v1/subscriptions",
41
+ destPath: "/v1/subscriptions"
37
42
  }
38
43
  ]
39
44
  };
@@ -92,6 +97,12 @@ var SubscriptionFrequency = /* @__PURE__ */ ((SubscriptionFrequency2) => {
92
97
  SubscriptionFrequency2["YEAR"] = "YEAR";
93
98
  return SubscriptionFrequency2;
94
99
  })(SubscriptionFrequency || {});
100
+ var WebhookType = /* @__PURE__ */ ((WebhookType2) => {
101
+ WebhookType2["ORDER_APPROVED"] = "ORDER_APPROVED";
102
+ WebhookType2["SUBSCRIPTION_CANCELED"] = "SUBSCRIPTION_CANCELED";
103
+ WebhookType2["SUBSCRIPTION_ENDED"] = "SUBSCRIPTION_ENDED";
104
+ return WebhookType2;
105
+ })(WebhookType || {});
95
106
 
96
107
  // src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts
97
108
  function constructCheckoutSession2() {
@@ -135,6 +146,7 @@ function cancelSubscription2() {
135
146
  // Annotate the CommonJS export names for ESM import in node:
136
147
  0 && (module.exports = {
137
148
  SubscriptionFrequencyOriginal,
149
+ WebhookTypeOriginal,
138
150
  cancelSubscription,
139
151
  constructCheckoutSession
140
152
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../meta.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n\n/** Cancels a subscription by resolving the billing subscription from the Ecom subscription contract. */\nexport function cancelSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __cancelSubscription({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn: 'wix.payments.platform.v1.CheckoutSessions.CancelSubscription',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/cancel-subscription',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __cancelSubscription;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n}\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** Request to cancel a subscription. */\nexport interface CancelSubscriptionRequest {\n /**\n * Ecom subscription contract ID used to resolve the billing subscription.\n * @format GUID\n */\n subscriptionContractId: string;\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n\n/** Response after canceling a subscription. */\nexport interface CancelSubscriptionResponse {}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function cancelSubscription(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.CancelSubscriptionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.CancelSubscriptionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.CancelSubscriptionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.CancelSubscriptionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.cancelSubscription(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/cancel-subscription',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n CancelSubscriptionRequest as CancelSubscriptionRequestOriginal,\n CancelSubscriptionResponse as CancelSubscriptionResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,gCAAAC;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGO,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACbO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;;;ACvCL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,sBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C,mBAAmB,OAAO;AAE3E,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["cancelSubscription","constructCheckoutSession","SubscriptionFrequency","constructCheckoutSession","cancelSubscription"]}
1
+ {"version":3,"sources":["../../meta.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n\n/** Cancels a subscription by resolving the billing subscription from the Ecom subscription contract. */\nexport function cancelSubscription(\n payload: object\n): RequestOptionsFactory<any> {\n function __cancelSubscription({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn: 'wix.payments.platform.v1.CheckoutSessions.CancelSubscription',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/cancel-subscription',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __cancelSubscription;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** Request to cancel a subscription. */\nexport interface CancelSubscriptionRequest {\n /**\n * Ecom subscription contract ID used to resolve the billing subscription.\n * @format GUID\n */\n subscriptionContractId: string;\n /**\n * Optional reason for cancellation.\n * @maxLength 500\n */\n reason?: string | null;\n}\n\n/** Response after canceling a subscription. */\nexport interface CancelSubscriptionResponse {}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function cancelSubscription(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.CancelSubscriptionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.CancelSubscriptionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.CancelSubscriptionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.CancelSubscriptionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.cancelSubscription(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/cancel-subscription',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n CancelSubscriptionRequest as CancelSubscriptionRequestOriginal,\n CancelSubscriptionResponse as CancelSubscriptionResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,gCAAAC;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGO,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,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IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["cancelSubscription","constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","cancelSubscription"]}
@@ -0,0 +1,57 @@
1
+ import * as z from 'zod';
2
+
3
+ declare const ConstructCheckoutSessionRequest: z.ZodObject<{
4
+ cart: z.ZodObject<{
5
+ items: z.ZodArray<z.ZodObject<{
6
+ name: z.ZodString;
7
+ quantity: z.ZodNumber;
8
+ price: z.ZodString;
9
+ subscriptionInfo: z.ZodOptional<z.ZodObject<{
10
+ subscriptionSettings: z.ZodOptional<z.ZodObject<{
11
+ frequency: z.ZodOptional<z.ZodEnum<{
12
+ UNDEFINED: "UNDEFINED";
13
+ DAY: "DAY";
14
+ WEEK: "WEEK";
15
+ MONTH: "MONTH";
16
+ YEAR: "YEAR";
17
+ }>>;
18
+ interval: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
19
+ autoRenewal: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
20
+ billingCycles: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
21
+ freeTrialPeriod: z.ZodOptional<z.ZodObject<{
22
+ frequency: z.ZodOptional<z.ZodEnum<{
23
+ UNDEFINED: "UNDEFINED";
24
+ DAY: "DAY";
25
+ WEEK: "WEEK";
26
+ MONTH: "MONTH";
27
+ YEAR: "YEAR";
28
+ }>>;
29
+ interval: z.ZodOptional<z.ZodNumber>;
30
+ }, z.core.$strip>>;
31
+ }, z.core.$strip>>;
32
+ title: z.ZodNullable<z.ZodOptional<z.ZodString>>;
33
+ description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$strip>>;
36
+ customerInfo: z.ZodOptional<z.ZodObject<{
37
+ firstName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
38
+ lastName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
39
+ phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
40
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
+ }, z.core.$strip>>;
42
+ }, z.core.$strip>;
43
+ options: z.ZodObject<{
44
+ callbackUrls: z.ZodObject<{
45
+ postFlowUrl: z.ZodString;
46
+ thankYouPageUrl: z.ZodString;
47
+ }, z.core.$strip>;
48
+ }, z.core.$strip>;
49
+ }, z.core.$strip>;
50
+ declare const ConstructCheckoutSessionResponse: z.ZodObject<{
51
+ checkoutSession: z.ZodOptional<z.ZodObject<{
52
+ _id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
53
+ redirectUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>;
56
+
57
+ export { ConstructCheckoutSessionRequest, ConstructCheckoutSessionResponse };
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // schemas.ts
31
+ var schemas_exports = {};
32
+ __export(schemas_exports, {
33
+ ConstructCheckoutSessionRequest: () => ConstructCheckoutSessionRequest,
34
+ ConstructCheckoutSessionResponse: () => ConstructCheckoutSessionResponse
35
+ });
36
+ module.exports = __toCommonJS(schemas_exports);
37
+
38
+ // src/payments-platform-v1-checkout-session-checkout-sessions.schemas.ts
39
+ var z = __toESM(require("zod"));
40
+ var ConstructCheckoutSessionRequest = z.object({
41
+ cart: z.object({
42
+ items: z.array(
43
+ z.object({
44
+ name: z.string().describe("Name or title of the item.").min(1).max(255),
45
+ quantity: z.number().int().describe("Quantity of this item in the cart.").min(1),
46
+ price: z.string().describe('Price of the item as a string (e.g., "19.99").').min(1).max(50),
47
+ subscriptionInfo: z.object({
48
+ subscriptionSettings: z.object({
49
+ frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).optional(),
50
+ interval: z.number().int().describe(
51
+ "Number of frequency units between charges. Default: 1."
52
+ ).min(1).max(3650).optional().nullable(),
53
+ autoRenewal: z.boolean().describe(
54
+ "Whether the subscription renews automatically."
55
+ ).optional().nullable(),
56
+ billingCycles: z.number().int().describe(
57
+ "Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely."
58
+ ).min(1).optional().nullable(),
59
+ freeTrialPeriod: z.object({
60
+ frequency: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).optional(),
61
+ interval: z.number().int().describe(
62
+ "Duration in frequency units (e.g., 14 with DAY = 14-day trial)."
63
+ ).min(1).max(999).optional()
64
+ }).describe("Free trial period before the first charge.").optional()
65
+ }).describe(
66
+ "Subscription settings such as frequency and billing cycles."
67
+ ).optional(),
68
+ title: z.string().describe("Subscription title shown to the buyer.").max(150).optional().nullable(),
69
+ description: z.string().describe("Subscription description shown to the buyer.").max(500).optional().nullable()
70
+ }).describe(
71
+ "Optional. When provided, the item becomes a recurring subscription."
72
+ ).optional()
73
+ })
74
+ ).max(100),
75
+ customerInfo: z.object({
76
+ firstName: z.string().describe("Customer's first name.").max(100).optional().nullable(),
77
+ lastName: z.string().describe("Customer's last name.").max(100).optional().nullable(),
78
+ phone: z.string().describe("Customer's phone number.").optional().nullable(),
79
+ email: z.string().describe("Customer's email address.").email().optional().nullable()
80
+ }).describe("Optional customer information to pre-fill checkout form.").optional()
81
+ }).describe("Cart details including line items to be checked out."),
82
+ options: z.object({
83
+ callbackUrls: z.object({
84
+ postFlowUrl: z.string().describe("URL to redirect after the checkout flow completes.").url(),
85
+ thankYouPageUrl: z.string().describe("URL for the thank you page after successful payment.").url()
86
+ }).describe("Callback URLs for redirecting the user after checkout flow.")
87
+ })
88
+ });
89
+ var ConstructCheckoutSessionResponse = z.object({
90
+ checkoutSession: z.object({
91
+ _id: z.string().describe("Cart ID (from ecom cart service).").regex(
92
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
93
+ "Must be a valid GUID"
94
+ ).optional().nullable(),
95
+ redirectUrl: z.string().describe("URL to redirect buyer.").url().optional().nullable()
96
+ }).describe("The constructed checkout session.").optional()
97
+ });
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ ConstructCheckoutSessionRequest,
101
+ ConstructCheckoutSessionResponse
102
+ });
103
+ //# sourceMappingURL=schemas.js.map