@wix/auto_sdk_payments_checkout-sessions 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +3 -6
- package/build/cjs/index.js +6 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +28 -33
- package/build/cjs/index.typings.js +6 -0
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +25 -27
- package/build/cjs/meta.js +6 -0
- package/build/cjs/meta.js.map +1 -1
- package/build/cjs/schemas.js +9 -11
- package/build/cjs/schemas.js.map +1 -1
- package/build/es/index.d.mts +3 -6
- package/build/es/index.mjs +6 -0
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +28 -33
- package/build/es/index.typings.mjs +6 -0
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +25 -27
- package/build/es/meta.mjs +6 -0
- package/build/es/meta.mjs.map +1 -1
- package/build/es/schemas.mjs +9 -11
- package/build/es/schemas.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +3 -6
- package/build/internal/cjs/index.js +6 -0
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +28 -33
- package/build/internal/cjs/index.typings.js +6 -0
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +25 -27
- package/build/internal/cjs/meta.js +6 -0
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/cjs/schemas.js +9 -11
- package/build/internal/cjs/schemas.js.map +1 -1
- package/build/internal/es/index.d.mts +3 -6
- package/build/internal/es/index.mjs +6 -0
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +28 -33
- package/build/internal/es/index.typings.mjs +6 -0
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +25 -27
- package/build/internal/es/meta.mjs +6 -0
- package/build/internal/es/meta.mjs.map +1 -1
- package/build/internal/es/schemas.mjs +9 -11
- package/build/internal/es/schemas.mjs.map +1 -1
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -5,14 +5,11 @@ export { CallbackUrls, CheckoutSession, CustomerInfo, FreeTrialPeriod, GenerateC
|
|
|
5
5
|
declare function generateCheckoutSession$1(httpClient: HttpClient): GenerateCheckoutSessionSignature;
|
|
6
6
|
interface GenerateCheckoutSessionSignature {
|
|
7
7
|
/**
|
|
8
|
-
* Creates a Wix-hosted checkout session for the supplied line items
|
|
8
|
+
* Creates a Wix-hosted checkout session for the supplied line items.
|
|
9
9
|
* and `id`.
|
|
10
10
|
*
|
|
11
|
-
* Each call creates a new, independent session
|
|
12
|
-
* an additional session rather than recovering
|
|
13
|
-
*
|
|
14
|
-
* `https://www.wixapis.com/payments/platform/v1/checkout-sessions/construct` is a secondary
|
|
15
|
-
* (legacy) path bound to the same RPC.
|
|
11
|
+
* Each call creates a new, independent session. The method isn't idempotent, so a retry produces
|
|
12
|
+
* an additional session rather than recovering the prior one.
|
|
16
13
|
* @param - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.
|
|
17
14
|
* @returns Response after creating a checkout session.
|
|
18
15
|
*/
|
package/build/cjs/index.js
CHANGED
|
@@ -55,6 +55,12 @@ function resolveWixPaymentsPlatformV1CheckoutSessionsUrl(opts) {
|
|
|
55
55
|
srcPath: "/_api/checkout-sessions",
|
|
56
56
|
destPath: ""
|
|
57
57
|
}
|
|
58
|
+
],
|
|
59
|
+
"payments.base44.com": [
|
|
60
|
+
{
|
|
61
|
+
srcPath: "/_api/checkout-sessions",
|
|
62
|
+
destPath: ""
|
|
63
|
+
}
|
|
58
64
|
]
|
|
59
65
|
};
|
|
60
66
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
package/build/cjs/index.js.map
CHANGED
|
@@ -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 Wix-hosted checkout page generated for a specific set of line items. */\nexport interface CheckoutSession {\n /**\n * Checkout session ID, generated by this call. The caller does not supply it.\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page as\n * an anonymous shopper; any session held by the calling app is not carried over.\n *\n * The URL carries query parameters Wix needs in order to render the page correctly (for example, a\n * `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the\n * buyer unchanged — do not strip, reorder, rewrite, or otherwise mutate its query string.\n * @readonly\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to create a checkout session. */\nexport interface GenerateCheckoutSessionRequest {\n /** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\n cart: Cart;\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Recurring subscription configuration for a line item.\n *\n * `LineItem.name` and `subscriptionInfo.title`/`description` render in different parts of the\n * Wix-hosted checkout page: `LineItem.name` is the line label in the cart-summary list, while\n * `subscriptionInfo.title` and `subscriptionInfo.description` are the heading and body text on the\n * recurring-billing summary block (the area that shows the buyer the cadence and the free-trial terms,\n * if any). Set them to complementary values rather than duplicating `LineItem.name`.\n */\nexport interface SubscriptionInfo {\n /**\n * Billing frequency, cycles, and free trial configuration. Required when `subscriptionInfo` is set on a\n * line item.\n */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription name shown to the buyer in the recurring-billing summary block on the Wix-hosted\n * checkout page (the heading of that block).\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer in the recurring-billing summary block on the\n * Wix-hosted checkout page (the body text below the title).\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/**\n * Configuration for recurring subscription charges.\n *\n * `autoRenewal` and `billingCycles` are mutually exclusive — `autoRenewal: true` describes an\n * open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term\n * subscription that stops after N charges. Setting `autoRenewal: true` together with any\n * `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code\n * `AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT`).\n */\nexport interface SubscriptionSettings {\n /** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. For `DAY` frequency, the minimum is 7 — the shortest\n * billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with\n * `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`.\n *\n * Note that `freeTrialPeriod.interval` does **not** share this floor — a `DAY` trial may have\n * `interval` as low as 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /**\n * Whether the subscription renews automatically. Cannot be `true` when `billingCycles` is set.\n *\n * Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles`\n * is set and `autoRenewal` is omitted.\n */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles before the subscription stops. Cannot be set when `autoRenewal` is `true`.\n *\n * When omitted along with `autoRenewal`, 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 /** Unknown frequency. */\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/**\n * Free trial period before the first subscription charge.\n *\n * The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it\n * describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A\n * `frequency: MONTH` + `interval: 3` trial means \"a single 3-month trial,\" not \"billed every three\n * months.\"\n */\nexport interface FreeTrialPeriod {\n /**\n * Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be\n * treated as a client mistake and is not a valid runtime value.\n */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY`\n * gives a 14-day trial.\n *\n * Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1` — there is no weekly-floor\n * restriction on the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code\n * `MIN_VALUE`).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface PhysicalProperties {\n /** Whether the item requires shipping. */\n shippable?: boolean | null;\n}\n\nexport interface LineItem {\n /**\n * Name of the item, shown on the checkout page.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item to charge for.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Per-unit price as a decimal string in the merchant account currency. For example, `\"19.99\"`.\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /**\n * Subscription configuration. When set, the line item follows a scheduled-billing model defined by\n * `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing\n * cycle is `price × quantity`, and `quantity` is locked at session creation.\n *\n * At most one line item per request may set `subscriptionInfo`. Requests with two or more\n * subscription line items are rejected with `MULTIPLE_SUBSCRIPTION_ITEMS`.\n */\n subscriptionInfo?: SubscriptionInfo;\n /** Optional. Physical properties of the item, used when the item requires shipping. */\n physicalProperties?: PhysicalProperties;\n}\n\n/**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\nexport interface CustomerInfo {\n /**\n * Buyer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Buyer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Buyer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Buyer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\n/** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\nexport interface Cart {\n /**\n * Line items the buyer is paying for in this checkout session.\n *\n * At most one subscription line item (an item with `subscriptionInfo` set) is allowed per request.\n * Requests with two or more subscription items are rejected. One-time items can be combined with a\n * single subscription item; in that case the buyer is charged once at checkout for the one-time items\n * and (if applicable) the first cycle of the subscription, and any subsequent cycles are billed on\n * the subscription's own schedule.\n * @maxSize 100\n */\n items?: LineItem[];\n /**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\n customerInfo?: CustomerInfo;\n}\n\n/**\n * URLs the buyer is redirected to after the checkout flow.\n *\n * The buyer is sent to one of the URLs below — `continueBrowsingUrl` if they explicitly leave via\n * **Continue browsing**, `thankYouPageUrl` after a successful payment.\n *\n * If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no\n * callback URL is invoked and the checkout session is not resumed.\n */\nexport interface CallbackUrls {\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment — both when they click **Continue browsing** and when they navigate back to\n * a cart-style page.\n *\n * Deprecated. Use `continueBrowsingUrl` instead.\n * @format WEB_URL\n * @deprecated\n * @replacedBy continue_browsing_url\n */\n postFlowUrl?: string | null;\n /**\n * URL the buyer is redirected to after a successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment — both when they click **Continue browsing** and when they navigate back to\n * a cart-style page.\n *\n * Required unless the deprecated `postFlowUrl` is supplied.\n * @format WEB_URL\n */\n continueBrowsingUrl?: string | null;\n}\n\n/** Response after creating a checkout session. */\nexport interface GenerateCheckoutSessionResponse {\n /** The created checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. Default: `[ORDER_APPROVED]`.\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Webhook event types to register. */\nexport enum WebhookType {\n /** Order Approved webhook (`wix.ecom.v1.order_approved`). */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /**\n * Subscription Contract Canceled webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_canceled`).\n */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /**\n * Subscription Contract Expired webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_expired`).\n */\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 * PEM-formatted RS256 public key used to verify the JWT signature on incoming webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** @docsIgnore */\nexport type GenerateCheckoutSessionApplicationErrors =\n | {\n code?: 'MULTIPLE_SUBSCRIPTION_ITEMS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items and returns its `redirectUrl`\n * and `id`.\n *\n * Each call creates a new, independent session; the method is not idempotent, so a retry produces\n * an additional session rather than recovering an existing one.\n *\n * `https://www.wixapis.com/payments/platform/v1/checkout-sessions/construct` is a secondary\n * (legacy) path bound to the same RPC.\n * @param cart - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.\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 cart.items.subscriptionInfo.subscriptionSettings\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.frequency\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @permissionId payments:platform:v1:checkout_session:generate_checkout_session\n * @returns Response after creating a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.GenerateCheckoutSession\n */\nexport async function generateCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`\n | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<\n GenerateCheckoutSessionResponse & {\n __applicationErrorsType?: GenerateCheckoutSessionApplicationErrors;\n }\n> {\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.generateCheckoutSession(\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 GenerateCheckoutSessionOptions {\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\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 'manage._base_domain_': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n 'manage.base44.com': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items and returns its `redirectUrl`\n * and `id`.\n *\n * Each call creates a new, independent session; the method is not idempotent, so a retry produces\n * an additional session rather than recovering an existing one.\n *\n * `https://www.wixapis.com/payments/platform/v1/checkout-sessions/construct` is a secondary\n * (legacy) path bound to the same RPC.\n */\nexport function generateCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __generateCheckoutSession({ 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.GenerateCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n GenerateCheckoutSessionApplicationErrors,\n GenerateCheckoutSessionOptions,\n GenerateCheckoutSessionResponse,\n generateCheckoutSession as universalGenerateCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function generateCheckoutSession(\n httpClient: HttpClient\n): GenerateCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`\n | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalGenerateCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateCheckoutSessionSignature {\n /**\n * Creates a Wix-hosted checkout session for the supplied line items and returns its `redirectUrl`\n * and `id`.\n *\n * Each call creates a new, independent session; the method is not idempotent, so a retry produces\n * an additional session rather than recovering an existing one.\n *\n * `https://www.wixapis.com/payments/platform/v1/checkout-sessions/construct` is a secondary\n * (legacy) path bound to the same RPC.\n * @param - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.\n * @returns Response after creating 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 | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<\n GenerateCheckoutSessionResponse & {\n __applicationErrorsType?: GenerateCheckoutSessionApplicationErrors;\n }\n >;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n CustomerInfo,\n FreeTrialPeriod,\n GenerateCheckoutSessionOptions,\n GenerateCheckoutSessionRequest,\n GenerateCheckoutSessionResponse,\n LineItem,\n PhysicalProperties,\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 { generateCheckoutSession as publicGenerateCheckoutSession } 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 generateCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicGenerateCheckoutSession> &\n typeof publicGenerateCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicGenerateCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n GenerateCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n PhysicalProperties,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n GenerateCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n GenerateCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n GenerateCheckoutSessionApplicationErrors,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAAA;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,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;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;AAYd,SAAS,wBACd,SAC4B;AAC5B,WAAS,0BAA0B,EAAE,KAAK,GAAQ;AAChD,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;;;ADoCO,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AANG,SAAAA;AAAA,GAAA;AA0LL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAKjB,EAAAA,aAAA,2BAAwB;AAKxB,EAAAA,aAAA,wBAAqB;AAZX,SAAAA;AAAA,GAAA;AAwEZ,eAAsBC,yBACpB,MAWA,SASA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,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;;;AEhaO,SAASC,yBACd,YACkC;AAClC,SAAO,CACL,MAWA,YAMAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACrCA,IAAAC,uBAAiC;AAG1B,IAAMC,2BAGK,2DAAiBA,wBAA6B;","names":["generateCheckoutSession","SubscriptionFrequency","WebhookType","generateCheckoutSession","sdkTransformError","generateCheckoutSession","import_rest_modules","generateCheckoutSession"]}
|
|
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 Wix-hosted checkout page generated for a specific set of line items. */\nexport interface CheckoutSession {\n /**\n * Checkout session ID.\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page\n * as an anonymous shopper, and any session held by the calling app isn't carried over.\n *\n * The URL carries query parameters Wix needs to render the page correctly (for example, a\n * `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the\n * buyer unchanged. Don't strip, reorder, rewrite, or otherwise mutate its query string.\n * @readonly\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to create a checkout session. */\nexport interface GenerateCheckoutSessionRequest {\n /** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\n cart: Cart;\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Recurring subscription configuration for a line item.\n *\n * `LineItem.name` and `subscriptionInfo.title`/`description` render in different parts of the\n * Wix-hosted checkout page: `LineItem.name` is the line label in the cart-summary list, while\n * `subscriptionInfo.title` and `subscriptionInfo.description` are the heading and body text on the\n * recurring-billing summary block (the area that shows the buyer the cadence and the free-trial terms,\n * if any). Set them to complementary values rather than duplicating `LineItem.name`.\n */\nexport interface SubscriptionInfo {\n /**\n * Billing frequency, cycles, and free trial configuration. Required when `subscriptionInfo` is set on a\n * line item.\n */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription name shown to the buyer in the recurring-billing summary block on the Wix-hosted\n * checkout page (the heading of that block).\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer in the recurring-billing summary block on the\n * Wix-hosted checkout page (the body text below the title).\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/**\n * Configuration for recurring subscription charges.\n *\n * `autoRenewal` and `billingCycles` are mutually exclusive. `autoRenewal: true` describes an\n * open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term\n * subscription that stops after N charges. Setting `autoRenewal: true` together with any\n * `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code\n * `AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT`).\n */\nexport interface SubscriptionSettings {\n /** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. For `DAY` frequency, the minimum is 7. The shortest\n * billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with\n * `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`.\n *\n * Note that `freeTrialPeriod.interval` doesn't share this floor: a `DAY` trial may have\n * `interval` as low as 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /**\n * Whether the subscription renews automatically. Can't be `true` when `billingCycles` is set.\n *\n * Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles`\n * is set and `autoRenewal` is omitted.\n */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles before the subscription stops. Can't be set when `autoRenewal` is `true`.\n *\n * When omitted along with `autoRenewal`, 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 /** Unknown frequency. */\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/**\n * Free trial period before the first subscription charge.\n *\n * The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it\n * describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A\n * `frequency: MONTH` + `interval: 3` trial means \"a single 3-month trial,\" not \"billed every 3\n * months.\"\n */\nexport interface FreeTrialPeriod {\n /**\n * Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be\n * treated as a client mistake and isn't a valid runtime value.\n */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY`\n * gives a 14-day trial.\n *\n * Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1`. No weekly floor applies\n * to the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code\n * `MIN_VALUE`).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface PhysicalProperties {\n /** Whether the item requires shipping. */\n shippable?: boolean | null;\n}\n\nexport interface LineItem {\n /**\n * Name of the item, shown on the checkout page.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item to charge for.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Per-unit price as a decimal string in the merchant account currency. For example, `\"19.99\"`.\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /**\n * Subscription configuration. When set, the line item follows a scheduled-billing model defined by\n * `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing\n * cycle is `price × quantity`, and `quantity` is locked at session creation.\n *\n * At most 1 line item per request may set `subscriptionInfo`. Wix rejects requests with 2 or more\n * subscription line items with `MULTIPLE_SUBSCRIPTION_ITEMS`.\n */\n subscriptionInfo?: SubscriptionInfo;\n /** Optional. Physical properties of the item, used when the item requires shipping. */\n physicalProperties?: PhysicalProperties;\n}\n\n/**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\nexport interface CustomerInfo {\n /**\n * Buyer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Buyer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Buyer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Buyer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\n/** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\nexport interface Cart {\n /**\n * Line items the buyer is paying for in this checkout session.\n *\n * At most 1 subscription line item (an item with `subscriptionInfo` set) is allowed per request.\n * Wix rejects requests with 2 or more subscription items. Non-recurring items can be combined with a\n * single subscription item. In that case the buyer is charged once at checkout for the non-recurring\n * items and, if applicable, the first cycle of the subscription. Wix bills any subsequent cycles on\n * the subscription's own schedule.\n * @maxSize 100\n */\n items?: LineItem[];\n /**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\n customerInfo?: CustomerInfo;\n}\n\n/**\n * URLs the buyer is redirected to after the checkout flow.\n *\n * The buyer is sent to one of the URLs below: `continueBrowsingUrl` if they explicitly leave via\n * **Continue browsing**, or `thankYouPageUrl` after a successful payment.\n *\n * If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no\n * callback URL is invoked and the checkout session isn't resumed.\n */\nexport interface CallbackUrls {\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment, either when they click **Continue browsing** or when they navigate back to\n * a cart-style page.\n *\n * Deprecated. Use `continueBrowsingUrl` instead.\n * @format WEB_URL\n * @deprecated\n * @replacedBy continue_browsing_url\n */\n postFlowUrl?: string | null;\n /**\n * URL the buyer is redirected to after a successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment, either when they click **Continue browsing** or when they navigate back to\n * a cart-style page.\n * @format WEB_URL\n */\n continueBrowsingUrl?: string | null;\n}\n\n/** Response after creating a checkout session. */\nexport interface GenerateCheckoutSessionResponse {\n /** The created checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. Default: `[ORDER_APPROVED]`.\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Webhook event types to register. */\nexport enum WebhookType {\n /** Order Approved webhook (`wix.ecom.v1.order_approved`). */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /**\n * Subscription Contract Canceled webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_canceled`).\n */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /**\n * Subscription Contract Expired webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_expired`).\n */\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 * PEM-formatted RS256 public key used to verify the JWT signature on incoming webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** @docsIgnore */\nexport type GenerateCheckoutSessionApplicationErrors =\n | {\n code?: 'MULTIPLE_SUBSCRIPTION_ITEMS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items.\n * and `id`.\n *\n * Each call creates a new, independent session. The method isn't idempotent, so a retry produces\n * an additional session rather than recovering the prior one.\n * @param cart - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.\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 cart.items.subscriptionInfo.subscriptionSettings\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.frequency\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @permissionId payments:platform:v1:checkout_session:generate_checkout_session\n * @returns Response after creating a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.GenerateCheckoutSession\n */\nexport async function generateCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`\n | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<\n GenerateCheckoutSessionResponse & {\n __applicationErrorsType?: GenerateCheckoutSessionApplicationErrors;\n }\n> {\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.generateCheckoutSession(\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 GenerateCheckoutSessionOptions {\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\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 'manage._base_domain_': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n 'manage.base44.com': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n 'payments.base44.com': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items.\n * and `id`.\n *\n * Each call creates a new, independent session. The method isn't idempotent, so a retry produces\n * an additional session rather than recovering the prior one.\n */\nexport function generateCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __generateCheckoutSession({ 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.GenerateCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n GenerateCheckoutSessionApplicationErrors,\n GenerateCheckoutSessionOptions,\n GenerateCheckoutSessionResponse,\n generateCheckoutSession as universalGenerateCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function generateCheckoutSession(\n httpClient: HttpClient\n): GenerateCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`\n | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalGenerateCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateCheckoutSessionSignature {\n /**\n * Creates a Wix-hosted checkout session for the supplied line items.\n * and `id`.\n *\n * Each call creates a new, independent session. The method isn't idempotent, so a retry produces\n * an additional session rather than recovering the prior one.\n * @param - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.\n * @returns Response after creating 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 | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<\n GenerateCheckoutSessionResponse & {\n __applicationErrorsType?: GenerateCheckoutSessionApplicationErrors;\n }\n >;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n CustomerInfo,\n FreeTrialPeriod,\n GenerateCheckoutSessionOptions,\n GenerateCheckoutSessionRequest,\n GenerateCheckoutSessionResponse,\n LineItem,\n PhysicalProperties,\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 { generateCheckoutSession as publicGenerateCheckoutSession } 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 generateCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicGenerateCheckoutSession> &\n typeof publicGenerateCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicGenerateCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n GenerateCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n PhysicalProperties,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n GenerateCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n GenerateCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n GenerateCheckoutSessionApplicationErrors,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAAA;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,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,uBAAuB;AAAA,MACrB;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;AASd,SAAS,wBACd,SAC4B;AAC5B,WAAS,0BAA0B,EAAE,KAAK,GAAQ;AAChD,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;;;ADiCO,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AANG,SAAAA;AAAA,GAAA;AAwLL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAKjB,EAAAA,aAAA,2BAAwB;AAKxB,EAAAA,aAAA,wBAAqB;AAZX,SAAAA;AAAA,GAAA;AAqEZ,eAAsBC,yBACpB,MAWA,SASA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,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;;;AE3ZO,SAASC,yBACd,YACkC;AAClC,SAAO,CACL,MAWA,YAMAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACrCA,IAAAC,uBAAiC;AAG1B,IAAMC,2BAGK,2DAAiBA,wBAA6B;","names":["generateCheckoutSession","SubscriptionFrequency","WebhookType","generateCheckoutSession","sdkTransformError","generateCheckoutSession","import_rest_modules","generateCheckoutSession"]}
|
|
@@ -3,18 +3,18 @@ import { NonNullablePaths } from '@wix/sdk-types';
|
|
|
3
3
|
/** A Wix-hosted checkout page generated for a specific set of line items. */
|
|
4
4
|
interface CheckoutSession {
|
|
5
5
|
/**
|
|
6
|
-
* Checkout session ID
|
|
6
|
+
* Checkout session ID.
|
|
7
7
|
* @readonly
|
|
8
8
|
* @format GUID
|
|
9
9
|
*/
|
|
10
10
|
_id?: string | null;
|
|
11
11
|
/**
|
|
12
|
-
* URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page
|
|
13
|
-
* an anonymous shopper
|
|
12
|
+
* URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page
|
|
13
|
+
* as an anonymous shopper, and any session held by the calling app isn't carried over.
|
|
14
14
|
*
|
|
15
|
-
* The URL carries query parameters Wix needs
|
|
15
|
+
* The URL carries query parameters Wix needs to render the page correctly (for example, a
|
|
16
16
|
* `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the
|
|
17
|
-
* buyer unchanged
|
|
17
|
+
* buyer unchanged. Don't strip, reorder, rewrite, or otherwise mutate its query string.
|
|
18
18
|
* @readonly
|
|
19
19
|
* @format WEB_URL
|
|
20
20
|
*/
|
|
@@ -58,7 +58,7 @@ interface SubscriptionInfo {
|
|
|
58
58
|
/**
|
|
59
59
|
* Configuration for recurring subscription charges.
|
|
60
60
|
*
|
|
61
|
-
* `autoRenewal` and `billingCycles` are mutually exclusive
|
|
61
|
+
* `autoRenewal` and `billingCycles` are mutually exclusive. `autoRenewal: true` describes an
|
|
62
62
|
* open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term
|
|
63
63
|
* subscription that stops after N charges. Setting `autoRenewal: true` together with any
|
|
64
64
|
* `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code
|
|
@@ -68,25 +68,25 @@ interface SubscriptionSettings {
|
|
|
68
68
|
/** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */
|
|
69
69
|
frequency?: SubscriptionFrequencyWithLiterals;
|
|
70
70
|
/**
|
|
71
|
-
* Number of frequency units between charges. For `DAY` frequency, the minimum is 7
|
|
71
|
+
* Number of frequency units between charges. For `DAY` frequency, the minimum is 7. The shortest
|
|
72
72
|
* billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with
|
|
73
73
|
* `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`.
|
|
74
74
|
*
|
|
75
|
-
* Note that `freeTrialPeriod.interval`
|
|
75
|
+
* Note that `freeTrialPeriod.interval` doesn't share this floor: a `DAY` trial may have
|
|
76
76
|
* `interval` as low as 1.
|
|
77
77
|
* @min 1
|
|
78
78
|
* @max 3650
|
|
79
79
|
*/
|
|
80
80
|
interval?: number | null;
|
|
81
81
|
/**
|
|
82
|
-
* Whether the subscription renews automatically.
|
|
82
|
+
* Whether the subscription renews automatically. Can't be `true` when `billingCycles` is set.
|
|
83
83
|
*
|
|
84
84
|
* Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles`
|
|
85
85
|
* is set and `autoRenewal` is omitted.
|
|
86
86
|
*/
|
|
87
87
|
autoRenewal?: boolean | null;
|
|
88
88
|
/**
|
|
89
|
-
* Number of billing cycles before the subscription stops.
|
|
89
|
+
* Number of billing cycles before the subscription stops. Can't be set when `autoRenewal` is `true`.
|
|
90
90
|
*
|
|
91
91
|
* When omitted along with `autoRenewal`, the subscription renews indefinitely.
|
|
92
92
|
* @min 1
|
|
@@ -111,21 +111,21 @@ type SubscriptionFrequencyWithLiterals = SubscriptionFrequency | 'UNDEFINED' | '
|
|
|
111
111
|
*
|
|
112
112
|
* The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it
|
|
113
113
|
* describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A
|
|
114
|
-
* `frequency: MONTH` + `interval: 3` trial means "a single 3-month trial," not "billed every
|
|
114
|
+
* `frequency: MONTH` + `interval: 3` trial means "a single 3-month trial," not "billed every 3
|
|
115
115
|
* months."
|
|
116
116
|
*/
|
|
117
117
|
interface FreeTrialPeriod {
|
|
118
118
|
/**
|
|
119
119
|
* Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be
|
|
120
|
-
* treated as a client mistake and
|
|
120
|
+
* treated as a client mistake and isn't a valid runtime value.
|
|
121
121
|
*/
|
|
122
122
|
frequency?: SubscriptionFrequencyWithLiterals;
|
|
123
123
|
/**
|
|
124
124
|
* Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY`
|
|
125
125
|
* gives a 14-day trial.
|
|
126
126
|
*
|
|
127
|
-
* Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1
|
|
128
|
-
*
|
|
127
|
+
* Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1`. No weekly floor applies
|
|
128
|
+
* to the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code
|
|
129
129
|
* `MIN_VALUE`).
|
|
130
130
|
* @min 1
|
|
131
131
|
* @max 999
|
|
@@ -159,8 +159,8 @@ interface LineItem {
|
|
|
159
159
|
* `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing
|
|
160
160
|
* cycle is `price × quantity`, and `quantity` is locked at session creation.
|
|
161
161
|
*
|
|
162
|
-
* At most
|
|
163
|
-
* subscription line items
|
|
162
|
+
* At most 1 line item per request may set `subscriptionInfo`. Wix rejects requests with 2 or more
|
|
163
|
+
* subscription line items with `MULTIPLE_SUBSCRIPTION_ITEMS`.
|
|
164
164
|
*/
|
|
165
165
|
subscriptionInfo?: SubscriptionInfo;
|
|
166
166
|
/** Optional. Physical properties of the item, used when the item requires shipping. */
|
|
@@ -197,10 +197,10 @@ interface Cart {
|
|
|
197
197
|
/**
|
|
198
198
|
* Line items the buyer is paying for in this checkout session.
|
|
199
199
|
*
|
|
200
|
-
* At most
|
|
201
|
-
*
|
|
202
|
-
* single subscription item
|
|
203
|
-
* and
|
|
200
|
+
* At most 1 subscription line item (an item with `subscriptionInfo` set) is allowed per request.
|
|
201
|
+
* Wix rejects requests with 2 or more subscription items. Non-recurring items can be combined with a
|
|
202
|
+
* single subscription item. In that case the buyer is charged once at checkout for the non-recurring
|
|
203
|
+
* items and, if applicable, the first cycle of the subscription. Wix bills any subsequent cycles on
|
|
204
204
|
* the subscription's own schedule.
|
|
205
205
|
* @maxSize 100
|
|
206
206
|
*/
|
|
@@ -214,16 +214,16 @@ interface Cart {
|
|
|
214
214
|
/**
|
|
215
215
|
* URLs the buyer is redirected to after the checkout flow.
|
|
216
216
|
*
|
|
217
|
-
* The buyer is sent to one of the URLs below
|
|
218
|
-
* **Continue browsing**, `thankYouPageUrl` after a successful payment.
|
|
217
|
+
* The buyer is sent to one of the URLs below: `continueBrowsingUrl` if they explicitly leave via
|
|
218
|
+
* **Continue browsing**, or `thankYouPageUrl` after a successful payment.
|
|
219
219
|
*
|
|
220
220
|
* If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no
|
|
221
|
-
* callback URL is invoked and the checkout session
|
|
221
|
+
* callback URL is invoked and the checkout session isn't resumed.
|
|
222
222
|
*/
|
|
223
223
|
interface CallbackUrls {
|
|
224
224
|
/**
|
|
225
225
|
* URL the buyer is redirected to from the Wix checkout page when they choose to leave without
|
|
226
|
-
* completing payment
|
|
226
|
+
* completing payment, either when they click **Continue browsing** or when they navigate back to
|
|
227
227
|
* a cart-style page.
|
|
228
228
|
*
|
|
229
229
|
* Deprecated. Use `continueBrowsingUrl` instead.
|
|
@@ -239,10 +239,8 @@ interface CallbackUrls {
|
|
|
239
239
|
thankYouPageUrl?: string | null;
|
|
240
240
|
/**
|
|
241
241
|
* URL the buyer is redirected to from the Wix checkout page when they choose to leave without
|
|
242
|
-
* completing payment
|
|
242
|
+
* completing payment, either when they click **Continue browsing** or when they navigate back to
|
|
243
243
|
* a cart-style page.
|
|
244
|
-
*
|
|
245
|
-
* Required unless the deprecated `postFlowUrl` is supplied.
|
|
246
244
|
* @format WEB_URL
|
|
247
245
|
*/
|
|
248
246
|
continueBrowsingUrl?: string | null;
|
|
@@ -301,14 +299,11 @@ type GenerateCheckoutSessionApplicationErrors = {
|
|
|
301
299
|
data?: Record<string, any>;
|
|
302
300
|
};
|
|
303
301
|
/**
|
|
304
|
-
* Creates a Wix-hosted checkout session for the supplied line items
|
|
302
|
+
* Creates a Wix-hosted checkout session for the supplied line items.
|
|
305
303
|
* and `id`.
|
|
306
304
|
*
|
|
307
|
-
* Each call creates a new, independent session
|
|
308
|
-
* an additional session rather than recovering
|
|
309
|
-
*
|
|
310
|
-
* `https://www.wixapis.com/payments/platform/v1/checkout-sessions/construct` is a secondary
|
|
311
|
-
* (legacy) path bound to the same RPC.
|
|
305
|
+
* Each call creates a new, independent session. The method isn't idempotent, so a retry produces
|
|
306
|
+
* an additional session rather than recovering the prior one.
|
|
312
307
|
* @param cart - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.
|
|
313
308
|
* @public
|
|
314
309
|
* @documentationMaturity preview
|
|
@@ -55,6 +55,12 @@ function resolveWixPaymentsPlatformV1CheckoutSessionsUrl(opts) {
|
|
|
55
55
|
srcPath: "/_api/checkout-sessions",
|
|
56
56
|
destPath: ""
|
|
57
57
|
}
|
|
58
|
+
],
|
|
59
|
+
"payments.base44.com": [
|
|
60
|
+
{
|
|
61
|
+
srcPath: "/_api/checkout-sessions",
|
|
62
|
+
destPath: ""
|
|
63
|
+
}
|
|
58
64
|
]
|
|
59
65
|
};
|
|
60
66
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
@@ -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 Wix-hosted checkout page generated for a specific set of line items. */\nexport interface CheckoutSession {\n /**\n * Checkout session ID, generated by this call. The caller does not supply it.\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page as\n * an anonymous shopper; any session held by the calling app is not carried over.\n *\n * The URL carries query parameters Wix needs in order to render the page correctly (for example, a\n * `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the\n * buyer unchanged — do not strip, reorder, rewrite, or otherwise mutate its query string.\n * @readonly\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to create a checkout session. */\nexport interface GenerateCheckoutSessionRequest {\n /** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\n cart: Cart;\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Recurring subscription configuration for a line item.\n *\n * `LineItem.name` and `subscriptionInfo.title`/`description` render in different parts of the\n * Wix-hosted checkout page: `LineItem.name` is the line label in the cart-summary list, while\n * `subscriptionInfo.title` and `subscriptionInfo.description` are the heading and body text on the\n * recurring-billing summary block (the area that shows the buyer the cadence and the free-trial terms,\n * if any). Set them to complementary values rather than duplicating `LineItem.name`.\n */\nexport interface SubscriptionInfo {\n /**\n * Billing frequency, cycles, and free trial configuration. Required when `subscriptionInfo` is set on a\n * line item.\n */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription name shown to the buyer in the recurring-billing summary block on the Wix-hosted\n * checkout page (the heading of that block).\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer in the recurring-billing summary block on the\n * Wix-hosted checkout page (the body text below the title).\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/**\n * Configuration for recurring subscription charges.\n *\n * `autoRenewal` and `billingCycles` are mutually exclusive — `autoRenewal: true` describes an\n * open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term\n * subscription that stops after N charges. Setting `autoRenewal: true` together with any\n * `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code\n * `AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT`).\n */\nexport interface SubscriptionSettings {\n /** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. For `DAY` frequency, the minimum is 7 — the shortest\n * billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with\n * `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`.\n *\n * Note that `freeTrialPeriod.interval` does **not** share this floor — a `DAY` trial may have\n * `interval` as low as 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /**\n * Whether the subscription renews automatically. Cannot be `true` when `billingCycles` is set.\n *\n * Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles`\n * is set and `autoRenewal` is omitted.\n */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles before the subscription stops. Cannot be set when `autoRenewal` is `true`.\n *\n * When omitted along with `autoRenewal`, 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 /** Unknown frequency. */\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/**\n * Free trial period before the first subscription charge.\n *\n * The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it\n * describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A\n * `frequency: MONTH` + `interval: 3` trial means \"a single 3-month trial,\" not \"billed every three\n * months.\"\n */\nexport interface FreeTrialPeriod {\n /**\n * Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be\n * treated as a client mistake and is not a valid runtime value.\n */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY`\n * gives a 14-day trial.\n *\n * Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1` — there is no weekly-floor\n * restriction on the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code\n * `MIN_VALUE`).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface PhysicalProperties {\n /** Whether the item requires shipping. */\n shippable?: boolean | null;\n}\n\nexport interface LineItem {\n /**\n * Name of the item, shown on the checkout page.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item to charge for.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Per-unit price as a decimal string in the merchant account currency. For example, `\"19.99\"`.\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /**\n * Subscription configuration. When set, the line item follows a scheduled-billing model defined by\n * `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing\n * cycle is `price × quantity`, and `quantity` is locked at session creation.\n *\n * At most one line item per request may set `subscriptionInfo`. Requests with two or more\n * subscription line items are rejected with `MULTIPLE_SUBSCRIPTION_ITEMS`.\n */\n subscriptionInfo?: SubscriptionInfo;\n /** Optional. Physical properties of the item, used when the item requires shipping. */\n physicalProperties?: PhysicalProperties;\n}\n\n/**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\nexport interface CustomerInfo {\n /**\n * Buyer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Buyer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Buyer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Buyer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\n/** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\nexport interface Cart {\n /**\n * Line items the buyer is paying for in this checkout session.\n *\n * At most one subscription line item (an item with `subscriptionInfo` set) is allowed per request.\n * Requests with two or more subscription items are rejected. One-time items can be combined with a\n * single subscription item; in that case the buyer is charged once at checkout for the one-time items\n * and (if applicable) the first cycle of the subscription, and any subsequent cycles are billed on\n * the subscription's own schedule.\n * @maxSize 100\n */\n items?: LineItem[];\n /**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\n customerInfo?: CustomerInfo;\n}\n\n/**\n * URLs the buyer is redirected to after the checkout flow.\n *\n * The buyer is sent to one of the URLs below — `continueBrowsingUrl` if they explicitly leave via\n * **Continue browsing**, `thankYouPageUrl` after a successful payment.\n *\n * If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no\n * callback URL is invoked and the checkout session is not resumed.\n */\nexport interface CallbackUrls {\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment — both when they click **Continue browsing** and when they navigate back to\n * a cart-style page.\n *\n * Deprecated. Use `continueBrowsingUrl` instead.\n * @format WEB_URL\n * @deprecated\n * @replacedBy continue_browsing_url\n */\n postFlowUrl?: string | null;\n /**\n * URL the buyer is redirected to after a successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment — both when they click **Continue browsing** and when they navigate back to\n * a cart-style page.\n *\n * Required unless the deprecated `postFlowUrl` is supplied.\n * @format WEB_URL\n */\n continueBrowsingUrl?: string | null;\n}\n\n/** Response after creating a checkout session. */\nexport interface GenerateCheckoutSessionResponse {\n /** The created checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. Default: `[ORDER_APPROVED]`.\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Webhook event types to register. */\nexport enum WebhookType {\n /** Order Approved webhook (`wix.ecom.v1.order_approved`). */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /**\n * Subscription Contract Canceled webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_canceled`).\n */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /**\n * Subscription Contract Expired webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_expired`).\n */\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 * PEM-formatted RS256 public key used to verify the JWT signature on incoming webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** @docsIgnore */\nexport type GenerateCheckoutSessionApplicationErrors =\n | {\n code?: 'MULTIPLE_SUBSCRIPTION_ITEMS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items and returns its `redirectUrl`\n * and `id`.\n *\n * Each call creates a new, independent session; the method is not idempotent, so a retry produces\n * an additional session rather than recovering an existing one.\n *\n * `https://www.wixapis.com/payments/platform/v1/checkout-sessions/construct` is a secondary\n * (legacy) path bound to the same RPC.\n * @param cart - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.\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 cart.items.subscriptionInfo.subscriptionSettings\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.frequency\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @permissionId payments:platform:v1:checkout_session:generate_checkout_session\n * @returns Response after creating a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.GenerateCheckoutSession\n */\nexport async function generateCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`\n | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<\n GenerateCheckoutSessionResponse & {\n __applicationErrorsType?: GenerateCheckoutSessionApplicationErrors;\n }\n> {\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.generateCheckoutSession(\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 GenerateCheckoutSessionOptions {\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\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 'manage._base_domain_': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n 'manage.base44.com': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items and returns its `redirectUrl`\n * and `id`.\n *\n * Each call creates a new, independent session; the method is not idempotent, so a retry produces\n * an additional session rather than recovering an existing one.\n *\n * `https://www.wixapis.com/payments/platform/v1/checkout-sessions/construct` is a secondary\n * (legacy) path bound to the same RPC.\n */\nexport function generateCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __generateCheckoutSession({ 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.GenerateCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateCheckoutSession;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAAA;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,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;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;AAYd,SAAS,wBACd,SAC4B;AAC5B,WAAS,0BAA0B,EAAE,KAAK,GAAQ;AAChD,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;;;ADoCO,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AANG,SAAAA;AAAA,GAAA;AA0LL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAKjB,EAAAA,aAAA,2BAAwB;AAKxB,EAAAA,aAAA,wBAAqB;AAZX,SAAAA;AAAA,GAAA;AAwEZ,eAAsBC,yBACpB,MAWA,SASA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,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;","names":["generateCheckoutSession","SubscriptionFrequency","WebhookType","generateCheckoutSession","sdkTransformError"]}
|
|
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 Wix-hosted checkout page generated for a specific set of line items. */\nexport interface CheckoutSession {\n /**\n * Checkout session ID.\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page\n * as an anonymous shopper, and any session held by the calling app isn't carried over.\n *\n * The URL carries query parameters Wix needs to render the page correctly (for example, a\n * `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the\n * buyer unchanged. Don't strip, reorder, rewrite, or otherwise mutate its query string.\n * @readonly\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to create a checkout session. */\nexport interface GenerateCheckoutSessionRequest {\n /** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\n cart: Cart;\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/**\n * Recurring subscription configuration for a line item.\n *\n * `LineItem.name` and `subscriptionInfo.title`/`description` render in different parts of the\n * Wix-hosted checkout page: `LineItem.name` is the line label in the cart-summary list, while\n * `subscriptionInfo.title` and `subscriptionInfo.description` are the heading and body text on the\n * recurring-billing summary block (the area that shows the buyer the cadence and the free-trial terms,\n * if any). Set them to complementary values rather than duplicating `LineItem.name`.\n */\nexport interface SubscriptionInfo {\n /**\n * Billing frequency, cycles, and free trial configuration. Required when `subscriptionInfo` is set on a\n * line item.\n */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription name shown to the buyer in the recurring-billing summary block on the Wix-hosted\n * checkout page (the heading of that block).\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer in the recurring-billing summary block on the\n * Wix-hosted checkout page (the body text below the title).\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/**\n * Configuration for recurring subscription charges.\n *\n * `autoRenewal` and `billingCycles` are mutually exclusive. `autoRenewal: true` describes an\n * open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term\n * subscription that stops after N charges. Setting `autoRenewal: true` together with any\n * `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code\n * `AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT`).\n */\nexport interface SubscriptionSettings {\n /** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. For `DAY` frequency, the minimum is 7. The shortest\n * billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with\n * `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`.\n *\n * Note that `freeTrialPeriod.interval` doesn't share this floor: a `DAY` trial may have\n * `interval` as low as 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /**\n * Whether the subscription renews automatically. Can't be `true` when `billingCycles` is set.\n *\n * Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles`\n * is set and `autoRenewal` is omitted.\n */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles before the subscription stops. Can't be set when `autoRenewal` is `true`.\n *\n * When omitted along with `autoRenewal`, 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 /** Unknown frequency. */\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/**\n * Free trial period before the first subscription charge.\n *\n * The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it\n * describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A\n * `frequency: MONTH` + `interval: 3` trial means \"a single 3-month trial,\" not \"billed every 3\n * months.\"\n */\nexport interface FreeTrialPeriod {\n /**\n * Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be\n * treated as a client mistake and isn't a valid runtime value.\n */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY`\n * gives a 14-day trial.\n *\n * Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1`. No weekly floor applies\n * to the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code\n * `MIN_VALUE`).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface PhysicalProperties {\n /** Whether the item requires shipping. */\n shippable?: boolean | null;\n}\n\nexport interface LineItem {\n /**\n * Name of the item, shown on the checkout page.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item to charge for.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Per-unit price as a decimal string in the merchant account currency. For example, `\"19.99\"`.\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /**\n * Subscription configuration. When set, the line item follows a scheduled-billing model defined by\n * `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing\n * cycle is `price × quantity`, and `quantity` is locked at session creation.\n *\n * At most 1 line item per request may set `subscriptionInfo`. Wix rejects requests with 2 or more\n * subscription line items with `MULTIPLE_SUBSCRIPTION_ITEMS`.\n */\n subscriptionInfo?: SubscriptionInfo;\n /** Optional. Physical properties of the item, used when the item requires shipping. */\n physicalProperties?: PhysicalProperties;\n}\n\n/**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\nexport interface CustomerInfo {\n /**\n * Buyer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Buyer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Buyer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Buyer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\n/** Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details. */\nexport interface Cart {\n /**\n * Line items the buyer is paying for in this checkout session.\n *\n * At most 1 subscription line item (an item with `subscriptionInfo` set) is allowed per request.\n * Wix rejects requests with 2 or more subscription items. Non-recurring items can be combined with a\n * single subscription item. In that case the buyer is charged once at checkout for the non-recurring\n * items and, if applicable, the first cycle of the subscription. Wix bills any subsequent cycles on\n * the subscription's own schedule.\n * @maxSize 100\n */\n items?: LineItem[];\n /**\n * Buyer details used to pre-fill the checkout form. The buyer can edit any of these fields on the\n * Wix checkout page.\n */\n customerInfo?: CustomerInfo;\n}\n\n/**\n * URLs the buyer is redirected to after the checkout flow.\n *\n * The buyer is sent to one of the URLs below: `continueBrowsingUrl` if they explicitly leave via\n * **Continue browsing**, or `thankYouPageUrl` after a successful payment.\n *\n * If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no\n * callback URL is invoked and the checkout session isn't resumed.\n */\nexport interface CallbackUrls {\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment, either when they click **Continue browsing** or when they navigate back to\n * a cart-style page.\n *\n * Deprecated. Use `continueBrowsingUrl` instead.\n * @format WEB_URL\n * @deprecated\n * @replacedBy continue_browsing_url\n */\n postFlowUrl?: string | null;\n /**\n * URL the buyer is redirected to after a successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n /**\n * URL the buyer is redirected to from the Wix checkout page when they choose to leave without\n * completing payment, either when they click **Continue browsing** or when they navigate back to\n * a cart-style page.\n * @format WEB_URL\n */\n continueBrowsingUrl?: string | null;\n}\n\n/** Response after creating a checkout session. */\nexport interface GenerateCheckoutSessionResponse {\n /** The created checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. Default: `[ORDER_APPROVED]`.\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Webhook event types to register. */\nexport enum WebhookType {\n /** Order Approved webhook (`wix.ecom.v1.order_approved`). */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /**\n * Subscription Contract Canceled webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_canceled`).\n */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /**\n * Subscription Contract Expired webhook\n * (`wix.ecom.subscription_contracts.v1.subscription_contract_expired`).\n */\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 * PEM-formatted RS256 public key used to verify the JWT signature on incoming webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/** @docsIgnore */\nexport type GenerateCheckoutSessionApplicationErrors =\n | {\n code?: 'MULTIPLE_SUBSCRIPTION_ITEMS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'AUTO_RENEWAL_AND_BILLING_CYCLES_CONFLICT';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items.\n * and `id`.\n *\n * Each call creates a new, independent session. The method isn't idempotent, so a retry produces\n * an additional session rather than recovering the prior one.\n * @param cart - Items, quantities, and prices the buyer is paying for, plus optional pre-fill customer details.\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 cart.items.subscriptionInfo.subscriptionSettings\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency\n * @requiredField cart.items.subscriptionInfo.subscriptionSettings.frequency\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @permissionId payments:platform:v1:checkout_session:generate_checkout_session\n * @returns Response after creating a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.GenerateCheckoutSession\n */\nexport async function generateCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`\n | `items.${number}.subscriptionInfo.subscriptionSettings`\n | `items.${number}.subscriptionInfo.subscriptionSettings.freeTrialPeriod.frequency`\n | `items.${number}.subscriptionInfo.subscriptionSettings.frequency`,\n 7\n >,\n options: NonNullablePaths<\n GenerateCheckoutSessionOptions,\n `callbackUrls` | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<\n GenerateCheckoutSessionResponse & {\n __applicationErrorsType?: GenerateCheckoutSessionApplicationErrors;\n }\n> {\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.generateCheckoutSession(\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 GenerateCheckoutSessionOptions {\n /** URLs the buyer is redirected to after completing or leaving the checkout flow. */\n callbackUrls: CallbackUrls;\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 'manage._base_domain_': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n 'manage.base44.com': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n 'payments.base44.com': [\n {\n srcPath: '/_api/checkout-sessions',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/**\n * Creates a Wix-hosted checkout session for the supplied line items.\n * and `id`.\n *\n * Each call creates a new, independent session. The method isn't idempotent, so a retry produces\n * an additional session rather than recovering the prior one.\n */\nexport function generateCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __generateCheckoutSession({ 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.GenerateCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateCheckoutSession;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAAA;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,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,uBAAuB;AAAA,MACrB;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;AASd,SAAS,wBACd,SAC4B;AAC5B,WAAS,0BAA0B,EAAE,KAAK,GAAQ;AAChD,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;;;ADiCO,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AANG,SAAAA;AAAA,GAAA;AAwLL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAKjB,EAAAA,aAAA,2BAAwB;AAKxB,EAAAA,aAAA,wBAAqB;AAZX,SAAAA;AAAA,GAAA;AAqEZ,eAAsBC,yBACpB,MAWA,SASA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,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;","names":["generateCheckoutSession","SubscriptionFrequency","WebhookType","generateCheckoutSession","sdkTransformError"]}
|
package/build/cjs/meta.d.ts
CHANGED
|
@@ -4,18 +4,18 @@ import '@wix/sdk-types';
|
|
|
4
4
|
/** A Wix-hosted checkout page generated for a specific set of line items. */
|
|
5
5
|
interface CheckoutSession {
|
|
6
6
|
/**
|
|
7
|
-
* Checkout session ID
|
|
7
|
+
* Checkout session ID.
|
|
8
8
|
* @readonly
|
|
9
9
|
* @format GUID
|
|
10
10
|
*/
|
|
11
11
|
id?: string | null;
|
|
12
12
|
/**
|
|
13
|
-
* URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page
|
|
14
|
-
* an anonymous shopper
|
|
13
|
+
* URL of the Wix-hosted checkout page where the buyer completes payment. The buyer enters the page
|
|
14
|
+
* as an anonymous shopper, and any session held by the calling app isn't carried over.
|
|
15
15
|
*
|
|
16
|
-
* The URL carries query parameters Wix needs
|
|
16
|
+
* The URL carries query parameters Wix needs to render the page correctly (for example, a
|
|
17
17
|
* `successUrl` parameter derived from `callbackUrls.thankYouPageUrl`). Pass the URL through to the
|
|
18
|
-
* buyer unchanged
|
|
18
|
+
* buyer unchanged. Don't strip, reorder, rewrite, or otherwise mutate its query string.
|
|
19
19
|
* @readonly
|
|
20
20
|
* @format WEB_URL
|
|
21
21
|
*/
|
|
@@ -59,7 +59,7 @@ interface SubscriptionInfo {
|
|
|
59
59
|
/**
|
|
60
60
|
* Configuration for recurring subscription charges.
|
|
61
61
|
*
|
|
62
|
-
* `autoRenewal` and `billingCycles` are mutually exclusive
|
|
62
|
+
* `autoRenewal` and `billingCycles` are mutually exclusive. `autoRenewal: true` describes an
|
|
63
63
|
* open-ended subscription that renews indefinitely, while `billingCycles: N` describes a fixed-term
|
|
64
64
|
* subscription that stops after N charges. Setting `autoRenewal: true` together with any
|
|
65
65
|
* `billingCycles` value is rejected with `INVALID_ARGUMENT` (application code
|
|
@@ -69,25 +69,25 @@ interface SubscriptionSettings {
|
|
|
69
69
|
/** Billing frequency unit. Required when `subscriptionSettings` is set; `UNDEFINED` is rejected. */
|
|
70
70
|
frequency?: SubscriptionFrequencyWithLiterals;
|
|
71
71
|
/**
|
|
72
|
-
* Number of frequency units between charges. For `DAY` frequency, the minimum is 7
|
|
72
|
+
* Number of frequency units between charges. For `DAY` frequency, the minimum is 7. The shortest
|
|
73
73
|
* billing cadence supported is weekly; values 1–6 with `frequency: DAY` are rejected with
|
|
74
74
|
* `INVALID_ARGUMENT` (rule code `MIN_VALUE`). Default: `1`.
|
|
75
75
|
*
|
|
76
|
-
* Note that `freeTrialPeriod.interval`
|
|
76
|
+
* Note that `freeTrialPeriod.interval` doesn't share this floor: a `DAY` trial may have
|
|
77
77
|
* `interval` as low as 1.
|
|
78
78
|
* @min 1
|
|
79
79
|
* @max 3650
|
|
80
80
|
*/
|
|
81
81
|
interval?: number | null;
|
|
82
82
|
/**
|
|
83
|
-
* Whether the subscription renews automatically.
|
|
83
|
+
* Whether the subscription renews automatically. Can't be `true` when `billingCycles` is set.
|
|
84
84
|
*
|
|
85
85
|
* Default: `true` when both `autoRenewal` and `billingCycles` are omitted; `false` when `billingCycles`
|
|
86
86
|
* is set and `autoRenewal` is omitted.
|
|
87
87
|
*/
|
|
88
88
|
autoRenewal?: boolean | null;
|
|
89
89
|
/**
|
|
90
|
-
* Number of billing cycles before the subscription stops.
|
|
90
|
+
* Number of billing cycles before the subscription stops. Can't be set when `autoRenewal` is `true`.
|
|
91
91
|
*
|
|
92
92
|
* When omitted along with `autoRenewal`, the subscription renews indefinitely.
|
|
93
93
|
* @min 1
|
|
@@ -112,21 +112,21 @@ type SubscriptionFrequencyWithLiterals = SubscriptionFrequency | 'UNDEFINED' | '
|
|
|
112
112
|
*
|
|
113
113
|
* The `frequency` enum is shared with `SubscriptionSettings.frequency` for convenience, but here it
|
|
114
114
|
* describes a one-off duration unit (the length of the trial), not a recurring billing cadence. A
|
|
115
|
-
* `frequency: MONTH` + `interval: 3` trial means "a single 3-month trial," not "billed every
|
|
115
|
+
* `frequency: MONTH` + `interval: 3` trial means "a single 3-month trial," not "billed every 3
|
|
116
116
|
* months."
|
|
117
117
|
*/
|
|
118
118
|
interface FreeTrialPeriod {
|
|
119
119
|
/**
|
|
120
120
|
* Trial period frequency unit. Required when `freeTrialPeriod` is set; `UNDEFINED` should be
|
|
121
|
-
* treated as a client mistake and
|
|
121
|
+
* treated as a client mistake and isn't a valid runtime value.
|
|
122
122
|
*/
|
|
123
123
|
frequency?: SubscriptionFrequencyWithLiterals;
|
|
124
124
|
/**
|
|
125
125
|
* Length of the trial period in `frequency` units. For example, `interval: 14` with `frequency: DAY`
|
|
126
126
|
* gives a 14-day trial.
|
|
127
127
|
*
|
|
128
|
-
* Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1
|
|
129
|
-
*
|
|
128
|
+
* Unlike `SubscriptionSettings.interval`, this field's `DAY` floor is `1`. No weekly floor applies
|
|
129
|
+
* to the trial length. Values ≤ 0 are rejected with `INVALID_ARGUMENT` (rule code
|
|
130
130
|
* `MIN_VALUE`).
|
|
131
131
|
* @min 1
|
|
132
132
|
* @max 999
|
|
@@ -160,8 +160,8 @@ interface LineItem {
|
|
|
160
160
|
* `subscriptionSettings` instead of a single immediate charge. The recurring charge each billing
|
|
161
161
|
* cycle is `price × quantity`, and `quantity` is locked at session creation.
|
|
162
162
|
*
|
|
163
|
-
* At most
|
|
164
|
-
* subscription line items
|
|
163
|
+
* At most 1 line item per request may set `subscriptionInfo`. Wix rejects requests with 2 or more
|
|
164
|
+
* subscription line items with `MULTIPLE_SUBSCRIPTION_ITEMS`.
|
|
165
165
|
*/
|
|
166
166
|
subscriptionInfo?: SubscriptionInfo;
|
|
167
167
|
/** Optional. Physical properties of the item, used when the item requires shipping. */
|
|
@@ -198,10 +198,10 @@ interface Cart {
|
|
|
198
198
|
/**
|
|
199
199
|
* Line items the buyer is paying for in this checkout session.
|
|
200
200
|
*
|
|
201
|
-
* At most
|
|
202
|
-
*
|
|
203
|
-
* single subscription item
|
|
204
|
-
* and
|
|
201
|
+
* At most 1 subscription line item (an item with `subscriptionInfo` set) is allowed per request.
|
|
202
|
+
* Wix rejects requests with 2 or more subscription items. Non-recurring items can be combined with a
|
|
203
|
+
* single subscription item. In that case the buyer is charged once at checkout for the non-recurring
|
|
204
|
+
* items and, if applicable, the first cycle of the subscription. Wix bills any subsequent cycles on
|
|
205
205
|
* the subscription's own schedule.
|
|
206
206
|
* @maxSize 100
|
|
207
207
|
*/
|
|
@@ -215,16 +215,16 @@ interface Cart {
|
|
|
215
215
|
/**
|
|
216
216
|
* URLs the buyer is redirected to after the checkout flow.
|
|
217
217
|
*
|
|
218
|
-
* The buyer is sent to one of the URLs below
|
|
219
|
-
* **Continue browsing**, `thankYouPageUrl` after a successful payment.
|
|
218
|
+
* The buyer is sent to one of the URLs below: `continueBrowsingUrl` if they explicitly leave via
|
|
219
|
+
* **Continue browsing**, or `thankYouPageUrl` after a successful payment.
|
|
220
220
|
*
|
|
221
221
|
* If the buyer abandons the page implicitly (closing the tab, navigating away, network failure), no
|
|
222
|
-
* callback URL is invoked and the checkout session
|
|
222
|
+
* callback URL is invoked and the checkout session isn't resumed.
|
|
223
223
|
*/
|
|
224
224
|
interface CallbackUrls {
|
|
225
225
|
/**
|
|
226
226
|
* URL the buyer is redirected to from the Wix checkout page when they choose to leave without
|
|
227
|
-
* completing payment
|
|
227
|
+
* completing payment, either when they click **Continue browsing** or when they navigate back to
|
|
228
228
|
* a cart-style page.
|
|
229
229
|
*
|
|
230
230
|
* Deprecated. Use `continueBrowsingUrl` instead.
|
|
@@ -240,10 +240,8 @@ interface CallbackUrls {
|
|
|
240
240
|
thankYouPageUrl?: string | null;
|
|
241
241
|
/**
|
|
242
242
|
* URL the buyer is redirected to from the Wix checkout page when they choose to leave without
|
|
243
|
-
* completing payment
|
|
243
|
+
* completing payment, either when they click **Continue browsing** or when they navigate back to
|
|
244
244
|
* a cart-style page.
|
|
245
|
-
*
|
|
246
|
-
* Required unless the deprecated `postFlowUrl` is supplied.
|
|
247
245
|
* @format WEB_URL
|
|
248
246
|
*/
|
|
249
247
|
continueBrowsingUrl?: string | null;
|
package/build/cjs/meta.js
CHANGED
|
@@ -51,6 +51,12 @@ function resolveWixPaymentsPlatformV1CheckoutSessionsUrl(opts) {
|
|
|
51
51
|
srcPath: "/_api/checkout-sessions",
|
|
52
52
|
destPath: ""
|
|
53
53
|
}
|
|
54
|
+
],
|
|
55
|
+
"payments.base44.com": [
|
|
56
|
+
{
|
|
57
|
+
srcPath: "/_api/checkout-sessions",
|
|
58
|
+
destPath: ""
|
|
59
|
+
}
|
|
54
60
|
]
|
|
55
61
|
};
|
|
56
62
|
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|