@sazito/client-sdk 1.2.9 → 1.2.11

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/README.md CHANGED
@@ -261,7 +261,7 @@ The client instance exposes:
261
261
  | `orders` | `list`, `get` |
262
262
  | `invoices` | `get`, `create`, `refresh`, `addShippingAddress`, `addDiscountCode`, `assignShippingMethod`, `addDetails`, `addForm`, `addCredit`, `removeCredit`, `toggleCredit`, `getApplicableShippingMethods`, `clearInvoice` |
263
263
  | `shipping` | `createAddress`, `updateAddress` (legacy), `listAddresses`, `getAddress`, `getMethods`, `clearAddress` |
264
- | `payments` | `getMethods`, `create`, `initialize`, `verify`, `processStep`, `processStepForm`, `pollUntilSettled`, `clearPayment` |
264
+ | `payments` | `getMethods`, `create`, `initialize`, `verify`, `verifyPaymentCallback`, `getPaymentStep`, `processStep`, `processStepForm`, `pollUntilSettled`, `clearPayment` |
265
265
  | `users` | `login`, `requestMobileOTP`, `verifyMobileOTP`, `requestEmailLogin`, `register`, `getCurrentUser`, `updateProfile`, `requestMobilePhoneUpdate`, `verifyMobilePhoneUpdate`, `forgotPassword`, `revivePassword`, `mergeUser` |
266
266
  | `search` | `query` |
267
267
  | `feedbacks` | `getSeed`, `createOrderRating`, `submitProductReview`, `getProductStatistics`, `getProductReviews`, `uploadReviewImages`, `list`, `create`, `get` |
package/dist/index.d.mts CHANGED
@@ -12,6 +12,10 @@ interface RetryConfig {
12
12
  }
13
13
  interface SazitoConfig {
14
14
  domain: string;
15
+ /** Sazito API origin. Keeps the legacy SDK origin when omitted. */
16
+ apiBaseUrl?: string;
17
+ /** Payments collection path for deployments with a custom API version map. */
18
+ paymentsBasePath?: string;
15
19
  timeout?: number;
16
20
  retry?: RetryConfig;
17
21
  cache?: {
@@ -479,27 +483,8 @@ interface ShippingAssignment {
479
483
  */
480
484
 
481
485
  type OrderPublicId = number | string;
482
- /**
483
- * Keeps the established InvoiceItem contract for patch-level compatibility,
484
- * while exposing direct camelCase checkout fields when the endpoint provides them.
485
- */
486
- interface OrderInvoiceItem extends InvoiceItem {
487
- variantAttributes?: Array<{
488
- name: string;
489
- value: string;
490
- }>;
491
- singleItemPrice?: number;
492
- noOfItems?: number;
493
- totalItemsPrice?: number;
494
- productVariant?: {
495
- commercialFiles?: Array<{
496
- id: OrderPublicId;
497
- }>;
498
- product: {
499
- productType: string;
500
- };
501
- };
502
- }
486
+ /** Account order item; retained as an alias for existing imports. */
487
+ type OrderInvoiceItem = InvoiceItem;
503
488
  interface OrderShippingItem {
504
489
  id: OrderPublicId;
505
490
  invoiceItemIds: OrderPublicId[];
@@ -513,10 +498,10 @@ interface OrderShippingItem {
513
498
  };
514
499
  }
515
500
  interface OrderInvoice {
516
- invoiceItems: OrderInvoiceItem[];
517
- shippingItems: OrderShippingItem[];
518
- netTotal: number;
519
- finalTotal: number;
501
+ invoiceItems: InvoiceItem[];
502
+ shippingItems: JsonObject[];
503
+ netTotal?: number;
504
+ finalTotal?: number;
520
505
  shippingTotal?: number;
521
506
  discountTotal?: number;
522
507
  creditTotal?: number;
@@ -533,8 +518,8 @@ interface OrderInvoice {
533
518
  }>;
534
519
  }
535
520
  interface Order {
536
- id: OrderPublicId;
537
- orderNumber: OrderPublicId;
521
+ id: number;
522
+ orderNumber: string;
538
523
  orderIdentifier: string;
539
524
  invoice: OrderInvoice;
540
525
  }
@@ -556,6 +541,76 @@ interface OrderFilters {
556
541
  }>;
557
542
  }
558
543
 
544
+ /**
545
+ * Payment completion order from process_payment_step; independent of account Order.
546
+ */
547
+
548
+ interface CheckoutInvoiceItem {
549
+ productVariantId: OrderPublicId;
550
+ name: string;
551
+ image?: {
552
+ url?: string;
553
+ };
554
+ variantAttributes: Array<{
555
+ name: string;
556
+ value: string;
557
+ }>;
558
+ singleItemPrice: number;
559
+ noOfItems: number;
560
+ totalItemsPrice: number;
561
+ customerProfit?: number;
562
+ formAttributes?: unknown;
563
+ bookingAttributes?: unknown;
564
+ productVariant: {
565
+ commercialFiles?: Array<{
566
+ id: OrderPublicId;
567
+ }>;
568
+ product: {
569
+ productType: string;
570
+ };
571
+ };
572
+ }
573
+ interface CheckoutShippingItem {
574
+ id: OrderPublicId;
575
+ invoiceItemIds: OrderPublicId[];
576
+ rate: {
577
+ id?: OrderPublicId;
578
+ name: string;
579
+ price: number;
580
+ type?: string;
581
+ icon?: string;
582
+ color?: string;
583
+ };
584
+ }
585
+ interface CheckoutInvoice {
586
+ invoiceItems: CheckoutInvoiceItem[];
587
+ shippingItems: CheckoutShippingItem[];
588
+ /** May be omitted by the payment verification response. */
589
+ netTotal?: number;
590
+ /** May be omitted by the payment verification response. */
591
+ finalTotal?: number;
592
+ shippingTotal?: number;
593
+ discountTotal?: number;
594
+ creditTotal?: number;
595
+ vat?: number;
596
+ vatPercent?: number;
597
+ itemsTotalRawPrice?: number;
598
+ itemsDiscount?: number;
599
+ customerProfit?: number;
600
+ customerProfitPercentage?: number;
601
+ discountUsages?: Array<{
602
+ discountCode?: {
603
+ code?: string;
604
+ };
605
+ }>;
606
+ }
607
+ interface CheckoutOrder {
608
+ id: OrderPublicId;
609
+ orderNumber: OrderPublicId;
610
+ orderIdentifier: string;
611
+ invoice: CheckoutInvoice;
612
+ }
613
+
559
614
  /**
560
615
  * Payment-related types
561
616
  */
@@ -588,6 +643,8 @@ interface Payment {
588
643
  }
589
644
  interface PaymentActionBase {
590
645
  message?: string;
646
+ /** Complete backend result before SDK normalization. */
647
+ raw?: JsonObject;
591
648
  }
592
649
  type PaymentAction = PaymentActionBase & ({
593
650
  action: 'POST';
@@ -604,14 +661,18 @@ type PaymentAction = PaymentActionBase & ({
604
661
  time?: number;
605
662
  } | {
606
663
  action: 'show_order';
607
- order: Order;
664
+ order: CheckoutOrder;
608
665
  } | {
609
666
  action: 'pending';
610
- order: Order;
667
+ order: CheckoutOrder;
611
668
  } | {
612
669
  action: 'payment_fail_error' | 'show_error' | 'FAIL';
613
670
  } | {
614
671
  action: 'StockViolated';
672
+ } | {
673
+ action: 'unknown';
674
+ backendAction: string;
675
+ raw: JsonObject;
615
676
  });
616
677
  interface PaymentCredentials {
617
678
  id: number;
@@ -634,6 +695,28 @@ interface PaymentStepInput {
634
695
  imageUrl?: string;
635
696
  code?: string;
636
697
  }
698
+ type PaymentCallbackFieldValue = JsonValue | undefined;
699
+ type PaymentCallbackFields = Record<string, PaymentCallbackFieldValue>;
700
+ /** Raw gateway callback accepted by the SSR-compatible verification request. */
701
+ interface VerifyPaymentCallbackInput {
702
+ paymentId: string | number;
703
+ paymentIdentifier: string;
704
+ /** Form/body fields are added first. */
705
+ body?: PaymentCallbackFields;
706
+ /** Query fields are added second and win when a name is duplicated. */
707
+ query?: PaymentCallbackFields;
708
+ }
709
+ /** Controls the repeated JSON status check after a `pending` callback result. */
710
+ interface PaymentPollingOptions extends RequestOptions {
711
+ /** Delay before each request, including the first one. Defaults to 15 seconds. */
712
+ intervalMs?: number;
713
+ /** Overall polling deadline. Defaults to five minutes. */
714
+ pollingTimeoutMs?: number;
715
+ /** Optional maximum number of status requests. */
716
+ maxAttempts?: number;
717
+ /** Skip the initial delay when an immediate status check is desired. */
718
+ immediate?: boolean;
719
+ }
637
720
  type PaymentStepFormValue = string | number | boolean | null | undefined;
638
721
  type PaymentStepFormFields = Record<string, PaymentStepFormValue>;
639
722
 
@@ -966,6 +1049,7 @@ declare class HttpClient {
966
1049
  */
967
1050
  private getHeaders;
968
1051
  private isMultipartBody;
1052
+ private isFormUrlEncodedBody;
969
1053
  /**
970
1054
  * Check if status code should trigger a retry
971
1055
  */
@@ -1263,8 +1347,9 @@ declare class ShippingAPI {
1263
1347
  declare class PaymentsAPI {
1264
1348
  private http;
1265
1349
  private credentials;
1350
+ private paymentsBasePath;
1266
1351
  private readonly pinchedPayments;
1267
- constructor(http: HttpClient, credentials: CredentialsManager);
1352
+ constructor(http: HttpClient, credentials: CredentialsManager, paymentsBasePath?: string);
1268
1353
  /**
1269
1354
  * Get list of payment methods for invoice
1270
1355
  */
@@ -1287,6 +1372,14 @@ declare class PaymentsAPI {
1287
1372
  * or pending if the gateway has not reported back yet).
1288
1373
  */
1289
1374
  verify(input?: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1375
+ /**
1376
+ * Verify a gateway callback using Sazito's SSR form contract. Body fields
1377
+ * are written first, query fields second, and every field is wrapped as
1378
+ * `payload[name]`. The validated path identifier is always written last.
1379
+ */
1380
+ verifyPaymentCallback(input: VerifyPaymentCallbackInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1381
+ /** Send one JSON payment status request. Used by pending polling only. */
1382
+ getPaymentStep(options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1290
1383
  /**
1291
1384
  * Process payment step (for card-to-card or multi-step payments).
1292
1385
  *
@@ -1294,10 +1387,10 @@ declare class PaymentsAPI {
1294
1387
  */
1295
1388
  processStep(input: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1296
1389
  /**
1297
- * Shared core for the `process_payment_step` endpoint used by
1298
- * {@link initialize}, {@link verify} and {@link processStep}.
1390
+ * Shared JSON core for initialization, status checks and multi-step payment
1391
+ * actions. Gateway callback verification intentionally uses form encoding.
1299
1392
  */
1300
- private submitPaymentStep;
1393
+ private submitJsonPaymentStep;
1301
1394
  /**
1302
1395
  * Process payment step in form mode (non-JSON content-type).
1303
1396
  */
@@ -1305,7 +1398,7 @@ declare class PaymentsAPI {
1305
1398
  /**
1306
1399
  * Poll payment state every 15 seconds until action changes from pending.
1307
1400
  */
1308
- pollUntilSettled(options?: RequestOptions, intervalMs?: number): Promise<SazitoResponse<PaymentAction>>;
1401
+ pollUntilSettled(options?: PaymentPollingOptions, intervalMs?: number): Promise<SazitoResponse<PaymentAction>>;
1309
1402
  /**
1310
1403
  * Clear payment credentials
1311
1404
  */
@@ -1314,6 +1407,12 @@ declare class PaymentsAPI {
1314
1407
  private buildProcessStepFormData;
1315
1408
  private buildProcessStepBody;
1316
1409
  private appendFormValue;
1410
+ private resolvePaymentCredentials;
1411
+ private normalizePaymentId;
1412
+ private paymentStepInputToCallbackFields;
1413
+ private appendCallbackValue;
1414
+ private withContentType;
1415
+ private waitForPoll;
1317
1416
  /**
1318
1417
  * Post-process a `process_payment_step` response. The exact-JSON endpoint
1319
1418
  * returns an envelope `{ result: PaymentAction, error, error_code, status }`;
@@ -2392,4 +2491,4 @@ declare function transformAddToCartInput(variantId: number, quantity: number, fo
2392
2491
  declare function transformCreateCartInput(input: TransformValue): TransformObject;
2393
2492
 
2394
2493
  export { CredentialsManager, HttpClient, MemoryStorage, SazitoClient, TokenStorage, createBookingAPI as booking, createCartAPI as cart, createCategoriesAPI as categories, createCMSAPI as cms, createBookingAPI, createCMSAPI, createCartAPI, createCategoriesAPI, createDynamicFormsAPI, createEntityRoutesAPI, createFeedbacksAPI, createGeneralAPI, createImagesAPI, createInvoicesAPI, createMenuAPI, createOrdersAPI, createPaymentsAPI, createProductsAPI, createRegionsAPI, createSazitoClient, createSearchAPI, createShippingAPI, createUsersAPI, createVisitsAPI, createWalletAPI, createDynamicFormsAPI as dynamicForms, createEntityRoutesAPI as entityRoutes, createFeedbacksAPI as feedbacks, createGeneralAPI as general, createImagesAPI as images, createInvoicesAPI as invoices, createMenuAPI as menu, createOrdersAPI as orders, createPaymentsAPI as payments, createProductsAPI as products, createRegionsAPI as regions, createSearchAPI as search, createShippingAPI as shipping, toEnglishDigits, transformAddToCartInput, transformApiResponse, transformCartResponse, transformCreateCartInput, transformInvoiceResponse, transformProductListResponse, transformRequestKeys, transformResponseKeys, transformShippingAddressInput, createUsersAPI as users, createVisitsAPI as visits, createWalletAPI as wallet };
2395
- export type { AddToCartInput, ApplicableShippingMethods, BlogPage, BlogPageEntityRoute, CMSPageEntityRoute, CMSPageType, CacheConfig, Cart, CartCredentials, CartProduct, CheckoutProductSnapshot, City$1 as City, CmsPage, CookieOptions, CreateCartInput, CreateInvoiceInput, CreatePaymentInput, EntityRoute, EntityRouteResponse, EntityType, FormAttributeValue, Image, Invoice, InvoiceCredentials, InvoiceItem, InvoiceItemFormAttributes, InvoiceShippingAddress, InvoiceShippingAddressRegion, ItemShippingRate, JsonArray, JsonObject, JsonPrimitive, JsonValue, MenuItem, MenuNode, MenuTree, Order, OrderFilters, OrderInvoice, OrderInvoiceItem, OrderPublicId, OrderShippingItem, OrdersListResponse, PaginatedResponse, Payment, PaymentAction, PaymentCredentials, PaymentGateway, PaymentMethod, PaymentStatus, PaymentStepFormFields, PaymentStepFormValue, PaymentStepInput, Product, ProductAttribute, ProductAttributeValueObject, ProductCategory, ProductCategoryEntityRoute, ProductEntityRoute, ProductFilters, ProductSort, ProductVariant, RefreshInvoiceInput, Region$1 as Region, RequestOptions, RetryConfig, SazitoConfig, SazitoError, SazitoResponse, SchedulerBookingAttributes, SearchFilters, SearchResponse, ShippingAddress, ShippingAddressCity, ShippingAddressCredentials, ShippingAddressInput, ShippingAddressRegion, ShippingAssignment, ShippingItem, ShippingMethod, ShippingRate, StorageAdapter, Tag, UnknownEntityRoute, UploadedFormFileAttribute, User };
2494
+ export type { AddToCartInput, ApplicableShippingMethods, BlogPage, BlogPageEntityRoute, CMSPageEntityRoute, CMSPageType, CacheConfig, Cart, CartCredentials, CartProduct, CheckoutInvoice, CheckoutInvoiceItem, CheckoutOrder, CheckoutProductSnapshot, CheckoutShippingItem, City$1 as City, CmsPage, CookieOptions, CreateCartInput, CreateInvoiceInput, CreatePaymentInput, EntityRoute, EntityRouteResponse, EntityType, FormAttributeValue, Image, Invoice, InvoiceCredentials, InvoiceItem, InvoiceItemFormAttributes, InvoiceShippingAddress, InvoiceShippingAddressRegion, ItemShippingRate, JsonArray, JsonObject, JsonPrimitive, JsonValue, MenuItem, MenuNode, MenuTree, Order, OrderFilters, OrderInvoice, OrderInvoiceItem, OrderPublicId, OrderShippingItem, OrdersListResponse, PaginatedResponse, Payment, PaymentAction, PaymentCallbackFieldValue, PaymentCallbackFields, PaymentCredentials, PaymentGateway, PaymentMethod, PaymentPollingOptions, PaymentStatus, PaymentStepFormFields, PaymentStepFormValue, PaymentStepInput, Product, ProductAttribute, ProductAttributeValueObject, ProductCategory, ProductCategoryEntityRoute, ProductEntityRoute, ProductFilters, ProductSort, ProductVariant, RefreshInvoiceInput, Region$1 as Region, RequestOptions, RetryConfig, SazitoConfig, SazitoError, SazitoResponse, SchedulerBookingAttributes, SearchFilters, SearchResponse, ShippingAddress, ShippingAddressCity, ShippingAddressCredentials, ShippingAddressInput, ShippingAddressRegion, ShippingAssignment, ShippingItem, ShippingMethod, ShippingRate, StorageAdapter, Tag, UnknownEntityRoute, UploadedFormFileAttribute, User, VerifyPaymentCallbackInput };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,10 @@ interface RetryConfig {
12
12
  }
13
13
  interface SazitoConfig {
14
14
  domain: string;
15
+ /** Sazito API origin. Keeps the legacy SDK origin when omitted. */
16
+ apiBaseUrl?: string;
17
+ /** Payments collection path for deployments with a custom API version map. */
18
+ paymentsBasePath?: string;
15
19
  timeout?: number;
16
20
  retry?: RetryConfig;
17
21
  cache?: {
@@ -479,27 +483,8 @@ interface ShippingAssignment {
479
483
  */
480
484
 
481
485
  type OrderPublicId = number | string;
482
- /**
483
- * Keeps the established InvoiceItem contract for patch-level compatibility,
484
- * while exposing direct camelCase checkout fields when the endpoint provides them.
485
- */
486
- interface OrderInvoiceItem extends InvoiceItem {
487
- variantAttributes?: Array<{
488
- name: string;
489
- value: string;
490
- }>;
491
- singleItemPrice?: number;
492
- noOfItems?: number;
493
- totalItemsPrice?: number;
494
- productVariant?: {
495
- commercialFiles?: Array<{
496
- id: OrderPublicId;
497
- }>;
498
- product: {
499
- productType: string;
500
- };
501
- };
502
- }
486
+ /** Account order item; retained as an alias for existing imports. */
487
+ type OrderInvoiceItem = InvoiceItem;
503
488
  interface OrderShippingItem {
504
489
  id: OrderPublicId;
505
490
  invoiceItemIds: OrderPublicId[];
@@ -513,10 +498,10 @@ interface OrderShippingItem {
513
498
  };
514
499
  }
515
500
  interface OrderInvoice {
516
- invoiceItems: OrderInvoiceItem[];
517
- shippingItems: OrderShippingItem[];
518
- netTotal: number;
519
- finalTotal: number;
501
+ invoiceItems: InvoiceItem[];
502
+ shippingItems: JsonObject[];
503
+ netTotal?: number;
504
+ finalTotal?: number;
520
505
  shippingTotal?: number;
521
506
  discountTotal?: number;
522
507
  creditTotal?: number;
@@ -533,8 +518,8 @@ interface OrderInvoice {
533
518
  }>;
534
519
  }
535
520
  interface Order {
536
- id: OrderPublicId;
537
- orderNumber: OrderPublicId;
521
+ id: number;
522
+ orderNumber: string;
538
523
  orderIdentifier: string;
539
524
  invoice: OrderInvoice;
540
525
  }
@@ -556,6 +541,76 @@ interface OrderFilters {
556
541
  }>;
557
542
  }
558
543
 
544
+ /**
545
+ * Payment completion order from process_payment_step; independent of account Order.
546
+ */
547
+
548
+ interface CheckoutInvoiceItem {
549
+ productVariantId: OrderPublicId;
550
+ name: string;
551
+ image?: {
552
+ url?: string;
553
+ };
554
+ variantAttributes: Array<{
555
+ name: string;
556
+ value: string;
557
+ }>;
558
+ singleItemPrice: number;
559
+ noOfItems: number;
560
+ totalItemsPrice: number;
561
+ customerProfit?: number;
562
+ formAttributes?: unknown;
563
+ bookingAttributes?: unknown;
564
+ productVariant: {
565
+ commercialFiles?: Array<{
566
+ id: OrderPublicId;
567
+ }>;
568
+ product: {
569
+ productType: string;
570
+ };
571
+ };
572
+ }
573
+ interface CheckoutShippingItem {
574
+ id: OrderPublicId;
575
+ invoiceItemIds: OrderPublicId[];
576
+ rate: {
577
+ id?: OrderPublicId;
578
+ name: string;
579
+ price: number;
580
+ type?: string;
581
+ icon?: string;
582
+ color?: string;
583
+ };
584
+ }
585
+ interface CheckoutInvoice {
586
+ invoiceItems: CheckoutInvoiceItem[];
587
+ shippingItems: CheckoutShippingItem[];
588
+ /** May be omitted by the payment verification response. */
589
+ netTotal?: number;
590
+ /** May be omitted by the payment verification response. */
591
+ finalTotal?: number;
592
+ shippingTotal?: number;
593
+ discountTotal?: number;
594
+ creditTotal?: number;
595
+ vat?: number;
596
+ vatPercent?: number;
597
+ itemsTotalRawPrice?: number;
598
+ itemsDiscount?: number;
599
+ customerProfit?: number;
600
+ customerProfitPercentage?: number;
601
+ discountUsages?: Array<{
602
+ discountCode?: {
603
+ code?: string;
604
+ };
605
+ }>;
606
+ }
607
+ interface CheckoutOrder {
608
+ id: OrderPublicId;
609
+ orderNumber: OrderPublicId;
610
+ orderIdentifier: string;
611
+ invoice: CheckoutInvoice;
612
+ }
613
+
559
614
  /**
560
615
  * Payment-related types
561
616
  */
@@ -588,6 +643,8 @@ interface Payment {
588
643
  }
589
644
  interface PaymentActionBase {
590
645
  message?: string;
646
+ /** Complete backend result before SDK normalization. */
647
+ raw?: JsonObject;
591
648
  }
592
649
  type PaymentAction = PaymentActionBase & ({
593
650
  action: 'POST';
@@ -604,14 +661,18 @@ type PaymentAction = PaymentActionBase & ({
604
661
  time?: number;
605
662
  } | {
606
663
  action: 'show_order';
607
- order: Order;
664
+ order: CheckoutOrder;
608
665
  } | {
609
666
  action: 'pending';
610
- order: Order;
667
+ order: CheckoutOrder;
611
668
  } | {
612
669
  action: 'payment_fail_error' | 'show_error' | 'FAIL';
613
670
  } | {
614
671
  action: 'StockViolated';
672
+ } | {
673
+ action: 'unknown';
674
+ backendAction: string;
675
+ raw: JsonObject;
615
676
  });
616
677
  interface PaymentCredentials {
617
678
  id: number;
@@ -634,6 +695,28 @@ interface PaymentStepInput {
634
695
  imageUrl?: string;
635
696
  code?: string;
636
697
  }
698
+ type PaymentCallbackFieldValue = JsonValue | undefined;
699
+ type PaymentCallbackFields = Record<string, PaymentCallbackFieldValue>;
700
+ /** Raw gateway callback accepted by the SSR-compatible verification request. */
701
+ interface VerifyPaymentCallbackInput {
702
+ paymentId: string | number;
703
+ paymentIdentifier: string;
704
+ /** Form/body fields are added first. */
705
+ body?: PaymentCallbackFields;
706
+ /** Query fields are added second and win when a name is duplicated. */
707
+ query?: PaymentCallbackFields;
708
+ }
709
+ /** Controls the repeated JSON status check after a `pending` callback result. */
710
+ interface PaymentPollingOptions extends RequestOptions {
711
+ /** Delay before each request, including the first one. Defaults to 15 seconds. */
712
+ intervalMs?: number;
713
+ /** Overall polling deadline. Defaults to five minutes. */
714
+ pollingTimeoutMs?: number;
715
+ /** Optional maximum number of status requests. */
716
+ maxAttempts?: number;
717
+ /** Skip the initial delay when an immediate status check is desired. */
718
+ immediate?: boolean;
719
+ }
637
720
  type PaymentStepFormValue = string | number | boolean | null | undefined;
638
721
  type PaymentStepFormFields = Record<string, PaymentStepFormValue>;
639
722
 
@@ -966,6 +1049,7 @@ declare class HttpClient {
966
1049
  */
967
1050
  private getHeaders;
968
1051
  private isMultipartBody;
1052
+ private isFormUrlEncodedBody;
969
1053
  /**
970
1054
  * Check if status code should trigger a retry
971
1055
  */
@@ -1263,8 +1347,9 @@ declare class ShippingAPI {
1263
1347
  declare class PaymentsAPI {
1264
1348
  private http;
1265
1349
  private credentials;
1350
+ private paymentsBasePath;
1266
1351
  private readonly pinchedPayments;
1267
- constructor(http: HttpClient, credentials: CredentialsManager);
1352
+ constructor(http: HttpClient, credentials: CredentialsManager, paymentsBasePath?: string);
1268
1353
  /**
1269
1354
  * Get list of payment methods for invoice
1270
1355
  */
@@ -1287,6 +1372,14 @@ declare class PaymentsAPI {
1287
1372
  * or pending if the gateway has not reported back yet).
1288
1373
  */
1289
1374
  verify(input?: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1375
+ /**
1376
+ * Verify a gateway callback using Sazito's SSR form contract. Body fields
1377
+ * are written first, query fields second, and every field is wrapped as
1378
+ * `payload[name]`. The validated path identifier is always written last.
1379
+ */
1380
+ verifyPaymentCallback(input: VerifyPaymentCallbackInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1381
+ /** Send one JSON payment status request. Used by pending polling only. */
1382
+ getPaymentStep(options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1290
1383
  /**
1291
1384
  * Process payment step (for card-to-card or multi-step payments).
1292
1385
  *
@@ -1294,10 +1387,10 @@ declare class PaymentsAPI {
1294
1387
  */
1295
1388
  processStep(input: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
1296
1389
  /**
1297
- * Shared core for the `process_payment_step` endpoint used by
1298
- * {@link initialize}, {@link verify} and {@link processStep}.
1390
+ * Shared JSON core for initialization, status checks and multi-step payment
1391
+ * actions. Gateway callback verification intentionally uses form encoding.
1299
1392
  */
1300
- private submitPaymentStep;
1393
+ private submitJsonPaymentStep;
1301
1394
  /**
1302
1395
  * Process payment step in form mode (non-JSON content-type).
1303
1396
  */
@@ -1305,7 +1398,7 @@ declare class PaymentsAPI {
1305
1398
  /**
1306
1399
  * Poll payment state every 15 seconds until action changes from pending.
1307
1400
  */
1308
- pollUntilSettled(options?: RequestOptions, intervalMs?: number): Promise<SazitoResponse<PaymentAction>>;
1401
+ pollUntilSettled(options?: PaymentPollingOptions, intervalMs?: number): Promise<SazitoResponse<PaymentAction>>;
1309
1402
  /**
1310
1403
  * Clear payment credentials
1311
1404
  */
@@ -1314,6 +1407,12 @@ declare class PaymentsAPI {
1314
1407
  private buildProcessStepFormData;
1315
1408
  private buildProcessStepBody;
1316
1409
  private appendFormValue;
1410
+ private resolvePaymentCredentials;
1411
+ private normalizePaymentId;
1412
+ private paymentStepInputToCallbackFields;
1413
+ private appendCallbackValue;
1414
+ private withContentType;
1415
+ private waitForPoll;
1317
1416
  /**
1318
1417
  * Post-process a `process_payment_step` response. The exact-JSON endpoint
1319
1418
  * returns an envelope `{ result: PaymentAction, error, error_code, status }`;
@@ -2392,4 +2491,4 @@ declare function transformAddToCartInput(variantId: number, quantity: number, fo
2392
2491
  declare function transformCreateCartInput(input: TransformValue): TransformObject;
2393
2492
 
2394
2493
  export { CredentialsManager, HttpClient, MemoryStorage, SazitoClient, TokenStorage, createBookingAPI as booking, createCartAPI as cart, createCategoriesAPI as categories, createCMSAPI as cms, createBookingAPI, createCMSAPI, createCartAPI, createCategoriesAPI, createDynamicFormsAPI, createEntityRoutesAPI, createFeedbacksAPI, createGeneralAPI, createImagesAPI, createInvoicesAPI, createMenuAPI, createOrdersAPI, createPaymentsAPI, createProductsAPI, createRegionsAPI, createSazitoClient, createSearchAPI, createShippingAPI, createUsersAPI, createVisitsAPI, createWalletAPI, createDynamicFormsAPI as dynamicForms, createEntityRoutesAPI as entityRoutes, createFeedbacksAPI as feedbacks, createGeneralAPI as general, createImagesAPI as images, createInvoicesAPI as invoices, createMenuAPI as menu, createOrdersAPI as orders, createPaymentsAPI as payments, createProductsAPI as products, createRegionsAPI as regions, createSearchAPI as search, createShippingAPI as shipping, toEnglishDigits, transformAddToCartInput, transformApiResponse, transformCartResponse, transformCreateCartInput, transformInvoiceResponse, transformProductListResponse, transformRequestKeys, transformResponseKeys, transformShippingAddressInput, createUsersAPI as users, createVisitsAPI as visits, createWalletAPI as wallet };
2395
- export type { AddToCartInput, ApplicableShippingMethods, BlogPage, BlogPageEntityRoute, CMSPageEntityRoute, CMSPageType, CacheConfig, Cart, CartCredentials, CartProduct, CheckoutProductSnapshot, City$1 as City, CmsPage, CookieOptions, CreateCartInput, CreateInvoiceInput, CreatePaymentInput, EntityRoute, EntityRouteResponse, EntityType, FormAttributeValue, Image, Invoice, InvoiceCredentials, InvoiceItem, InvoiceItemFormAttributes, InvoiceShippingAddress, InvoiceShippingAddressRegion, ItemShippingRate, JsonArray, JsonObject, JsonPrimitive, JsonValue, MenuItem, MenuNode, MenuTree, Order, OrderFilters, OrderInvoice, OrderInvoiceItem, OrderPublicId, OrderShippingItem, OrdersListResponse, PaginatedResponse, Payment, PaymentAction, PaymentCredentials, PaymentGateway, PaymentMethod, PaymentStatus, PaymentStepFormFields, PaymentStepFormValue, PaymentStepInput, Product, ProductAttribute, ProductAttributeValueObject, ProductCategory, ProductCategoryEntityRoute, ProductEntityRoute, ProductFilters, ProductSort, ProductVariant, RefreshInvoiceInput, Region$1 as Region, RequestOptions, RetryConfig, SazitoConfig, SazitoError, SazitoResponse, SchedulerBookingAttributes, SearchFilters, SearchResponse, ShippingAddress, ShippingAddressCity, ShippingAddressCredentials, ShippingAddressInput, ShippingAddressRegion, ShippingAssignment, ShippingItem, ShippingMethod, ShippingRate, StorageAdapter, Tag, UnknownEntityRoute, UploadedFormFileAttribute, User };
2494
+ export type { AddToCartInput, ApplicableShippingMethods, BlogPage, BlogPageEntityRoute, CMSPageEntityRoute, CMSPageType, CacheConfig, Cart, CartCredentials, CartProduct, CheckoutInvoice, CheckoutInvoiceItem, CheckoutOrder, CheckoutProductSnapshot, CheckoutShippingItem, City$1 as City, CmsPage, CookieOptions, CreateCartInput, CreateInvoiceInput, CreatePaymentInput, EntityRoute, EntityRouteResponse, EntityType, FormAttributeValue, Image, Invoice, InvoiceCredentials, InvoiceItem, InvoiceItemFormAttributes, InvoiceShippingAddress, InvoiceShippingAddressRegion, ItemShippingRate, JsonArray, JsonObject, JsonPrimitive, JsonValue, MenuItem, MenuNode, MenuTree, Order, OrderFilters, OrderInvoice, OrderInvoiceItem, OrderPublicId, OrderShippingItem, OrdersListResponse, PaginatedResponse, Payment, PaymentAction, PaymentCallbackFieldValue, PaymentCallbackFields, PaymentCredentials, PaymentGateway, PaymentMethod, PaymentPollingOptions, PaymentStatus, PaymentStepFormFields, PaymentStepFormValue, PaymentStepInput, Product, ProductAttribute, ProductAttributeValueObject, ProductCategory, ProductCategoryEntityRoute, ProductEntityRoute, ProductFilters, ProductSort, ProductVariant, RefreshInvoiceInput, Region$1 as Region, RequestOptions, RetryConfig, SazitoConfig, SazitoError, SazitoResponse, SchedulerBookingAttributes, SearchFilters, SearchResponse, ShippingAddress, ShippingAddressCity, ShippingAddressCredentials, ShippingAddressInput, ShippingAddressRegion, ShippingAssignment, ShippingItem, ShippingMethod, ShippingRate, StorageAdapter, Tag, UnknownEntityRoute, UploadedFormFileAttribute, User, VerifyPaymentCallbackInput };