commerce-sdk-isomorphic 4.0.0-nightly-20251021080814 → 4.0.0-nightly-20251023080805

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/lib/helpers.cjs.js +1 -1
  2. package/lib/helpers.js +1 -1
  3. package/lib/index.cjs.d.ts +1034 -21
  4. package/lib/index.cjs.js +1 -1
  5. package/lib/index.esm.d.ts +1034 -21
  6. package/lib/index.esm.js +1 -1
  7. package/lib/shopperBaskets.cjs.js +1 -1
  8. package/lib/shopperBaskets.js +1 -1
  9. package/lib/shopperBasketsv2.cjs.d.ts +59 -1
  10. package/lib/shopperBasketsv2.cjs.js +1 -1
  11. package/lib/shopperBasketsv2.d.ts +59 -1
  12. package/lib/shopperBasketsv2.js +1 -1
  13. package/lib/shopperConfigurations.cjs.js +1 -1
  14. package/lib/shopperConfigurations.js +1 -1
  15. package/lib/shopperConsents.cjs.js +1 -1
  16. package/lib/shopperConsents.js +1 -1
  17. package/lib/shopperContext.cjs.js +1 -1
  18. package/lib/shopperContext.js +1 -1
  19. package/lib/shopperCustomers.cjs.js +1 -1
  20. package/lib/shopperCustomers.js +1 -1
  21. package/lib/shopperExperience.cjs.js +1 -1
  22. package/lib/shopperExperience.js +1 -1
  23. package/lib/shopperGiftCertificates.cjs.js +1 -1
  24. package/lib/shopperGiftCertificates.js +1 -1
  25. package/lib/shopperLogin.cjs.js +1 -1
  26. package/lib/shopperLogin.js +1 -1
  27. package/lib/shopperOrders.cjs.d.ts +59 -1
  28. package/lib/shopperOrders.cjs.js +1 -1
  29. package/lib/shopperOrders.d.ts +59 -1
  30. package/lib/shopperOrders.js +1 -1
  31. package/lib/shopperPayments.cjs.d.ts +1010 -0
  32. package/lib/shopperPayments.cjs.js +1 -0
  33. package/lib/shopperPayments.d.ts +1010 -0
  34. package/lib/shopperPayments.js +1 -0
  35. package/lib/shopperProducts.cjs.js +1 -1
  36. package/lib/shopperProducts.js +1 -1
  37. package/lib/shopperPromotions.cjs.js +1 -1
  38. package/lib/shopperPromotions.js +1 -1
  39. package/lib/shopperSearch.cjs.js +1 -1
  40. package/lib/shopperSearch.js +1 -1
  41. package/lib/shopperSeo.cjs.js +1 -1
  42. package/lib/shopperSeo.js +1 -1
  43. package/lib/shopperStores.cjs.js +1 -1
  44. package/lib/shopperStores.js +1 -1
  45. package/lib/version.cjs.d.ts +1 -1
  46. package/lib/version.cjs.js +1 -1
  47. package/lib/version.d.ts +1 -1
  48. package/lib/version.js +1 -1
  49. package/package.json +2 -2
@@ -0,0 +1,1010 @@
1
+ /*
2
+ * Copyright (c) 2021, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { RequestInit as NodeRequestInit } from "node-fetch";
8
+ /*
9
+ * Copyright (c) 2025, Salesforce, Inc.
10
+ * All rights reserved.
11
+ * SPDX-License-Identifier: BSD-3-Clause
12
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
13
+ */
14
+ declare const defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/checkout/shopper-payments/v1";
15
+ /**
16
+ * Makes a type easier to read.
17
+ */
18
+ type Prettify<T> = NonNullable<{
19
+ [K in keyof T]: T[K];
20
+ }>;
21
+ /**
22
+ * Generates the types required on a method, based on those provided in the config.
23
+ */
24
+ type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
25
+ /**
26
+ * If an object has a `parameters` property, and the `parameters` object has required properties,
27
+ * then the `parameters` property on the root object is marked as required.
28
+ */
29
+ type RequireParametersUnlessAllAreOptional<T extends {
30
+ parameters?: Record<string, unknown>;
31
+ }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
32
+ /**
33
+ * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
34
+ * if not specified.
35
+ */
36
+ interface BaseUriParameters {
37
+ shortCode: string;
38
+ }
39
+ type LocaleCode = {
40
+ [key: string]: any;
41
+ };
42
+ /**
43
+ * Generic interface for path parameters.
44
+ */
45
+ interface PathParameters {
46
+ [key: string]: string | number | boolean;
47
+ }
48
+ /**
49
+ * Generic interface for query parameters.
50
+ */
51
+ interface QueryParameters {
52
+ [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
53
+ }
54
+ /**
55
+ * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
56
+ * it from the `RequestInit` provided by node-fetch.
57
+ */
58
+ type BrowserRequestInit = RequestInit;
59
+ /**
60
+ * Any properties supported in either the browser or node are accepted.
61
+ * Using the right properties in the right context is left to the user.
62
+ */
63
+ type FetchOptions = NodeRequestInit & BrowserRequestInit;
64
+ /**
65
+ * Base options that can be passed to the `ClientConfig` class.
66
+ */
67
+ interface ClientConfigInit<Params extends BaseUriParameters> {
68
+ baseUri?: string;
69
+ proxy?: string;
70
+ headers?: {
71
+ [key: string]: string;
72
+ };
73
+ parameters: Params;
74
+ fetchOptions?: FetchOptions;
75
+ transformRequest?: (data: unknown, headers: {
76
+ [key: string]: string;
77
+ }) => Required<FetchOptions>["body"];
78
+ throwOnBadResponse?: boolean;
79
+ }
80
+ /**
81
+ * Configuration parameters common to Commerce SDK clients
82
+ */
83
+ declare class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
84
+ baseUri?: string;
85
+ proxy?: string;
86
+ headers: {
87
+ [key: string]: string;
88
+ };
89
+ parameters: Params;
90
+ fetchOptions: FetchOptions;
91
+ transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
92
+ throwOnBadResponse: boolean;
93
+ constructor(config: ClientConfigInit<Params>);
94
+ static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
95
+ }
96
+ /**
97
+ * A specialized value indicating the lack of definition of a currency, for example, if the value of the monetary value of the currency is an undefined number.
98
+ */
99
+ type NoValue = "N/A";
100
+ /**
101
+ * @type CurrencyCode
102
+ * A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
103
+ */
104
+ type CurrencyCode = NoValue | string;
105
+ /**
106
+ * @type PaymentConfigurationPaymentMethodsInner:
107
+ *
108
+ * @property accountId: Associated account identifier
109
+ * - **Min Length:** 1
110
+ *
111
+ * @property paymentMethodType: Type of payment method
112
+ *
113
+ * @property paymentModes: Supported payment modes
114
+ *
115
+ */
116
+ type PaymentConfigurationPaymentMethodsInner = {
117
+ accountId: string;
118
+ paymentMethodType: string;
119
+ paymentModes: Array<string>;
120
+ } & {
121
+ [key: string]: any;
122
+ };
123
+ /**
124
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner:
125
+ *
126
+ * @property brands: Supported card brands
127
+ *
128
+ * @property type: Payment method type
129
+ *
130
+ */
131
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner = {
132
+ brands?: Array<string>;
133
+ type?: string;
134
+ } & {
135
+ [key: string]: any;
136
+ };
137
+ /**
138
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse: Gateway response data (optional, can be null)
139
+ *
140
+ * @property paymentMethods: Available payment methods from gateway
141
+ *
142
+ */
143
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse = {
144
+ paymentMethods?: Array<PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner>;
145
+ } & {
146
+ [key: string]: any;
147
+ };
148
+ /**
149
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerConfig: Account configuration
150
+ *
151
+ * @property key: API key for the payment processor
152
+ * - **Max Length:** 200
153
+ *
154
+ */
155
+ type PaymentConfigurationPaymentMethodSetAccountsInnerConfig = {
156
+ key?: string;
157
+ } & {
158
+ [key: string]: any;
159
+ };
160
+ /**
161
+ * @type PaymentConfigurationPaymentMethodSetAccountsInner:
162
+ *
163
+ * @property accountId: Account identifier
164
+ * - **Min Length:** 1
165
+ * - **Max Length:** 100
166
+ *
167
+ * @property config:
168
+ *
169
+ * @property gatewayId: Gateway identifier
170
+ * - **Min Length:** 1
171
+ *
172
+ * @property gatewayResponse:
173
+ *
174
+ * @property isLive: Whether the account is in live mode
175
+ *
176
+ * @property vendor: Payment vendor name
177
+ *
178
+ */
179
+ type PaymentConfigurationPaymentMethodSetAccountsInner = {
180
+ accountId: string;
181
+ config?: PaymentConfigurationPaymentMethodSetAccountsInnerConfig;
182
+ gatewayId: string;
183
+ gatewayResponse?: PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse | null;
184
+ isLive: boolean;
185
+ vendor: string;
186
+ } & {
187
+ [key: string]: any;
188
+ };
189
+ /**
190
+ * @type PaymentConfiguration:
191
+ *
192
+ * @property zoneId: The unique identifier for a Payments zone.
193
+ * - **Pattern:** /^[a-zA-Z0-9\\-_]{1,100}$/
194
+ * - **Min Length:** 1
195
+ * - **Max Length:** 100
196
+ *
197
+ * @property paymentMethodSetAccounts: List of payment method set accounts
198
+ *
199
+ * @property paymentMethods: Configured payment methods
200
+ *
201
+ * @property sdkVersion: SDK version to use
202
+ *
203
+ */
204
+ type PaymentConfiguration = {
205
+ zoneId?: string | null;
206
+ paymentMethodSetAccounts: Array<PaymentConfigurationPaymentMethodSetAccountsInner>;
207
+ paymentMethods: Array<PaymentConfigurationPaymentMethodsInner>;
208
+ sdkVersion: string;
209
+ } & {
210
+ [key: string]: any;
211
+ };
212
+ type getPaymentConfigurationQueryParameters = {
213
+ siteId: string;
214
+ currency: CurrencyCode;
215
+ countryCode: string;
216
+ };
217
+ type getPaymentConfigurationPathParameters = {
218
+ organizationId: string;
219
+ };
220
+ /**
221
+ * All path parameters that are used by at least one ShopperPayments method.
222
+ */
223
+ type ShopperPaymentsPathParameters = Partial<getPaymentConfigurationPathParameters & {}>;
224
+ /**
225
+ * All query parameters that are used by at least one ShopperPayments method.
226
+ */
227
+ type ShopperPaymentsQueryParameters = Partial<getPaymentConfigurationQueryParameters & {}>;
228
+ /**
229
+ * All parameters that are used by ShopperPayments.
230
+ */
231
+ type ShopperPaymentsParameters = ShopperPaymentsPathParameters & BaseUriParameters & ShopperPaymentsQueryParameters;
232
+ /**
233
+ * [Shopper Payments](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-payments:Summary)
234
+ * ==================================
235
+ *
236
+ * *# API Overview
237
+
238
+ Use the Shopper Payments API to retrieve payment configuration information for organizations in the B2C Commerce system.
239
+
240
+ The Shopper Payments API provides access to comprehensive payment configuration data, including payment processor settings, gateway configurations, and payment method details.
241
+
242
+ ## Key Features
243
+
244
+ The Shopper Payments API includes the following capabilities:
245
+
246
+ - **Payment Configuration Retrieval**: Get complete payment configuration for an organization
247
+ - **Payment Method Set Information**: Access details about configured payment method set accounts
248
+ - **Gateway Response Data**: Retrieve payment processor gateway information and supported payment methods
249
+ - **Payment Modes Configuration**: View supported payment modes (Multistep, Express) for each payment method
250
+ - **SDK Version Information**: Get the current SDK version being used
251
+
252
+ ## Payment Configuration Endpoint
253
+
254
+ The main endpoint `/organizations/{organizationId}/payment-configuration` provides:
255
+
256
+ ### Configuration Settings
257
+ - Multi-step checkout enablement status
258
+ - Express checkout enablement status
259
+ - Automatic card capture settings
260
+ - Zone identification
261
+ - Saved payment method configuration
262
+ - Merchant account identification
263
+
264
+ ### Payment Method Set Accounts
265
+ - Account identifiers and configurations
266
+ - Payment processor API keys and settings
267
+ - Gateway identifiers and response data
268
+ - Live/test mode indicators
269
+ - Vendor information (Stripe, Adyen, PayPal, etc.)
270
+
271
+ ### Payment Methods
272
+ - Supported payment method types (card, paypal, applepay, etc.)
273
+ - Available payment modes for each method
274
+ - Account associations
275
+
276
+ ## Gateway Response Handling
277
+
278
+ The API handles varying gateway response formats:
279
+ - **Active Gateways**: Return detailed payment method information including supported card brands
280
+ - **Inactive/Pending Gateways**: May return null gateway response data
281
+ - **Multiple Vendors**: Support for different payment processors with vendor-specific configurations
282
+
283
+ ## Authentication & Authorization
284
+
285
+ The client requesting payment configuration information must have access to the `/payment-configuration` resource. The Shopper Payments API requires a shopper access token from the Shopper Login and API Access Service (SLAS).
286
+
287
+ For details on how to request a shopper access token from SLAS, see the guest user flows for [public clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-public-client.html#guest-user) and [private clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-private-client.html#guest-user) in the SLAS guides.
288
+
289
+ You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see the [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)
290
+
291
+ ## Getting Started
292
+
293
+ To use the Shopper Payments API:
294
+
295
+ 1. Authenticate with the appropriate scopes (`sfcc.shopper-payments.rw`)
296
+ 2. Make a GET request to `/organizations/{organizationId}/payment-configuration`
297
+ 3. Process the returned payment configuration data for your application
298
+
299
+ ## Use Cases
300
+
301
+ ### Payment Method Discovery
302
+ Retrieve available payment methods and their capabilities for dynamic payment form generation.
303
+
304
+ ### Gateway Status Monitoring
305
+ Check the status and configuration of payment gateways and processors.
306
+
307
+ ### Payment Flow Configuration
308
+ Determine supported payment modes (multi-step vs express) for different payment methods.
309
+
310
+ ### SDK Version Management
311
+ Ensure compatibility by checking the current SDK version requirements.
312
+
313
+ For detailed implementation examples and best practices, refer to the Commerce Cloud documentation. *<br />
314
+ *
315
+ * Simple example:
316
+ *
317
+ * ```typescript
318
+ * import { ShopperPayments } from "commerce-sdk-isomorphic";
319
+ *
320
+ * const clientConfig = {
321
+ * parameters: {
322
+ * clientId: "XXXXXX",
323
+ * organizationId: "XXXX",
324
+ * shortCode: "XXX",
325
+ * siteId: "XX"
326
+ * }
327
+ * };
328
+ * const shopperPaymentsClient = new ShopperPayments(clientConfig);
329
+ * ```
330
+ *
331
+ * <span style="font-size:.7em; display:block; text-align: right">
332
+ * API Version: 0.0.33<br />
333
+ * Last Updated: <br />
334
+ * </span>
335
+ *
336
+ *
337
+ */
338
+ declare class ShopperPayments<ConfigParameters extends ShopperPaymentsParameters & Record<string, unknown>> {
339
+ // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
340
+ clientConfig: ClientConfig<ConfigParameters> & {
341
+ baseUri: string;
342
+ };
343
+ static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/checkout/shopper-payments/v1";
344
+ static readonly apiPaths: {
345
+ getPaymentConfiguration: string;
346
+ };
347
+ constructor(config: ClientConfigInit<ConfigParameters>);
348
+ static readonly paramKeys: {
349
+ readonly getPaymentConfiguration: readonly [
350
+ "organizationId",
351
+ "siteId",
352
+ "currency",
353
+ "countryCode"
354
+ ];
355
+ readonly getPaymentConfigurationRequired: readonly [
356
+ "organizationId",
357
+ "siteId",
358
+ "currency",
359
+ "countryCode"
360
+ ];
361
+ };
362
+ /**
363
+ * Retrieves the payment configuration for the organization.
364
+
365
+ **Parameters:**
366
+ - `siteId`: Required. The site identifier for context-specific configuration
367
+ - `currency`: Required. Three-letter currency code (ISO 4217) for payment method configuration
368
+ - `countryCode`: Required. Two-letter country code (ISO 3166-1 alpha-2) for country-specific payment configuration
369
+
370
+ **Response Behavior:**
371
+ - Returns payment configuration data when available
372
+ - Returns null values for missing data (e.g., when account not found or payments zone not found)
373
+ *
374
+ * If you would like to get a raw Response object use the other getPaymentConfiguration function.
375
+ *
376
+ * @param options - An object containing the options for this method.
377
+ * @param options.parameters - An object containing the parameters for this method.
378
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
379
+ * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
380
+ * @param options.parameters.currency - A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
381
+ * @param options.parameters.countryCode - The country code (ISO 3166-1 alpha-2) for country-specific payment configuration filtering
382
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
383
+ *
384
+ * @returns A promise of type PaymentConfiguration.
385
+ */
386
+ getPaymentConfiguration(options?: RequireParametersUnlessAllAreOptional<{
387
+ parameters?: CompositeParameters<{
388
+ organizationId: string;
389
+ siteId: string;
390
+ currency: CurrencyCode;
391
+ countryCode: string;
392
+ } & QueryParameters, ConfigParameters>;
393
+ headers?: {
394
+ [key: string]: string;
395
+ };
396
+ }>): Promise<PaymentConfiguration>;
397
+ /**
398
+ * Retrieves the payment configuration for the organization.
399
+
400
+ **Parameters:**
401
+ - `siteId`: Required. The site identifier for context-specific configuration
402
+ - `currency`: Required. Three-letter currency code (ISO 4217) for payment method configuration
403
+ - `countryCode`: Required. Two-letter country code (ISO 3166-1 alpha-2) for country-specific payment configuration
404
+
405
+ **Response Behavior:**
406
+ - Returns payment configuration data when available
407
+ - Returns null values for missing data (e.g., when account not found or payments zone not found)
408
+ *
409
+ * @param options - An object containing the options for this method.
410
+ * @param options.parameters - An object containing the parameters for this method.
411
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
412
+ * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
413
+ * @param options.parameters.currency - A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
414
+ * @param options.parameters.countryCode - The country code (ISO 3166-1 alpha-2) for country-specific payment configuration filtering
415
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
416
+ * @param rawResponse - Set to true to return entire Response object instead of DTO.
417
+ *
418
+ * @returns A promise of type Response if rawResponse is true, a promise of type PaymentConfiguration otherwise.
419
+ */
420
+ getPaymentConfiguration<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
421
+ parameters?: CompositeParameters<{
422
+ organizationId: string;
423
+ siteId: string;
424
+ currency: CurrencyCode;
425
+ countryCode: string;
426
+ } & QueryParameters, ConfigParameters>;
427
+ headers?: {
428
+ [key: string]: string;
429
+ };
430
+ }>, rawResponse?: T): Promise<T extends true ? Response : PaymentConfiguration>;
431
+ }
432
+ declare namespace ShopperPaymentsApiTypes {
433
+ /*
434
+ * Copyright (c) 2023, Salesforce, Inc.
435
+ * All rights reserved.
436
+ * SPDX-License-Identifier: BSD-3-Clause
437
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
438
+ */
439
+ /**
440
+ * Makes a type easier to read.
441
+ */
442
+ type Prettify<T> = NonNullable<{
443
+ [K in keyof T]: T[K];
444
+ }>;
445
+ /**
446
+ * Generates the types required on a method, based on those provided in the config.
447
+ */
448
+ type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
449
+ /**
450
+ * If an object has a `parameters` property, and the `parameters` object has required properties,
451
+ * then the `parameters` property on the root object is marked as required.
452
+ */
453
+ type RequireParametersUnlessAllAreOptional<T extends {
454
+ parameters?: Record<string, unknown>;
455
+ }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
456
+ /**
457
+ * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
458
+ * if not specified.
459
+ */
460
+ interface BaseUriParameters {
461
+ shortCode: string;
462
+ }
463
+ type LocaleCode = {
464
+ [key: string]: any;
465
+ };
466
+ /**
467
+ * Generic interface for path parameters.
468
+ */
469
+ interface PathParameters {
470
+ [key: string]: string | number | boolean;
471
+ }
472
+ /**
473
+ * Generic interface for query parameters.
474
+ */
475
+ interface QueryParameters {
476
+ [key: string]: string | number | boolean | string[] | number[] | LocaleCode;
477
+ }
478
+ /**
479
+ * Generic interface for all parameter types.
480
+ */
481
+ type UrlParameters = PathParameters | QueryParameters;
482
+ /**
483
+ * Custom query parameter type with any string prefixed with `c_` as the key and the allowed
484
+ * types for query parameters for the value.
485
+ */
486
+ type CustomQueryParameters = {
487
+ [key in `c_${string}`]: string | number | boolean | string[] | number[];
488
+ };
489
+ /**
490
+ * Custom body request type with any string prefixed with `c_` as the key and the allowed
491
+ * types for the value.
492
+ */
493
+ type CustomRequestBody = {
494
+ [key in `c_${string}`]: string | number | boolean | string[] | number[] | {
495
+ [key: string]: unknown;
496
+ };
497
+ };
498
+ /**
499
+ * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
500
+ * it from the `RequestInit` provided by node-fetch.
501
+ */
502
+ type BrowserRequestInit = RequestInit;
503
+ /**
504
+ * Any properties supported in either the browser or node are accepted.
505
+ * Using the right properties in the right context is left to the user.
506
+ */
507
+ type FetchOptions = NodeRequestInit & BrowserRequestInit;
508
+ /**
509
+ * Base options that can be passed to the `ClientConfig` class.
510
+ */
511
+ interface ClientConfigInit<Params extends BaseUriParameters> {
512
+ baseUri?: string;
513
+ proxy?: string;
514
+ headers?: {
515
+ [key: string]: string;
516
+ };
517
+ parameters: Params;
518
+ fetchOptions?: FetchOptions;
519
+ transformRequest?: (data: unknown, headers: {
520
+ [key: string]: string;
521
+ }) => Required<FetchOptions>["body"];
522
+ throwOnBadResponse?: boolean;
523
+ }
524
+ type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
525
+ /**
526
+ * Configuration parameters common to Commerce SDK clients
527
+ */
528
+ class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
529
+ baseUri?: string;
530
+ proxy?: string;
531
+ headers: {
532
+ [key: string]: string;
533
+ };
534
+ parameters: Params;
535
+ fetchOptions: FetchOptions;
536
+ transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
537
+ throwOnBadResponse: boolean;
538
+ constructor(config: ClientConfigInit<Params>);
539
+ static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
540
+ }
541
+ /**
542
+ * A specialized value indicating the lack of definition of a currency, for example, if the value of the monetary value of the currency is an undefined number.
543
+ */
544
+ type NoValue = "N/A";
545
+ /**
546
+ * @type CurrencyCode
547
+ * A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
548
+ */
549
+ type CurrencyCode = NoValue | string;
550
+ /**
551
+ * @type PaymentConfigurationPaymentMethodsInner:
552
+ *
553
+ * @property accountId: Associated account identifier
554
+ * - **Min Length:** 1
555
+ *
556
+ * @property paymentMethodType: Type of payment method
557
+ *
558
+ * @property paymentModes: Supported payment modes
559
+ *
560
+ */
561
+ type PaymentConfigurationPaymentMethodsInner = {
562
+ accountId: string;
563
+ paymentMethodType: string;
564
+ paymentModes: Array<string>;
565
+ } & {
566
+ [key: string]: any;
567
+ };
568
+ /**
569
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner:
570
+ *
571
+ * @property brands: Supported card brands
572
+ *
573
+ * @property type: Payment method type
574
+ *
575
+ */
576
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner = {
577
+ brands?: Array<string>;
578
+ type?: string;
579
+ } & {
580
+ [key: string]: any;
581
+ };
582
+ /**
583
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse: Gateway response data (optional, can be null)
584
+ *
585
+ * @property paymentMethods: Available payment methods from gateway
586
+ *
587
+ */
588
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse = {
589
+ paymentMethods?: Array<PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner>;
590
+ } & {
591
+ [key: string]: any;
592
+ };
593
+ /**
594
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerConfig: Account configuration
595
+ *
596
+ * @property key: API key for the payment processor
597
+ * - **Max Length:** 200
598
+ *
599
+ */
600
+ type PaymentConfigurationPaymentMethodSetAccountsInnerConfig = {
601
+ key?: string;
602
+ } & {
603
+ [key: string]: any;
604
+ };
605
+ /**
606
+ * @type PaymentConfigurationPaymentMethodSetAccountsInner:
607
+ *
608
+ * @property accountId: Account identifier
609
+ * - **Min Length:** 1
610
+ * - **Max Length:** 100
611
+ *
612
+ * @property config:
613
+ *
614
+ * @property gatewayId: Gateway identifier
615
+ * - **Min Length:** 1
616
+ *
617
+ * @property gatewayResponse:
618
+ *
619
+ * @property isLive: Whether the account is in live mode
620
+ *
621
+ * @property vendor: Payment vendor name
622
+ *
623
+ */
624
+ type PaymentConfigurationPaymentMethodSetAccountsInner = {
625
+ accountId: string;
626
+ config?: PaymentConfigurationPaymentMethodSetAccountsInnerConfig;
627
+ gatewayId: string;
628
+ gatewayResponse?: PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse | null;
629
+ isLive: boolean;
630
+ vendor: string;
631
+ } & {
632
+ [key: string]: any;
633
+ };
634
+ /**
635
+ * @type PaymentConfiguration:
636
+ *
637
+ * @property zoneId: The unique identifier for a Payments zone.
638
+ * - **Pattern:** /^[a-zA-Z0-9\\-_]{1,100}$/
639
+ * - **Min Length:** 1
640
+ * - **Max Length:** 100
641
+ *
642
+ * @property paymentMethodSetAccounts: List of payment method set accounts
643
+ *
644
+ * @property paymentMethods: Configured payment methods
645
+ *
646
+ * @property sdkVersion: SDK version to use
647
+ *
648
+ */
649
+ type PaymentConfiguration = {
650
+ zoneId?: string | null;
651
+ paymentMethodSetAccounts: Array<PaymentConfigurationPaymentMethodSetAccountsInner>;
652
+ paymentMethods: Array<PaymentConfigurationPaymentMethodsInner>;
653
+ sdkVersion: string;
654
+ } & {
655
+ [key: string]: any;
656
+ };
657
+ type getPaymentConfigurationQueryParameters = {
658
+ siteId: string;
659
+ currency: CurrencyCode;
660
+ countryCode: string;
661
+ };
662
+ type getPaymentConfigurationPathParameters = {
663
+ organizationId: string;
664
+ };
665
+ /**
666
+ * All path parameters that are used by at least one ShopperPayments method.
667
+ */
668
+ type ShopperPaymentsPathParameters = Partial<getPaymentConfigurationPathParameters & {}>;
669
+ /**
670
+ * All query parameters that are used by at least one ShopperPayments method.
671
+ */
672
+ type ShopperPaymentsQueryParameters = Partial<getPaymentConfigurationQueryParameters & {}>;
673
+ /**
674
+ * All parameters that are used by ShopperPayments.
675
+ */
676
+ type ShopperPaymentsParameters = ShopperPaymentsPathParameters & BaseUriParameters & ShopperPaymentsQueryParameters;
677
+ /**
678
+ * [Shopper Payments](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-payments:Summary)
679
+ * ==================================
680
+ *
681
+ * *# API Overview
682
+
683
+ Use the Shopper Payments API to retrieve payment configuration information for organizations in the B2C Commerce system.
684
+
685
+ The Shopper Payments API provides access to comprehensive payment configuration data, including payment processor settings, gateway configurations, and payment method details.
686
+
687
+ ## Key Features
688
+
689
+ The Shopper Payments API includes the following capabilities:
690
+
691
+ - **Payment Configuration Retrieval**: Get complete payment configuration for an organization
692
+ - **Payment Method Set Information**: Access details about configured payment method set accounts
693
+ - **Gateway Response Data**: Retrieve payment processor gateway information and supported payment methods
694
+ - **Payment Modes Configuration**: View supported payment modes (Multistep, Express) for each payment method
695
+ - **SDK Version Information**: Get the current SDK version being used
696
+
697
+ ## Payment Configuration Endpoint
698
+
699
+ The main endpoint `/organizations/{organizationId}/payment-configuration` provides:
700
+
701
+ ### Configuration Settings
702
+ - Multi-step checkout enablement status
703
+ - Express checkout enablement status
704
+ - Automatic card capture settings
705
+ - Zone identification
706
+ - Saved payment method configuration
707
+ - Merchant account identification
708
+
709
+ ### Payment Method Set Accounts
710
+ - Account identifiers and configurations
711
+ - Payment processor API keys and settings
712
+ - Gateway identifiers and response data
713
+ - Live/test mode indicators
714
+ - Vendor information (Stripe, Adyen, PayPal, etc.)
715
+
716
+ ### Payment Methods
717
+ - Supported payment method types (card, paypal, applepay, etc.)
718
+ - Available payment modes for each method
719
+ - Account associations
720
+
721
+ ## Gateway Response Handling
722
+
723
+ The API handles varying gateway response formats:
724
+ - **Active Gateways**: Return detailed payment method information including supported card brands
725
+ - **Inactive/Pending Gateways**: May return null gateway response data
726
+ - **Multiple Vendors**: Support for different payment processors with vendor-specific configurations
727
+
728
+ ## Authentication & Authorization
729
+
730
+ The client requesting payment configuration information must have access to the `/payment-configuration` resource. The Shopper Payments API requires a shopper access token from the Shopper Login and API Access Service (SLAS).
731
+
732
+ For details on how to request a shopper access token from SLAS, see the guest user flows for [public clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-public-client.html#guest-user) and [private clients](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-private-client.html#guest-user) in the SLAS guides.
733
+
734
+ You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see the [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)
735
+
736
+ ## Getting Started
737
+
738
+ To use the Shopper Payments API:
739
+
740
+ 1. Authenticate with the appropriate scopes (`sfcc.shopper-payments.rw`)
741
+ 2. Make a GET request to `/organizations/{organizationId}/payment-configuration`
742
+ 3. Process the returned payment configuration data for your application
743
+
744
+ ## Use Cases
745
+
746
+ ### Payment Method Discovery
747
+ Retrieve available payment methods and their capabilities for dynamic payment form generation.
748
+
749
+ ### Gateway Status Monitoring
750
+ Check the status and configuration of payment gateways and processors.
751
+
752
+ ### Payment Flow Configuration
753
+ Determine supported payment modes (multi-step vs express) for different payment methods.
754
+
755
+ ### SDK Version Management
756
+ Ensure compatibility by checking the current SDK version requirements.
757
+
758
+ For detailed implementation examples and best practices, refer to the Commerce Cloud documentation. *<br />
759
+ *
760
+ * Simple example:
761
+ *
762
+ * ```typescript
763
+ * import { ShopperPayments } from "commerce-sdk-isomorphic";
764
+ *
765
+ * const clientConfig = {
766
+ * parameters: {
767
+ * clientId: "XXXXXX",
768
+ * organizationId: "XXXX",
769
+ * shortCode: "XXX",
770
+ * siteId: "XX"
771
+ * }
772
+ * };
773
+ * const shopperPaymentsClient = new ShopperPayments(clientConfig);
774
+ * ```
775
+ *
776
+ * <span style="font-size:.7em; display:block; text-align: right">
777
+ * API Version: 0.0.33<br />
778
+ * Last Updated: <br />
779
+ * </span>
780
+ *
781
+ *
782
+ */
783
+ class ShopperPayments<ConfigParameters extends ShopperPaymentsParameters & Record<string, unknown>> {
784
+ // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
785
+ clientConfig: ClientConfig<ConfigParameters> & {
786
+ baseUri: string;
787
+ };
788
+ static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/checkout/shopper-payments/v1";
789
+ static readonly apiPaths: {
790
+ getPaymentConfiguration: string;
791
+ };
792
+ constructor(config: ClientConfigInit<ConfigParameters>);
793
+ static readonly paramKeys: {
794
+ readonly getPaymentConfiguration: readonly [
795
+ "organizationId",
796
+ "siteId",
797
+ "currency",
798
+ "countryCode"
799
+ ];
800
+ readonly getPaymentConfigurationRequired: readonly [
801
+ "organizationId",
802
+ "siteId",
803
+ "currency",
804
+ "countryCode"
805
+ ];
806
+ };
807
+ /**
808
+ * Retrieves the payment configuration for the organization.
809
+
810
+ **Parameters:**
811
+ - `siteId`: Required. The site identifier for context-specific configuration
812
+ - `currency`: Required. Three-letter currency code (ISO 4217) for payment method configuration
813
+ - `countryCode`: Required. Two-letter country code (ISO 3166-1 alpha-2) for country-specific payment configuration
814
+
815
+ **Response Behavior:**
816
+ - Returns payment configuration data when available
817
+ - Returns null values for missing data (e.g., when account not found or payments zone not found)
818
+ *
819
+ * If you would like to get a raw Response object use the other getPaymentConfiguration function.
820
+ *
821
+ * @param options - An object containing the options for this method.
822
+ * @param options.parameters - An object containing the parameters for this method.
823
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
824
+ * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
825
+ * @param options.parameters.currency - A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
826
+ * @param options.parameters.countryCode - The country code (ISO 3166-1 alpha-2) for country-specific payment configuration filtering
827
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
828
+ *
829
+ * @returns A promise of type PaymentConfiguration.
830
+ */
831
+ getPaymentConfiguration(options?: RequireParametersUnlessAllAreOptional<{
832
+ parameters?: CompositeParameters<{
833
+ organizationId: string;
834
+ siteId: string;
835
+ currency: CurrencyCode;
836
+ countryCode: string;
837
+ } & QueryParameters, ConfigParameters>;
838
+ headers?: {
839
+ [key: string]: string;
840
+ };
841
+ }>): Promise<PaymentConfiguration>;
842
+ /**
843
+ * Retrieves the payment configuration for the organization.
844
+
845
+ **Parameters:**
846
+ - `siteId`: Required. The site identifier for context-specific configuration
847
+ - `currency`: Required. Three-letter currency code (ISO 4217) for payment method configuration
848
+ - `countryCode`: Required. Two-letter country code (ISO 3166-1 alpha-2) for country-specific payment configuration
849
+
850
+ **Response Behavior:**
851
+ - Returns payment configuration data when available
852
+ - Returns null values for missing data (e.g., when account not found or payments zone not found)
853
+ *
854
+ * @param options - An object containing the options for this method.
855
+ * @param options.parameters - An object containing the parameters for this method.
856
+ * @param options.parameters.organizationId - An identifier for the organization the request is being made by
857
+ * @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
858
+ * @param options.parameters.currency - A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
859
+ * @param options.parameters.countryCode - The country code (ISO 3166-1 alpha-2) for country-specific payment configuration filtering
860
+ * @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
861
+ * @param rawResponse - Set to true to return entire Response object instead of DTO.
862
+ *
863
+ * @returns A promise of type Response if rawResponse is true, a promise of type PaymentConfiguration otherwise.
864
+ */
865
+ getPaymentConfiguration<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
866
+ parameters?: CompositeParameters<{
867
+ organizationId: string;
868
+ siteId: string;
869
+ currency: CurrencyCode;
870
+ countryCode: string;
871
+ } & QueryParameters, ConfigParameters>;
872
+ headers?: {
873
+ [key: string]: string;
874
+ };
875
+ }>, rawResponse?: T): Promise<T extends true ? Response : PaymentConfiguration>;
876
+ }
877
+ }
878
+ declare namespace ShopperPaymentsModelTypes {
879
+ /**
880
+ * A specialized value indicating the lack of definition of a currency, for example, if the value of the monetary value of the currency is an undefined number.
881
+ */
882
+ type NoValue = "N/A";
883
+ /**
884
+ * @type CurrencyCode
885
+ * A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
886
+ */
887
+ type CurrencyCode = NoValue | string;
888
+ /**
889
+ * @type PaymentConfigurationPaymentMethodsInner:
890
+ *
891
+ * @property accountId: Associated account identifier
892
+ * - **Min Length:** 1
893
+ *
894
+ * @property paymentMethodType: Type of payment method
895
+ *
896
+ * @property paymentModes: Supported payment modes
897
+ *
898
+ */
899
+ type PaymentConfigurationPaymentMethodsInner = {
900
+ accountId: string;
901
+ paymentMethodType: string;
902
+ paymentModes: Array<string>;
903
+ } & {
904
+ [key: string]: any;
905
+ };
906
+ /**
907
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner:
908
+ *
909
+ * @property brands: Supported card brands
910
+ *
911
+ * @property type: Payment method type
912
+ *
913
+ */
914
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner = {
915
+ brands?: Array<string>;
916
+ type?: string;
917
+ } & {
918
+ [key: string]: any;
919
+ };
920
+ /**
921
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse: Gateway response data (optional, can be null)
922
+ *
923
+ * @property paymentMethods: Available payment methods from gateway
924
+ *
925
+ */
926
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse = {
927
+ paymentMethods?: Array<PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner>;
928
+ } & {
929
+ [key: string]: any;
930
+ };
931
+ /**
932
+ * @type PaymentConfigurationPaymentMethodSetAccountsInnerConfig: Account configuration
933
+ *
934
+ * @property key: API key for the payment processor
935
+ * - **Max Length:** 200
936
+ *
937
+ */
938
+ type PaymentConfigurationPaymentMethodSetAccountsInnerConfig = {
939
+ key?: string;
940
+ } & {
941
+ [key: string]: any;
942
+ };
943
+ /**
944
+ * @type PaymentConfigurationPaymentMethodSetAccountsInner:
945
+ *
946
+ * @property accountId: Account identifier
947
+ * - **Min Length:** 1
948
+ * - **Max Length:** 100
949
+ *
950
+ * @property config:
951
+ *
952
+ * @property gatewayId: Gateway identifier
953
+ * - **Min Length:** 1
954
+ *
955
+ * @property gatewayResponse:
956
+ *
957
+ * @property isLive: Whether the account is in live mode
958
+ *
959
+ * @property vendor: Payment vendor name
960
+ *
961
+ */
962
+ type PaymentConfigurationPaymentMethodSetAccountsInner = {
963
+ accountId: string;
964
+ config?: PaymentConfigurationPaymentMethodSetAccountsInnerConfig;
965
+ gatewayId: string;
966
+ gatewayResponse?: PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse | null;
967
+ isLive: boolean;
968
+ vendor: string;
969
+ } & {
970
+ [key: string]: any;
971
+ };
972
+ /**
973
+ * @type PaymentConfiguration:
974
+ *
975
+ * @property zoneId: The unique identifier for a Payments zone.
976
+ * - **Pattern:** /^[a-zA-Z0-9\\-_]{1,100}$/
977
+ * - **Min Length:** 1
978
+ * - **Max Length:** 100
979
+ *
980
+ * @property paymentMethodSetAccounts: List of payment method set accounts
981
+ *
982
+ * @property paymentMethods: Configured payment methods
983
+ *
984
+ * @property sdkVersion: SDK version to use
985
+ *
986
+ */
987
+ type PaymentConfiguration = {
988
+ zoneId?: string | null;
989
+ paymentMethodSetAccounts: Array<PaymentConfigurationPaymentMethodSetAccountsInner>;
990
+ paymentMethods: Array<PaymentConfigurationPaymentMethodsInner>;
991
+ sdkVersion: string;
992
+ } & {
993
+ [key: string]: any;
994
+ };
995
+ }
996
+ declare namespace ShopperPaymentsTypes {
997
+ type ShopperPaymentsPathParameters = ShopperPaymentsApiTypes.ShopperPaymentsPathParameters;
998
+ type ShopperPaymentsQueryParameters = ShopperPaymentsApiTypes.ShopperPaymentsQueryParameters;
999
+ type getPaymentConfigurationQueryParameters = ShopperPaymentsApiTypes.getPaymentConfigurationQueryParameters;
1000
+ type getPaymentConfigurationPathParameters = ShopperPaymentsApiTypes.getPaymentConfigurationPathParameters;
1001
+ type CurrencyCode = ShopperPaymentsModelTypes.CurrencyCode;
1002
+ type NoValue = ShopperPaymentsModelTypes.NoValue;
1003
+ type PaymentConfiguration = ShopperPaymentsModelTypes.PaymentConfiguration;
1004
+ type PaymentConfigurationPaymentMethodSetAccountsInner = ShopperPaymentsModelTypes.PaymentConfigurationPaymentMethodSetAccountsInner;
1005
+ type PaymentConfigurationPaymentMethodSetAccountsInnerConfig = ShopperPaymentsModelTypes.PaymentConfigurationPaymentMethodSetAccountsInnerConfig;
1006
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse = ShopperPaymentsModelTypes.PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse;
1007
+ type PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner = ShopperPaymentsModelTypes.PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner;
1008
+ type PaymentConfigurationPaymentMethodsInner = ShopperPaymentsModelTypes.PaymentConfigurationPaymentMethodsInner;
1009
+ }
1010
+ export { defaultBaseUri, getPaymentConfigurationQueryParameters, getPaymentConfigurationPathParameters, ShopperPaymentsPathParameters, ShopperPaymentsQueryParameters, ShopperPaymentsParameters, ShopperPayments, CurrencyCode, NoValue, PaymentConfiguration, PaymentConfigurationPaymentMethodSetAccountsInner, PaymentConfigurationPaymentMethodSetAccountsInnerConfig, PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponse, PaymentConfigurationPaymentMethodSetAccountsInnerGatewayResponsePaymentMethodsInner, PaymentConfigurationPaymentMethodsInner, ShopperPaymentsTypes };