@wix/auto_sdk_pricing-plans_orders 1.0.141 → 1.0.143

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.
@@ -626,345 +626,314 @@ interface ActionEvent {
626
626
  }
627
627
  interface Empty {
628
628
  }
629
- interface OrderPurchased {
630
- /** Order that was paid for. If a free or an offline order, the order that was created. */
631
- order?: Order;
632
- }
633
- interface OrderStarted {
634
- /** Order that reached its `startDate`. */
635
- order?: Order;
629
+ interface CreateOnlineOrderRequest {
630
+ /**
631
+ * Plan ID.
632
+ * @format GUID
633
+ */
634
+ planId: string;
635
+ /**
636
+ * Start date and time for the plan of the online order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
637
+ *
638
+ * Default: Current date and time.
639
+ */
640
+ startDate?: Date | null;
641
+ /**
642
+ * Coupon code to apply.
643
+ * @minLength 1
644
+ * @maxLength 20
645
+ */
646
+ couponCode?: string | null;
647
+ /** Provided if checkout is initiated on buyer's behalf. */
648
+ onBehalf?: OnBehalf;
649
+ /**
650
+ * Submission ID of the form submitted with this order.
651
+ *
652
+ * The submission must belong to the form attached to the plan, and that form must belong to the Pricing Plans namespace.
653
+ * An invalid submission ID is dropped and the order is created without a submission.
654
+ * @format GUID
655
+ */
656
+ submissionId?: string | null;
636
657
  }
637
- /**
638
- * Triggered at the start of a new payment cycle for an existing order.
639
- *
640
- * This webhook does not trigger at the initial start of an offline order.
641
- */
642
- interface OrderCycleStarted {
643
- /** Order whose new cycle started. */
644
- order?: Order;
645
- /** Number of the payment cycle will be 0 when the order is in the free trial period. In other cases, the cycle number starts from 1. */
646
- cycleNumber?: number;
658
+ interface OnBehalf {
659
+ /**
660
+ * Member ID.
661
+ * @format GUID
662
+ */
663
+ memberId?: string;
664
+ /** Method by which checkout is initiated. */
665
+ orderMethod?: OrderMethodWithLiterals;
647
666
  }
648
- /** Emitted when a recurring order is canceled for the next payment cycle */
649
- interface OrderAutoRenewCanceled {
650
- /** Order that is canceled, effective at the end of the current payment cycle. */
667
+ interface CreateOnlineOrderResponse {
668
+ /** Created online order. */
651
669
  order?: Order;
652
670
  }
653
- interface OrderEnded {
654
- /** Order that ended. */
655
- order?: Order;
671
+ interface CouponsError {
672
+ /** Coupon code. */
673
+ couponCode?: string;
674
+ /** Plan ID. */
675
+ planId?: string;
656
676
  }
657
- interface GetOrderRequest {
677
+ interface CreateGuestOnlineOrderRequest {
658
678
  /**
659
- * Order ID.
679
+ * Plan ID.
660
680
  * @format GUID
661
681
  */
662
- _id: string;
682
+ planId?: string;
663
683
  /**
664
- * Predefined set of fields to return.
684
+ * Start date for the ordered plan.
665
685
  *
666
- * Default: If `fieldSet` is omitted, no order form submission data is returned.
686
+ * Default: Current date
667
687
  */
668
- fieldSet?: SetWithLiterals;
688
+ startDate?: Date | null;
689
+ /**
690
+ * Coupon code to apply.
691
+ * @minLength 1
692
+ * @maxLength 20
693
+ */
694
+ couponCode?: string | null;
695
+ /** Captcha data to prove you are not a robot */
696
+ captcha?: Captcha;
697
+ /** Visitor info */
698
+ guest?: Guest;
699
+ /**
700
+ * Form submission id that was submitted together with the order
701
+ * @format GUID
702
+ */
703
+ submissionId?: string | null;
669
704
  }
670
- declare enum Set {
671
- /** Same behavior as `BASIC`.` */
672
- UNKNOWN_SET = "UNKNOWN_SET",
673
- /** Doesn't return any order form submission data. */
674
- BASIC = "BASIC",
675
- /** Returns all order form submission data. */
676
- FULL = "FULL"
705
+ interface Captcha {
706
+ /** Token from captcha */
707
+ token?: string;
677
708
  }
678
- /** @enumType */
679
- type SetWithLiterals = Set | 'UNKNOWN_SET' | 'BASIC' | 'FULL';
680
- interface GetOrderResponse {
709
+ interface Guest {
710
+ /**
711
+ * Email for checkout
712
+ * @format EMAIL
713
+ */
714
+ email?: string;
715
+ }
716
+ interface CreateGuestOnlineOrderResponse {
681
717
  /** Order. */
682
718
  order?: Order;
683
719
  }
684
- interface ListOrdersRequest {
720
+ interface CreateOfflineOrderRequest {
685
721
  /**
686
- * Filter by a buyer's member ID, from the Members API.
722
+ * ID of the plan being ordered, from the Plans API.
687
723
  * @format GUID
688
724
  */
689
- buyerIds?: string[];
725
+ planId: string;
690
726
  /**
691
- * Filter by plan IDs, from the Plans API.
727
+ * ID of the member ordering the plan, from the Members API.
692
728
  * @format GUID
693
729
  */
694
- planIds?: string[];
695
- /** Filter by whether or not the auto-renewal of recurring orders was canceled. */
696
- autoRenewCanceled?: boolean | null;
697
- /** Filter by order status. */
698
- orderStatuses?: OrderStatusWithLiterals[];
699
- /** Filter by payment status. */
700
- paymentStatuses?: PaymentStatusWithLiterals[];
730
+ memberId: string;
701
731
  /**
702
- * Number of orders to return. See Sorting and Paging for more information.
732
+ * Start date and time for the ordered plan in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
703
733
  *
704
- * Max: `50`
705
- * @min 1
706
- * @max 50
734
+ * Default: Current date and time.
707
735
  */
708
- limit?: number | null;
709
- /** Number of orders to skip in the current sort order. */
710
- offset?: number | null;
736
+ startDate?: Date | null;
711
737
  /**
712
- * Sort order.
713
- *
714
- * Use `ASC` for ascending order or `DESC` for descending order.
738
+ * Whether the order is paid.
715
739
  *
716
- * Default: `DESC`.
740
+ * Default: `false`
717
741
  */
718
- sorting?: Sorting;
742
+ paid?: boolean | null;
719
743
  /**
720
- * Predefined set of fields to return.
744
+ * Coupon code to apply, from the Coupons API.
745
+ * @minLength 1
746
+ * @maxLength 20
747
+ */
748
+ couponCode?: string | null;
749
+ /**
750
+ * Form submission ID that was submitted with the order.
721
751
  *
722
- * Default: If `fieldSet` is omitted, no order form submission data is returned.
752
+ * The submission must belong to the form attached to the plan, and that form must belong to the Pricing Plans namespace.
753
+ * An invalid submission ID is dropped and the order is created without a submission.
754
+ * @format GUID
723
755
  */
724
- fieldSet?: SetWithLiterals;
756
+ submissionId?: string | null;
725
757
  }
726
- interface Sorting {
758
+ interface CreateOfflineOrderResponse {
759
+ /** Order. */
760
+ order?: Order;
761
+ }
762
+ interface CreateExternalOrderRequest {
727
763
  /**
728
- * Name of the field to sort by.
729
- * @maxLength 512
764
+ * Plan ID.
765
+ * @format GUID
730
766
  */
731
- fieldName?: string;
732
- /** Sort order. */
733
- order?: SortOrderWithLiterals;
767
+ planId?: string;
734
768
  /**
735
- * Origin point for geo-distance sorting on a GEO field
736
- * results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
769
+ * Form submission id that was submitted together with the order
770
+ * @format GUID
737
771
  */
738
- origin?: AddressLocation;
739
- }
740
- declare enum SortOrder {
741
- ASC = "ASC",
742
- DESC = "DESC"
743
- }
744
- /** @enumType */
745
- type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';
746
- interface AddressLocation {
747
- /** Address latitude. */
748
- latitude?: number | null;
749
- /** Address longitude. */
750
- longitude?: number | null;
751
- }
752
- interface ListOrdersResponse {
753
- /** List of orders. */
754
- orders?: Order[];
755
- /** Object containing paging-related data (number of orders returned, offset). */
756
- pagingMetadata?: PagingMetadataV2;
772
+ submissionId?: string | null;
757
773
  }
758
- interface PagingMetadataV2 {
759
- /** Number of items returned in the response. */
760
- count?: number | null;
761
- /** Offset that was requested. */
762
- offset?: number | null;
763
- /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
764
- total?: number | null;
765
- /** Flag that indicates the server failed to calculate the `total` field. */
766
- tooManyToCount?: boolean | null;
767
- /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
768
- cursors?: Cursors;
774
+ interface CreateExternalOrderResponse {
775
+ /** Created order */
776
+ order?: Order;
769
777
  }
770
- interface Cursors {
778
+ interface GetOnlineOrderPreviewRequest {
771
779
  /**
772
- * Cursor string pointing to the next page in the list of results.
773
- * @maxLength 16000
780
+ * Plan ID.
781
+ * @format GUID
774
782
  */
775
- next?: string | null;
783
+ planId: string;
776
784
  /**
777
- * Cursor pointing to the previous page in the list of results.
778
- * @maxLength 16000
785
+ * Start date and time for the plan of the order preview in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
786
+ *
787
+ * Default: Current date and time.
779
788
  */
780
- prev?: string | null;
781
- }
782
- interface GetOrdersStatsRequest {
789
+ startDate?: Date | null;
790
+ /**
791
+ * Coupon code to apply.
792
+ * @minLength 1
793
+ * @maxLength 20
794
+ */
795
+ couponCode?: string | null;
783
796
  }
784
- interface GetOrdersStatsResponse {
785
- /** Total number of orders. */
786
- totalOrderCount?: number;
787
- /** Number of active orders. */
788
- activeOrderCount?: number;
797
+ interface GetOnlineOrderPreviewResponse {
798
+ /** Order preview. This field is undefined if the member has already reached the purchase limit for the order's plan. */
799
+ order?: Order;
800
+ /** Whether the member has already reached purchase limit for the order's plan. */
801
+ purchaseLimitExceeded?: boolean;
789
802
  }
790
- interface GetAvailableOrderActionsRequest {
803
+ interface GetGuestOnlineOrderPreviewRequest {
791
804
  /**
792
- * Order ID.
805
+ * Plan ID.
793
806
  * @format GUID
794
807
  */
795
- _id?: string;
796
- }
797
- interface GetAvailableOrderActionsResponse {
798
- /** Whether the order can be suspended. */
799
- suspendable?: boolean;
800
- /** If the order cannot be suspended, a reason is returned here. */
801
- notSuspendableReason?: ReasonNotSuspendableWithLiterals;
802
- /** Whether the order can be canceled by the buyer. */
803
- cancelableByBuyer?: boolean;
804
- }
805
- declare enum ReasonNotSuspendable {
806
- /** Undefined reason. */
807
- UNDEFINED = "UNDEFINED",
808
- /** Saved in the database but is awaiting payment. Non-active orders can't be suspended. */
809
- PENDING = "PENDING",
810
- /** Trial orders can't be suspended. */
811
- TRIAL = "TRIAL",
812
- /** Canceled orders can't be suspended. */
813
- CANCELED = "CANCELED",
814
- /** Ended orders can't be suspended. */
815
- ENDED = "ENDED",
816
- /** Paid for orders with future start dates can't be suspended. */
817
- NOT_STARTED = "NOT_STARTED",
818
- /** Order is already suspended. */
819
- ALREADY_SUSPENDED = "ALREADY_SUSPENDED",
820
- /** Orders based on recurring payments using older stripe versions can't be suspended. */
821
- OLD_STRIPE = "OLD_STRIPE"
822
- }
823
- /** @enumType */
824
- type ReasonNotSuspendableWithLiterals = ReasonNotSuspendable | 'UNDEFINED' | 'PENDING' | 'TRIAL' | 'CANCELED' | 'ENDED' | 'NOT_STARTED' | 'ALREADY_SUSPENDED' | 'OLD_STRIPE';
825
- interface PostponeEndDateRequest {
808
+ planId?: string;
826
809
  /**
827
- * Order ID.
828
- * @format GUID
810
+ * Start date for the ordered plan.
811
+ *
812
+ * Default: Current date
829
813
  */
830
- _id: string;
814
+ startDate?: Date | null;
831
815
  /**
832
- * New end date and time.
833
- *
834
- * Must be later than the current end date and time.
816
+ * Coupon code to apply.
817
+ * @minLength 1
818
+ * @maxLength 20
835
819
  */
836
- endDate: Date | null;
837
- }
838
- interface PostponeEndDateResponse {
820
+ couponCode?: string | null;
821
+ /**
822
+ * Email for checkout
823
+ * @format EMAIL
824
+ */
825
+ email?: string;
839
826
  }
840
- interface OrderEndDatePostponed {
841
- /** Order whose `endDate` was postponed. */
827
+ interface GetGuestOnlineOrderPreviewResponse {
828
+ /** Will be missing if limit is exceeded */
842
829
  order?: Order;
830
+ /**
831
+ * Whether the purchase limit has already been reached for this plan by this email.
832
+ * Always false for plans without purchase limits.
833
+ */
834
+ purchaseLimitExceeded?: boolean;
843
835
  }
844
- interface CancelOrderRequest {
836
+ interface GetOfflineOrderPreviewRequest {
845
837
  /**
846
- * Order ID.
838
+ * ID of the plan of the previewed order, from the Plans API.
847
839
  * @format GUID
848
840
  */
849
- _id: string;
850
- /** __Required.__ When the order will be canceled. One-time orders can only be canceled `IMMEDIATELY`. */
851
- effectiveAt: CancellationEffectiveAtWithLiterals;
852
- }
853
- interface CancelOrderResponse {
841
+ planId: string;
842
+ /**
843
+ * Member ID of the buyer the previewed order is for, from the Members API.
844
+ * @format GUID
845
+ */
846
+ memberId: string;
847
+ /**
848
+ * Start date and time for plan of the previewed order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
849
+ *
850
+ * Default: Current date and time.
851
+ */
852
+ startDate?: Date | null;
853
+ /**
854
+ * Coupon code to apply, from the Coupons API.
855
+ * @minLength 1
856
+ * @maxLength 20
857
+ */
858
+ couponCode?: string | null;
854
859
  }
855
- /**
856
- * Emitted when an order is canceled immediately or when cycle ends for an order with canceled auto renewal
857
- *
858
- * To determine the specific reason of the cancellation check `order.cancellation.cause` field.
859
- */
860
- interface OrderCanceled {
861
- /** Canceled order. */
860
+ interface GetOfflineOrderPreviewResponse {
861
+ /** The previewed order, as if the plan had been ordered. */
862
862
  order?: Order;
863
+ /**
864
+ * Whether this previewed order would exceed the permitted amount of purchases available
865
+ * for this plan for this buyer.
866
+ *
867
+ * Always `false` for plans that do not have purchase limits.
868
+ */
869
+ purchaseLimitExceeded?: boolean;
863
870
  }
864
- interface MarkAsPaidRequest {
871
+ interface GetPricePreviewRequest {
865
872
  /**
866
- * Order ID.
873
+ * ID of plan to preview.
867
874
  * @format GUID
868
875
  */
869
- _id: string;
870
- }
871
- interface MarkAsPaidResponse {
876
+ planId: string;
877
+ /**
878
+ * Coupon code to apply, from the Coupons API.
879
+ * @minLength 1
880
+ * @maxLength 20
881
+ */
882
+ couponCode?: string | null;
872
883
  }
873
- interface OrderMarkedAsPaid {
874
- /** Order that was marked as paid. */
875
- order?: Order;
884
+ interface GetPricePreviewResponse {
885
+ /** Pricing details. */
886
+ prices?: SpannedPrice[];
876
887
  }
877
- interface PauseOrderRequest {
888
+ interface ChangeStartDateRequest {
878
889
  /**
879
- * Order ID.
890
+ * Draft order ID.
880
891
  * @format GUID
881
892
  */
882
- _id: string;
893
+ orderId?: string;
894
+ /** New valid from date (timestamp). */
895
+ startDate?: Date | null;
883
896
  }
884
- interface PauseOrderResponse {
897
+ interface ChangeStartDateResponse {
898
+ /** Updated draft order. */
899
+ order?: Order;
885
900
  }
886
- interface OrderPaused {
887
- /** Paused order. */
901
+ interface OrderStartDateChanged {
902
+ /** Order whose `startDate` changed. */
888
903
  order?: Order;
889
904
  }
890
- interface BulkPauseOrderRequest {
905
+ interface ApplyCouponRequest {
891
906
  /**
892
- * List of Order IDs.
907
+ * Draft order ID.
893
908
  * @format GUID
894
- * @minSize 1
895
- * @maxSize 100
896
909
  */
897
- ids?: string[];
898
- /** Set to true to return Order entity in response. */
899
- returnFullEntity?: boolean;
900
- }
901
- interface BulkPauseOrderResponse {
902
- /** Orders that were paused. */
903
- results?: BulkOrderResult[];
904
- /** Bulk action metadata. */
905
- bulkActionMetadata?: BulkActionMetadata;
910
+ orderId?: string;
911
+ /**
912
+ * Coupon code to apply.
913
+ * @minLength 1
914
+ * @maxLength 20
915
+ */
916
+ couponCode?: string;
906
917
  }
907
- interface BulkOrderResult {
908
- /** Item metadata */
909
- itemMetadata?: ItemMetadata;
910
- /** The order. */
918
+ interface ApplyCouponResponse {
919
+ /** Order with applied coupon and recalculated tax. */
911
920
  order?: Order;
912
921
  }
913
- interface ItemMetadata {
914
- /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
915
- _id?: string | null;
916
- /** Index of the item within the request array. Allows for correlation between request and response items. */
917
- originalIndex?: number;
918
- /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
919
- success?: boolean;
920
- /** Details about the error in case of failure. */
921
- error?: ApplicationError;
922
- }
923
- interface ApplicationError {
924
- /** Error code. */
925
- code?: string;
926
- /** Description of the error. */
927
- description?: string;
928
- /** Data related to the error. */
929
- data?: Record<string, any> | null;
930
- }
931
- interface BulkActionMetadata {
932
- /** Number of items that were successfully processed. */
933
- totalSuccesses?: number;
934
- /** Number of items that couldn't be processed. */
935
- totalFailures?: number;
936
- /** Number of failures without details because detailed failure threshold was exceeded. */
937
- undetailedFailures?: number;
938
- }
939
- interface ResumeOrderRequest {
922
+ interface SetSubmissionRequest {
940
923
  /**
941
924
  * Order ID.
942
925
  * @format GUID
943
926
  */
944
- _id: string;
945
- }
946
- interface ResumeOrderResponse {
947
- }
948
- interface OrderResumed {
949
- /** Resumed order. */
950
- order?: Order;
951
- }
952
- interface BulkResumeOrderRequest {
927
+ orderId?: string;
953
928
  /**
954
- * List of Order IDs.
929
+ * Submission ID.
955
930
  * @format GUID
956
- * @minSize 1
957
- * @maxSize 100
958
931
  */
959
- ids?: string[];
960
- /** Set to true to return Order entity in response. */
961
- returnFullEntity?: boolean;
932
+ submissionId?: string;
962
933
  }
963
- interface BulkResumeOrderResponse {
964
- /** Orders that were resumed. */
965
- results?: BulkOrderResult[];
966
- /** Bulk action metadata. */
967
- bulkActionMetadata?: BulkActionMetadata;
934
+ interface SetSubmissionResponse {
935
+ /** Order with submission id */
936
+ order?: Order;
968
937
  }
969
938
  interface MessageEnvelope {
970
939
  /**
@@ -1057,308 +1026,345 @@ interface AccountInfo {
1057
1026
  */
1058
1027
  siteId?: string | null;
1059
1028
  }
1060
- interface CreateOnlineOrderRequest {
1029
+ interface OrderPurchased {
1030
+ /** Order that was paid for. If a free or an offline order, the order that was created. */
1031
+ order?: Order;
1032
+ }
1033
+ interface OrderStarted {
1034
+ /** Order that reached its `startDate`. */
1035
+ order?: Order;
1036
+ }
1037
+ /**
1038
+ * Triggered at the start of a new payment cycle for an existing order.
1039
+ *
1040
+ * This webhook does not trigger at the initial start of an offline order.
1041
+ */
1042
+ interface OrderCycleStarted {
1043
+ /** Order whose new cycle started. */
1044
+ order?: Order;
1045
+ /** Number of the payment cycle will be 0 when the order is in the free trial period. In other cases, the cycle number starts from 1. */
1046
+ cycleNumber?: number;
1047
+ }
1048
+ /** Emitted when a recurring order is canceled for the next payment cycle */
1049
+ interface OrderAutoRenewCanceled {
1050
+ /** Order that is canceled, effective at the end of the current payment cycle. */
1051
+ order?: Order;
1052
+ }
1053
+ interface OrderEnded {
1054
+ /** Order that ended. */
1055
+ order?: Order;
1056
+ }
1057
+ interface GetOrderRequest {
1061
1058
  /**
1062
- * Plan ID.
1059
+ * Order ID.
1063
1060
  * @format GUID
1064
1061
  */
1065
- planId: string;
1062
+ _id: string;
1066
1063
  /**
1067
- * Start date and time for the plan of the online order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
1064
+ * Predefined set of fields to return.
1068
1065
  *
1069
- * Default: Current date and time.
1066
+ * Default: If `fieldSet` is omitted, no order form submission data is returned.
1070
1067
  */
1071
- startDate?: Date | null;
1072
- /**
1073
- * Coupon code to apply.
1074
- * @minLength 1
1075
- * @maxLength 20
1076
- */
1077
- couponCode?: string | null;
1078
- /** Provided if checkout is initiated on buyer's behalf. */
1079
- onBehalf?: OnBehalf;
1080
- /**
1081
- * Submission ID of the form submitted with this order.
1082
- * @format GUID
1083
- */
1084
- submissionId?: string | null;
1085
- }
1086
- interface OnBehalf {
1087
- /**
1088
- * Member ID.
1089
- * @format GUID
1090
- */
1091
- memberId?: string;
1092
- /** Method by which checkout is initiated. */
1093
- orderMethod?: OrderMethodWithLiterals;
1094
- }
1095
- interface CreateOnlineOrderResponse {
1096
- /** Created online order. */
1097
- order?: Order;
1098
- }
1099
- interface CouponsError {
1100
- /** Coupon code. */
1101
- couponCode?: string;
1102
- /** Plan ID. */
1103
- planId?: string;
1104
- }
1105
- interface CreateGuestOnlineOrderRequest {
1106
- /**
1107
- * Plan ID.
1108
- * @format GUID
1109
- */
1110
- planId?: string;
1111
- /**
1112
- * Start date for the ordered plan.
1113
- *
1114
- * Default: Current date
1115
- */
1116
- startDate?: Date | null;
1117
- /**
1118
- * Coupon code to apply.
1119
- * @minLength 1
1120
- * @maxLength 20
1121
- */
1122
- couponCode?: string | null;
1123
- /** Captcha data to prove you are not a robot */
1124
- captcha?: Captcha;
1125
- /** Visitor info */
1126
- guest?: Guest;
1127
- /**
1128
- * Form submission id that was submitted together with the order
1129
- * @format GUID
1130
- */
1131
- submissionId?: string | null;
1132
- }
1133
- interface Captcha {
1134
- /** Token from captcha */
1135
- token?: string;
1068
+ fieldSet?: SetWithLiterals;
1136
1069
  }
1137
- interface Guest {
1138
- /**
1139
- * Email for checkout
1140
- * @format EMAIL
1141
- */
1142
- email?: string;
1070
+ declare enum Set {
1071
+ /** Same behavior as `BASIC`.` */
1072
+ UNKNOWN_SET = "UNKNOWN_SET",
1073
+ /** Doesn't return any order form submission data. */
1074
+ BASIC = "BASIC",
1075
+ /** Returns all order form submission data. */
1076
+ FULL = "FULL"
1143
1077
  }
1144
- interface CreateGuestOnlineOrderResponse {
1078
+ /** @enumType */
1079
+ type SetWithLiterals = Set | 'UNKNOWN_SET' | 'BASIC' | 'FULL';
1080
+ interface GetOrderResponse {
1145
1081
  /** Order. */
1146
1082
  order?: Order;
1147
1083
  }
1148
- interface CreateOfflineOrderRequest {
1084
+ interface ListOrdersRequest {
1149
1085
  /**
1150
- * ID of the plan being ordered, from the Plans API.
1086
+ * Filter by a buyer's member ID, from the Members API.
1151
1087
  * @format GUID
1152
1088
  */
1153
- planId: string;
1089
+ buyerIds?: string[];
1154
1090
  /**
1155
- * ID of the member ordering the plan, from the Members API.
1091
+ * Filter by plan IDs, from the Plans API.
1156
1092
  * @format GUID
1157
1093
  */
1158
- memberId: string;
1094
+ planIds?: string[];
1095
+ /** Filter by whether or not the auto-renewal of recurring orders was canceled. */
1096
+ autoRenewCanceled?: boolean | null;
1097
+ /** Filter by order status. */
1098
+ orderStatuses?: OrderStatusWithLiterals[];
1099
+ /** Filter by payment status. */
1100
+ paymentStatuses?: PaymentStatusWithLiterals[];
1159
1101
  /**
1160
- * Start date and time for the ordered plan in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
1102
+ * Number of orders to return. See Sorting and Paging for more information.
1161
1103
  *
1162
- * Default: Current date and time.
1104
+ * Max: `50`
1105
+ * @min 1
1106
+ * @max 50
1163
1107
  */
1164
- startDate?: Date | null;
1108
+ limit?: number | null;
1109
+ /** Number of orders to skip in the current sort order. */
1110
+ offset?: number | null;
1165
1111
  /**
1166
- * Whether the order is paid.
1112
+ * Sort order.
1167
1113
  *
1168
- * Default: `false`
1169
- */
1170
- paid?: boolean | null;
1171
- /**
1172
- * Coupon code to apply, from the Coupons API.
1173
- * @minLength 1
1174
- * @maxLength 20
1114
+ * Use `ASC` for ascending order or `DESC` for descending order.
1115
+ *
1116
+ * Default: `DESC`.
1175
1117
  */
1176
- couponCode?: string | null;
1118
+ sorting?: Sorting;
1177
1119
  /**
1178
- * Form submission ID that was submitted with the order.
1179
- * @format GUID
1120
+ * Predefined set of fields to return.
1121
+ *
1122
+ * Default: If `fieldSet` is omitted, no order form submission data is returned.
1180
1123
  */
1181
- submissionId?: string | null;
1182
- }
1183
- interface CreateOfflineOrderResponse {
1184
- /** Order. */
1185
- order?: Order;
1124
+ fieldSet?: SetWithLiterals;
1186
1125
  }
1187
- interface CreateExternalOrderRequest {
1126
+ interface Sorting {
1188
1127
  /**
1189
- * Plan ID.
1190
- * @format GUID
1128
+ * Name of the field to sort by.
1129
+ * @maxLength 512
1191
1130
  */
1192
- planId?: string;
1131
+ fieldName?: string;
1132
+ /** Sort order. */
1133
+ order?: SortOrderWithLiterals;
1193
1134
  /**
1194
- * Form submission id that was submitted together with the order
1195
- * @format GUID
1135
+ * Origin point for geo-distance sorting on a GEO field
1136
+ * results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
1196
1137
  */
1197
- submissionId?: string | null;
1138
+ origin?: AddressLocation;
1198
1139
  }
1199
- interface CreateExternalOrderResponse {
1200
- /** Created order */
1201
- order?: Order;
1140
+ declare enum SortOrder {
1141
+ ASC = "ASC",
1142
+ DESC = "DESC"
1202
1143
  }
1203
- interface GetOnlineOrderPreviewRequest {
1204
- /**
1205
- * Plan ID.
1206
- * @format GUID
1207
- */
1208
- planId: string;
1209
- /**
1210
- * Start date and time for the plan of the order preview in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
1211
- *
1212
- * Default: Current date and time.
1213
- */
1214
- startDate?: Date | null;
1215
- /**
1216
- * Coupon code to apply.
1217
- * @minLength 1
1218
- * @maxLength 20
1219
- */
1220
- couponCode?: string | null;
1144
+ /** @enumType */
1145
+ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';
1146
+ interface AddressLocation {
1147
+ /** Address latitude. */
1148
+ latitude?: number | null;
1149
+ /** Address longitude. */
1150
+ longitude?: number | null;
1221
1151
  }
1222
- interface GetOnlineOrderPreviewResponse {
1223
- /** Order preview. This field is undefined if the member has already reached the purchase limit for the order's plan. */
1224
- order?: Order;
1225
- /** Whether the member has already reached purchase limit for the order's plan. */
1226
- purchaseLimitExceeded?: boolean;
1152
+ interface ListOrdersResponse {
1153
+ /** List of orders. */
1154
+ orders?: Order[];
1155
+ /** Object containing paging-related data (number of orders returned, offset). */
1156
+ pagingMetadata?: PagingMetadataV2;
1227
1157
  }
1228
- interface GetGuestOnlineOrderPreviewRequest {
1229
- /**
1230
- * Plan ID.
1231
- * @format GUID
1232
- */
1233
- planId?: string;
1234
- /**
1235
- * Start date for the ordered plan.
1236
- *
1237
- * Default: Current date
1238
- */
1239
- startDate?: Date | null;
1158
+ interface PagingMetadataV2 {
1159
+ /** Number of items returned in the response. */
1160
+ count?: number | null;
1161
+ /** Offset that was requested. */
1162
+ offset?: number | null;
1163
+ /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
1164
+ total?: number | null;
1165
+ /** Flag that indicates the server failed to calculate the `total` field. */
1166
+ tooManyToCount?: boolean | null;
1167
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
1168
+ cursors?: Cursors;
1169
+ }
1170
+ interface Cursors {
1240
1171
  /**
1241
- * Coupon code to apply.
1242
- * @minLength 1
1243
- * @maxLength 20
1172
+ * Cursor string pointing to the next page in the list of results.
1173
+ * @maxLength 16000
1244
1174
  */
1245
- couponCode?: string | null;
1175
+ next?: string | null;
1246
1176
  /**
1247
- * Email for checkout
1248
- * @format EMAIL
1177
+ * Cursor pointing to the previous page in the list of results.
1178
+ * @maxLength 16000
1249
1179
  */
1250
- email?: string;
1180
+ prev?: string | null;
1251
1181
  }
1252
- interface GetGuestOnlineOrderPreviewResponse {
1253
- /** Will be missing if limit is exceeded */
1254
- order?: Order;
1255
- /**
1256
- * Whether the purchase limit has already been reached for this plan by this email.
1257
- * Always false for plans without purchase limits.
1258
- */
1259
- purchaseLimitExceeded?: boolean;
1182
+ interface GetOrdersStatsRequest {
1260
1183
  }
1261
- interface GetOfflineOrderPreviewRequest {
1184
+ interface GetOrdersStatsResponse {
1185
+ /** Total number of orders. */
1186
+ totalOrderCount?: number;
1187
+ /** Number of active orders. */
1188
+ activeOrderCount?: number;
1189
+ }
1190
+ interface GetAvailableOrderActionsRequest {
1262
1191
  /**
1263
- * ID of the plan of the previewed order, from the Plans API.
1192
+ * Order ID.
1264
1193
  * @format GUID
1265
1194
  */
1266
- planId: string;
1195
+ _id?: string;
1196
+ }
1197
+ interface GetAvailableOrderActionsResponse {
1198
+ /** Whether the order can be suspended. */
1199
+ suspendable?: boolean;
1200
+ /** If the order cannot be suspended, a reason is returned here. */
1201
+ notSuspendableReason?: ReasonNotSuspendableWithLiterals;
1202
+ /** Whether the order can be canceled by the buyer. */
1203
+ cancelableByBuyer?: boolean;
1204
+ }
1205
+ declare enum ReasonNotSuspendable {
1206
+ /** Undefined reason. */
1207
+ UNDEFINED = "UNDEFINED",
1208
+ /** Saved in the database but is awaiting payment. Non-active orders can't be suspended. */
1209
+ PENDING = "PENDING",
1210
+ /** Trial orders can't be suspended. */
1211
+ TRIAL = "TRIAL",
1212
+ /** Canceled orders can't be suspended. */
1213
+ CANCELED = "CANCELED",
1214
+ /** Ended orders can't be suspended. */
1215
+ ENDED = "ENDED",
1216
+ /** Paid for orders with future start dates can't be suspended. */
1217
+ NOT_STARTED = "NOT_STARTED",
1218
+ /** Order is already suspended. */
1219
+ ALREADY_SUSPENDED = "ALREADY_SUSPENDED",
1220
+ /** Orders based on recurring payments using older stripe versions can't be suspended. */
1221
+ OLD_STRIPE = "OLD_STRIPE"
1222
+ }
1223
+ /** @enumType */
1224
+ type ReasonNotSuspendableWithLiterals = ReasonNotSuspendable | 'UNDEFINED' | 'PENDING' | 'TRIAL' | 'CANCELED' | 'ENDED' | 'NOT_STARTED' | 'ALREADY_SUSPENDED' | 'OLD_STRIPE';
1225
+ interface PostponeEndDateRequest {
1267
1226
  /**
1268
- * Member ID of the buyer the previewed order is for, from the Members API.
1227
+ * Order ID.
1269
1228
  * @format GUID
1270
1229
  */
1271
- memberId: string;
1272
- /**
1273
- * Start date and time for plan of the previewed order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.
1274
- *
1275
- * Default: Current date and time.
1276
- */
1277
- startDate?: Date | null;
1278
- /**
1279
- * Coupon code to apply, from the Coupons API.
1280
- * @minLength 1
1281
- * @maxLength 20
1282
- */
1283
- couponCode?: string | null;
1284
- }
1285
- interface GetOfflineOrderPreviewResponse {
1286
- /** The previewed order, as if the plan had been ordered. */
1287
- order?: Order;
1230
+ _id: string;
1288
1231
  /**
1289
- * Whether this previewed order would exceed the permitted amount of purchases available
1290
- * for this plan for this buyer.
1232
+ * New end date and time.
1291
1233
  *
1292
- * Always `false` for plans that do not have purchase limits.
1234
+ * Must be later than the current end date and time.
1293
1235
  */
1294
- purchaseLimitExceeded?: boolean;
1236
+ endDate: Date | null;
1295
1237
  }
1296
- interface GetPricePreviewRequest {
1238
+ interface PostponeEndDateResponse {
1239
+ }
1240
+ interface OrderEndDatePostponed {
1241
+ /** Order whose `endDate` was postponed. */
1242
+ order?: Order;
1243
+ }
1244
+ interface CancelOrderRequest {
1297
1245
  /**
1298
- * ID of plan to preview.
1246
+ * Order ID.
1299
1247
  * @format GUID
1300
1248
  */
1301
- planId: string;
1302
- /**
1303
- * Coupon code to apply, from the Coupons API.
1304
- * @minLength 1
1305
- * @maxLength 20
1306
- */
1307
- couponCode?: string | null;
1249
+ _id: string;
1250
+ /** __Required.__ When the order will be canceled. One-time orders can only be canceled `IMMEDIATELY`. */
1251
+ effectiveAt: CancellationEffectiveAtWithLiterals;
1308
1252
  }
1309
- interface GetPricePreviewResponse {
1310
- /** Pricing details. */
1311
- prices?: SpannedPrice[];
1253
+ interface CancelOrderResponse {
1312
1254
  }
1313
- interface ChangeStartDateRequest {
1255
+ /**
1256
+ * Emitted when an order is canceled immediately or when cycle ends for an order with canceled auto renewal
1257
+ *
1258
+ * To determine the specific reason of the cancellation check `order.cancellation.cause` field.
1259
+ */
1260
+ interface OrderCanceled {
1261
+ /** Canceled order. */
1262
+ order?: Order;
1263
+ }
1264
+ interface MarkAsPaidRequest {
1314
1265
  /**
1315
- * Draft order ID.
1266
+ * Order ID.
1316
1267
  * @format GUID
1317
1268
  */
1318
- orderId?: string;
1319
- /** New valid from date (timestamp). */
1320
- startDate?: Date | null;
1269
+ _id: string;
1321
1270
  }
1322
- interface ChangeStartDateResponse {
1323
- /** Updated draft order. */
1324
- order?: Order;
1271
+ interface MarkAsPaidResponse {
1325
1272
  }
1326
- interface OrderStartDateChanged {
1327
- /** Order whose `startDate` changed. */
1273
+ interface OrderMarkedAsPaid {
1274
+ /** Order that was marked as paid. */
1328
1275
  order?: Order;
1329
1276
  }
1330
- interface ApplyCouponRequest {
1277
+ interface PauseOrderRequest {
1331
1278
  /**
1332
- * Draft order ID.
1279
+ * Order ID.
1333
1280
  * @format GUID
1334
1281
  */
1335
- orderId?: string;
1282
+ _id: string;
1283
+ }
1284
+ interface PauseOrderResponse {
1285
+ }
1286
+ interface OrderPaused {
1287
+ /** Paused order. */
1288
+ order?: Order;
1289
+ }
1290
+ interface BulkPauseOrderRequest {
1336
1291
  /**
1337
- * Coupon code to apply.
1338
- * @minLength 1
1339
- * @maxLength 20
1292
+ * List of Order IDs.
1293
+ * @format GUID
1294
+ * @minSize 1
1295
+ * @maxSize 100
1340
1296
  */
1341
- couponCode?: string;
1297
+ ids?: string[];
1298
+ /** Set to true to return Order entity in response. */
1299
+ returnFullEntity?: boolean;
1342
1300
  }
1343
- interface ApplyCouponResponse {
1344
- /** Order with applied coupon and recalculated tax. */
1301
+ interface BulkPauseOrderResponse {
1302
+ /** Orders that were paused. */
1303
+ results?: BulkOrderResult[];
1304
+ /** Bulk action metadata. */
1305
+ bulkActionMetadata?: BulkActionMetadata;
1306
+ }
1307
+ interface BulkOrderResult {
1308
+ /** Item metadata */
1309
+ itemMetadata?: ItemMetadata;
1310
+ /** The order. */
1345
1311
  order?: Order;
1346
1312
  }
1347
- interface SetSubmissionRequest {
1313
+ interface ItemMetadata {
1314
+ /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
1315
+ _id?: string | null;
1316
+ /** Index of the item within the request array. Allows for correlation between request and response items. */
1317
+ originalIndex?: number;
1318
+ /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
1319
+ success?: boolean;
1320
+ /** Details about the error in case of failure. */
1321
+ error?: ApplicationError;
1322
+ }
1323
+ interface ApplicationError {
1324
+ /** Error code. */
1325
+ code?: string;
1326
+ /** Description of the error. */
1327
+ description?: string;
1328
+ /** Data related to the error. */
1329
+ data?: Record<string, any> | null;
1330
+ }
1331
+ interface BulkActionMetadata {
1332
+ /** Number of items that were successfully processed. */
1333
+ totalSuccesses?: number;
1334
+ /** Number of items that couldn't be processed. */
1335
+ totalFailures?: number;
1336
+ /** Number of failures without details because detailed failure threshold was exceeded. */
1337
+ undetailedFailures?: number;
1338
+ }
1339
+ interface ResumeOrderRequest {
1348
1340
  /**
1349
1341
  * Order ID.
1350
1342
  * @format GUID
1351
1343
  */
1352
- orderId?: string;
1344
+ _id: string;
1345
+ }
1346
+ interface ResumeOrderResponse {
1347
+ }
1348
+ interface OrderResumed {
1349
+ /** Resumed order. */
1350
+ order?: Order;
1351
+ }
1352
+ interface BulkResumeOrderRequest {
1353
1353
  /**
1354
- * Submission ID.
1354
+ * List of Order IDs.
1355
1355
  * @format GUID
1356
+ * @minSize 1
1357
+ * @maxSize 100
1356
1358
  */
1357
- submissionId?: string;
1359
+ ids?: string[];
1360
+ /** Set to true to return Order entity in response. */
1361
+ returnFullEntity?: boolean;
1358
1362
  }
1359
- interface SetSubmissionResponse {
1360
- /** Order with submission id */
1361
- order?: Order;
1363
+ interface BulkResumeOrderResponse {
1364
+ /** Orders that were resumed. */
1365
+ results?: BulkOrderResult[];
1366
+ /** Bulk action metadata. */
1367
+ bulkActionMetadata?: BulkActionMetadata;
1362
1368
  }
1363
1369
  interface MemberGetOrderRequest {
1364
1370
  /**
@@ -1774,16 +1780,12 @@ interface AccountInfoMetadata {
1774
1780
  /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */
1775
1781
  parentAccountId?: string;
1776
1782
  }
1777
- interface OrderAutoRenewCanceledEnvelope {
1778
- data: OrderAutoRenewCanceled;
1783
+ interface OrderCreatedEnvelope {
1784
+ entity: Order;
1779
1785
  metadata: EventMetadata;
1780
1786
  }
1781
1787
  /**
1782
- * Triggered when an order is canceled and `effectiveAt` is set to `NEXT_PAYMENT_DATE`.
1783
- *
1784
- * This webhook is *not* triggered in the following scenarios:
1785
- * + When an order is canceled and `effectiveAt` is set to `IMMEDIATELY`. Instead, at the time of cancellation, Order Canceled is triggered.
1786
- * + When an order expires at the end of the current payment cycle because it was canceled and `effectiveAt` was set to `NEXT_PAYMENT_DATE`. Instead, at the time of expiration, Order Canceled and Order Ended are triggered.
1788
+ * Triggered when an order is created.
1787
1789
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1788
1790
  * @permissionScopeId SCOPE.RENTALS.MANAGE
1789
1791
  * @permissionScope Manage Orders
@@ -1796,21 +1798,17 @@ interface OrderAutoRenewCanceledEnvelope {
1796
1798
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1797
1799
  * @permissionId PRICING_PLANS.READ_ORDERS
1798
1800
  * @webhook
1799
- * @eventType wix.pricing_plans.v2.order_auto_renew_canceled
1800
- * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1801
- * @slug auto_renew_canceled
1801
+ * @eventType wix.pricing_plans.v2.order_created
1802
+ * @serviceIdentifier com.wixpress.membership.v2.orders.CheckoutService
1803
+ * @slug created
1802
1804
  */
1803
- declare function onOrderAutoRenewCanceled(handler: (event: OrderAutoRenewCanceledEnvelope) => void | Promise<void>): void;
1804
- interface OrderCanceledEnvelope {
1805
- data: OrderCanceled;
1805
+ declare function onOrderCreated(handler: (event: OrderCreatedEnvelope) => void | Promise<void>): void;
1806
+ interface OrderStartDateChangedEnvelope {
1807
+ data: OrderStartDateChanged;
1806
1808
  metadata: EventMetadata;
1807
1809
  }
1808
1810
  /**
1809
- * Triggered when an order is canceled.
1810
- *
1811
- * This webhook is triggered either immediately or at the end of the current payment cycle, as follows:
1812
- * + If the order is canceled and `effectiveAt` is set to `IMMEDIATELY`, the webhook is triggered immediately when canceled.
1813
- * + If the order is canceled and `effectiveAt` is set to `NEXT_PAYMENT_DATE`, the webhook is triggered at the end of the current payment cycle. In this case, the Order Auto Renew Canceled Webhook is triggered immediately.
1811
+ * Triggered when an order's `startDate` is changed.
1814
1812
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1815
1813
  * @permissionScopeId SCOPE.RENTALS.MANAGE
1816
1814
  * @permissionScope Manage Orders
@@ -1823,42 +1821,25 @@ interface OrderCanceledEnvelope {
1823
1821
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1824
1822
  * @permissionId PRICING_PLANS.READ_ORDERS
1825
1823
  * @webhook
1826
- * @eventType wix.pricing_plans.v2.order_canceled
1827
- * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1828
- * @slug canceled
1824
+ * @eventType wix.pricing_plans.v2.order_start_date_changed
1825
+ * @serviceIdentifier com.wixpress.membership.v2.orders.CheckoutService
1826
+ * @slug start_date_changed
1829
1827
  */
1830
- declare function onOrderCanceled(handler: (event: OrderCanceledEnvelope) => void | Promise<void>): void;
1831
- interface OrderCycleStartedEnvelope {
1832
- data: OrderCycleStarted;
1828
+ declare function onOrderStartDateChanged(handler: (event: OrderStartDateChangedEnvelope) => void | Promise<void>): void;
1829
+ interface OrderUpdatedEnvelope {
1830
+ entity: Order;
1833
1831
  metadata: EventMetadata;
1834
1832
  }
1835
1833
  /**
1836
- * Triggered at the start of a new payment cycle for an existing order.
1834
+ * Triggered for any of the following update events:
1837
1835
  *
1838
- * Not triggered at the initial start of an offline order.
1839
- * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1840
- * @permissionScopeId SCOPE.RENTALS.MANAGE
1841
- * @permissionScope Manage Orders
1842
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
1843
- * @permissionScope Read Orders
1844
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
1845
- * @permissionScope Manage plans and orders of Pricing Plans
1846
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
1847
- * @permissionScope Manage Events
1848
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1849
- * @permissionId PRICING_PLANS.READ_ORDERS
1850
- * @webhook
1851
- * @eventType wix.pricing_plans.v2.order_cycle_started
1852
- * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1853
- * @slug cycle_started
1854
- */
1855
- declare function onOrderCycleStarted(handler: (event: OrderCycleStartedEnvelope) => void | Promise<void>): void;
1856
- interface OrderEndDatePostponedEnvelope {
1857
- data: OrderEndDatePostponed;
1858
- metadata: EventMetadata;
1859
- }
1860
- /**
1861
- * Triggered when an order's `endDate` is postponed.
1836
+ * + Order is paid for. Order Purchased is also triggered.
1837
+ * + Order reaches its start date or end date. Order Started and Order Ended, respectively, are also triggered.
1838
+ * + New payment cycle of an order starts. Order Cycle Started is also triggered.
1839
+ * + Offline order is marked as paid. Order Marked As Paid is also triggered.
1840
+ * + End date of the order is postponed. Order End Date Postponed is also triggered
1841
+ * + Order is paused, or a paused order is resumed. Order Paused and Order Resumed, respectively, are also triggered.
1842
+ * + Order is canceled, either immediately or at the end of the payment cycle. Order Canceled and Order Auto Renew Canceled, respectively, are also triggered.
1862
1843
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1863
1844
  * @permissionScopeId SCOPE.RENTALS.MANAGE
1864
1845
  * @permissionScope Manage Orders
@@ -1871,44 +1852,21 @@ interface OrderEndDatePostponedEnvelope {
1871
1852
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1872
1853
  * @permissionId PRICING_PLANS.READ_ORDERS
1873
1854
  * @webhook
1874
- * @eventType wix.pricing_plans.v2.order_end_date_postponed
1875
- * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1876
- * @slug end_date_postponed
1855
+ * @eventType wix.pricing_plans.v2.order_updated
1856
+ * @serviceIdentifier com.wixpress.membership.v2.orders.CheckoutService
1857
+ * @slug updated
1877
1858
  */
1878
- declare function onOrderEndDatePostponed(handler: (event: OrderEndDatePostponedEnvelope) => void | Promise<void>): void;
1879
- interface OrderEndedEnvelope {
1880
- data: OrderEnded;
1859
+ declare function onOrderUpdated(handler: (event: OrderUpdatedEnvelope) => void | Promise<void>): void;
1860
+ interface OrderAutoRenewCanceledEnvelope {
1861
+ data: OrderAutoRenewCanceled;
1881
1862
  metadata: EventMetadata;
1882
1863
  }
1883
1864
  /**
1884
- * Triggered when an order ends.
1865
+ * Triggered when an order is canceled and `effectiveAt` is set to `NEXT_PAYMENT_DATE`.
1885
1866
  *
1886
- * This webhook is triggered:
1887
- * + When an order expires at the end of the current payment cycle.
1888
- * + When an order is canceled and `effectiveAt` is set to `IMMEDIATELY`.
1889
- * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1890
- * @permissionScopeId SCOPE.RENTALS.MANAGE
1891
- * @permissionScope Manage Orders
1892
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
1893
- * @permissionScope Read Orders
1894
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
1895
- * @permissionScope Manage plans and orders of Pricing Plans
1896
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
1897
- * @permissionScope Manage Events
1898
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1899
- * @permissionId PRICING_PLANS.READ_ORDERS
1900
- * @webhook
1901
- * @eventType wix.pricing_plans.v2.order_ended
1902
- * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1903
- * @slug ended
1904
- */
1905
- declare function onOrderEnded(handler: (event: OrderEndedEnvelope) => void | Promise<void>): void;
1906
- interface OrderMarkedAsPaidEnvelope {
1907
- data: OrderMarkedAsPaid;
1908
- metadata: EventMetadata;
1909
- }
1910
- /**
1911
- * Triggered when an offline order is marked as paid.
1867
+ * This webhook is *not* triggered in the following scenarios:
1868
+ * + When an order is canceled and `effectiveAt` is set to `IMMEDIATELY`. Instead, at the time of cancellation, Order Canceled is triggered.
1869
+ * + When an order expires at the end of the current payment cycle because it was canceled and `effectiveAt` was set to `NEXT_PAYMENT_DATE`. Instead, at the time of expiration, Order Canceled and Order Ended are triggered.
1912
1870
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1913
1871
  * @permissionScopeId SCOPE.RENTALS.MANAGE
1914
1872
  * @permissionScope Manage Orders
@@ -1921,17 +1879,21 @@ interface OrderMarkedAsPaidEnvelope {
1921
1879
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1922
1880
  * @permissionId PRICING_PLANS.READ_ORDERS
1923
1881
  * @webhook
1924
- * @eventType wix.pricing_plans.v2.order_marked_as_paid
1882
+ * @eventType wix.pricing_plans.v2.order_auto_renew_canceled
1925
1883
  * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1926
- * @slug marked_as_paid
1884
+ * @slug auto_renew_canceled
1927
1885
  */
1928
- declare function onOrderMarkedAsPaid(handler: (event: OrderMarkedAsPaidEnvelope) => void | Promise<void>): void;
1929
- interface OrderPausedEnvelope {
1930
- data: OrderPaused;
1886
+ declare function onOrderAutoRenewCanceled(handler: (event: OrderAutoRenewCanceledEnvelope) => void | Promise<void>): void;
1887
+ interface OrderCanceledEnvelope {
1888
+ data: OrderCanceled;
1931
1889
  metadata: EventMetadata;
1932
1890
  }
1933
1891
  /**
1934
- * Triggered when an order is paused.
1892
+ * Triggered when an order is canceled.
1893
+ *
1894
+ * This webhook is triggered either immediately or at the end of the current payment cycle, as follows:
1895
+ * + If the order is canceled and `effectiveAt` is set to `IMMEDIATELY`, the webhook is triggered immediately when canceled.
1896
+ * + If the order is canceled and `effectiveAt` is set to `NEXT_PAYMENT_DATE`, the webhook is triggered at the end of the current payment cycle. In this case, the Order Auto Renew Canceled Webhook is triggered immediately.
1935
1897
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1936
1898
  * @permissionScopeId SCOPE.RENTALS.MANAGE
1937
1899
  * @permissionScope Manage Orders
@@ -1944,21 +1906,19 @@ interface OrderPausedEnvelope {
1944
1906
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1945
1907
  * @permissionId PRICING_PLANS.READ_ORDERS
1946
1908
  * @webhook
1947
- * @eventType wix.pricing_plans.v2.order_paused
1909
+ * @eventType wix.pricing_plans.v2.order_canceled
1948
1910
  * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1949
- * @slug paused
1911
+ * @slug canceled
1950
1912
  */
1951
- declare function onOrderPaused(handler: (event: OrderPausedEnvelope) => void | Promise<void>): void;
1952
- interface OrderPurchasedEnvelope {
1953
- data: OrderPurchased;
1913
+ declare function onOrderCanceled(handler: (event: OrderCanceledEnvelope) => void | Promise<void>): void;
1914
+ interface OrderCycleStartedEnvelope {
1915
+ data: OrderCycleStarted;
1954
1916
  metadata: EventMetadata;
1955
1917
  }
1956
1918
  /**
1957
- * Triggered for any of the following purchase events:
1958
- * + Order is paid in full.
1959
- * + At least 1 order cycle payment is paid for.
1960
- * + Offline order is created, even if not yet marked as paid.
1961
- * + Free order is created.
1919
+ * Triggered at the start of a new payment cycle for an existing order.
1920
+ *
1921
+ * Not triggered at the initial start of an offline order.
1962
1922
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1963
1923
  * @permissionScopeId SCOPE.RENTALS.MANAGE
1964
1924
  * @permissionScope Manage Orders
@@ -1971,17 +1931,17 @@ interface OrderPurchasedEnvelope {
1971
1931
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1972
1932
  * @permissionId PRICING_PLANS.READ_ORDERS
1973
1933
  * @webhook
1974
- * @eventType wix.pricing_plans.v2.order_purchased
1934
+ * @eventType wix.pricing_plans.v2.order_cycle_started
1975
1935
  * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1976
- * @slug purchased
1936
+ * @slug cycle_started
1977
1937
  */
1978
- declare function onOrderPurchased(handler: (event: OrderPurchasedEnvelope) => void | Promise<void>): void;
1979
- interface OrderResumedEnvelope {
1980
- data: OrderResumed;
1938
+ declare function onOrderCycleStarted(handler: (event: OrderCycleStartedEnvelope) => void | Promise<void>): void;
1939
+ interface OrderEndDatePostponedEnvelope {
1940
+ data: OrderEndDatePostponed;
1981
1941
  metadata: EventMetadata;
1982
1942
  }
1983
1943
  /**
1984
- * Triggered when a paused order is resumed.
1944
+ * Triggered when an order's `endDate` is postponed.
1985
1945
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
1986
1946
  * @permissionScopeId SCOPE.RENTALS.MANAGE
1987
1947
  * @permissionScope Manage Orders
@@ -1994,17 +1954,21 @@ interface OrderResumedEnvelope {
1994
1954
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1995
1955
  * @permissionId PRICING_PLANS.READ_ORDERS
1996
1956
  * @webhook
1997
- * @eventType wix.pricing_plans.v2.order_resumed
1957
+ * @eventType wix.pricing_plans.v2.order_end_date_postponed
1998
1958
  * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
1999
- * @slug resumed
1959
+ * @slug end_date_postponed
2000
1960
  */
2001
- declare function onOrderResumed(handler: (event: OrderResumedEnvelope) => void | Promise<void>): void;
2002
- interface OrderStartedEnvelope {
2003
- data: OrderStarted;
1961
+ declare function onOrderEndDatePostponed(handler: (event: OrderEndDatePostponedEnvelope) => void | Promise<void>): void;
1962
+ interface OrderEndedEnvelope {
1963
+ data: OrderEnded;
2004
1964
  metadata: EventMetadata;
2005
1965
  }
2006
1966
  /**
2007
- * Triggered when an order reaches its `startDate`. Applies to both purchased and free orders.
1967
+ * Triggered when an order ends.
1968
+ *
1969
+ * This webhook is triggered:
1970
+ * + When an order expires at the end of the current payment cycle.
1971
+ * + When an order is canceled and `effectiveAt` is set to `IMMEDIATELY`.
2008
1972
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
2009
1973
  * @permissionScopeId SCOPE.RENTALS.MANAGE
2010
1974
  * @permissionScope Manage Orders
@@ -2017,25 +1981,17 @@ interface OrderStartedEnvelope {
2017
1981
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
2018
1982
  * @permissionId PRICING_PLANS.READ_ORDERS
2019
1983
  * @webhook
2020
- * @eventType wix.pricing_plans.v2.order_started
1984
+ * @eventType wix.pricing_plans.v2.order_ended
2021
1985
  * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
2022
- * @slug started
1986
+ * @slug ended
2023
1987
  */
2024
- declare function onOrderStarted(handler: (event: OrderStartedEnvelope) => void | Promise<void>): void;
2025
- interface OrderUpdatedEnvelope {
2026
- entity: Order;
1988
+ declare function onOrderEnded(handler: (event: OrderEndedEnvelope) => void | Promise<void>): void;
1989
+ interface OrderMarkedAsPaidEnvelope {
1990
+ data: OrderMarkedAsPaid;
2027
1991
  metadata: EventMetadata;
2028
1992
  }
2029
1993
  /**
2030
- * Triggered for any of the following update events:
2031
- *
2032
- * + Order is paid for. Order Purchased is also triggered.
2033
- * + Order reaches its start date or end date. Order Started and Order Ended, respectively, are also triggered.
2034
- * + New payment cycle of an order starts. Order Cycle Started is also triggered.
2035
- * + Offline order is marked as paid. Order Marked As Paid is also triggered.
2036
- * + End date of the order is postponed. Order End Date Postponed is also triggered
2037
- * + Order is paused, or a paused order is resumed. Order Paused and Order Resumed, respectively, are also triggered.
2038
- * + Order is canceled, either immediately or at the end of the payment cycle. Order Canceled and Order Auto Renew Canceled, respectively, are also triggered.
1994
+ * Triggered when an offline order is marked as paid.
2039
1995
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
2040
1996
  * @permissionScopeId SCOPE.RENTALS.MANAGE
2041
1997
  * @permissionScope Manage Orders
@@ -2048,17 +2004,17 @@ interface OrderUpdatedEnvelope {
2048
2004
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
2049
2005
  * @permissionId PRICING_PLANS.READ_ORDERS
2050
2006
  * @webhook
2051
- * @eventType wix.pricing_plans.v2.order_updated
2007
+ * @eventType wix.pricing_plans.v2.order_marked_as_paid
2052
2008
  * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
2053
- * @slug updated
2009
+ * @slug marked_as_paid
2054
2010
  */
2055
- declare function onOrderUpdated(handler: (event: OrderUpdatedEnvelope) => void | Promise<void>): void;
2056
- interface OrderCreatedEnvelope {
2057
- entity: Order;
2011
+ declare function onOrderMarkedAsPaid(handler: (event: OrderMarkedAsPaidEnvelope) => void | Promise<void>): void;
2012
+ interface OrderPausedEnvelope {
2013
+ data: OrderPaused;
2058
2014
  metadata: EventMetadata;
2059
2015
  }
2060
2016
  /**
2061
- * Triggered when an order is created.
2017
+ * Triggered when an order is paused.
2062
2018
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
2063
2019
  * @permissionScopeId SCOPE.RENTALS.MANAGE
2064
2020
  * @permissionScope Manage Orders
@@ -2071,17 +2027,21 @@ interface OrderCreatedEnvelope {
2071
2027
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
2072
2028
  * @permissionId PRICING_PLANS.READ_ORDERS
2073
2029
  * @webhook
2074
- * @eventType wix.pricing_plans.v2.order_created
2075
- * @serviceIdentifier com.wixpress.membership.v2.orders.CheckoutService
2076
- * @slug created
2030
+ * @eventType wix.pricing_plans.v2.order_paused
2031
+ * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
2032
+ * @slug paused
2077
2033
  */
2078
- declare function onOrderCreated(handler: (event: OrderCreatedEnvelope) => void | Promise<void>): void;
2079
- interface OrderStartDateChangedEnvelope {
2080
- data: OrderStartDateChanged;
2034
+ declare function onOrderPaused(handler: (event: OrderPausedEnvelope) => void | Promise<void>): void;
2035
+ interface OrderPurchasedEnvelope {
2036
+ data: OrderPurchased;
2081
2037
  metadata: EventMetadata;
2082
2038
  }
2083
2039
  /**
2084
- * Triggered when an order's `startDate` is changed.
2040
+ * Triggered for any of the following purchase events:
2041
+ * + Order is paid in full.
2042
+ * + At least 1 order cycle payment is paid for.
2043
+ * + Offline order is created, even if not yet marked as paid.
2044
+ * + Free order is created.
2085
2045
  * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
2086
2046
  * @permissionScopeId SCOPE.RENTALS.MANAGE
2087
2047
  * @permissionScope Manage Orders
@@ -2093,186 +2053,58 @@ interface OrderStartDateChangedEnvelope {
2093
2053
  * @permissionScope Manage Events
2094
2054
  * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
2095
2055
  * @permissionId PRICING_PLANS.READ_ORDERS
2096
- * @webhook
2097
- * @eventType wix.pricing_plans.v2.order_start_date_changed
2098
- * @serviceIdentifier com.wixpress.membership.v2.orders.CheckoutService
2099
- * @slug start_date_changed
2100
- */
2101
- declare function onOrderStartDateChanged(handler: (event: OrderStartDateChangedEnvelope) => void | Promise<void>): void;
2102
- /**
2103
- * Retrieves an order by ID.
2104
- * @param _id - Order ID.
2105
- * @public
2106
- * @requiredField _id
2107
- * @param options - Options to use when getting an order.
2108
- * @permissionId PRICING_PLANS.READ_ORDERS
2109
- * @applicableIdentity APP
2110
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.GetOrder
2111
- */
2112
- declare function managementGetOrder(_id: string, options?: ManagementGetOrderOptions): Promise<NonNullablePaths<GetOrderResponse, `order._id` | `order.planId` | `order.subscriptionId` | `order.buyer.memberId` | `order.buyer.contactId` | `order.priceDetails.subscription.cycleDuration.unit` | `order.priceDetails.subtotal` | `order.priceDetails.discount` | `order.priceDetails.tax.name` | `order.priceDetails.tax.includedInPrice` | `order.priceDetails.tax.rate` | `order.priceDetails.tax.amount` | `order.priceDetails.total` | `order.priceDetails.planPrice` | `order.priceDetails.currency` | `order.priceDetails.coupon.code` | `order.priceDetails.coupon.amount` | `order.priceDetails.coupon._id` | `order.pricing.prices` | `order.pricing.prices.${number}.duration.cycleFrom` | `order.pricing.prices.${number}.price.subtotal` | `order.pricing.prices.${number}.price.discount` | `order.pricing.prices.${number}.price.total` | `order.pricing.prices.${number}.price.currency` | `order.pricing.prices.${number}.price.proration` | `order.type` | `order.status` | `order.cancellation.cause` | `order.cancellation.effectiveAt` | `order.lastPaymentStatus` | `order.pausePeriods` | `order.pausePeriods.${number}.status` | `order.currentCycle.index` | `order.planName` | `order.planDescription` | `order.planPrice`, 5>>;
2113
- interface ManagementGetOrderOptions {
2114
- /**
2115
- * Predefined set of fields to return.
2116
- *
2117
- * Default: If `fieldSet` is omitted, no order form submission data is returned.
2118
- */
2119
- fieldSet?: SetWithLiterals;
2120
- }
2121
- /**
2122
- * Retrieves a list of up to 50 pricing plan orders and details, given the specified sorting and filtering.
2123
- *
2124
- * By default, this endpoint will retrieve all orders and return them sorted by `createdDate` in `DESC`, descending order.
2125
- * `sort.fieldName` supports `endDate` and `createdDate` fields and defaults to `ASC`, ascending order.
2126
- * @public
2127
- * @param options - Filtering, sorting, and pagination options.
2128
- * @permissionId PRICING_PLANS.READ_ORDERS
2129
- * @applicableIdentity APP
2130
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.ListOrders
2131
- */
2132
- declare function managementListOrders(options?: ManagementListOrdersOptions): Promise<NonNullablePaths<ListOrdersResponse, `orders` | `orders.${number}._id` | `orders.${number}.planId` | `orders.${number}.subscriptionId` | `orders.${number}.buyer.memberId` | `orders.${number}.buyer.contactId` | `orders.${number}.priceDetails.singlePaymentForDuration.unit` | `orders.${number}.priceDetails.subtotal` | `orders.${number}.priceDetails.discount` | `orders.${number}.priceDetails.tax.name` | `orders.${number}.priceDetails.tax.includedInPrice` | `orders.${number}.priceDetails.tax.rate` | `orders.${number}.priceDetails.tax.amount` | `orders.${number}.priceDetails.total` | `orders.${number}.priceDetails.planPrice` | `orders.${number}.priceDetails.currency` | `orders.${number}.priceDetails.coupon.code` | `orders.${number}.priceDetails.coupon.amount` | `orders.${number}.priceDetails.coupon._id` | `orders.${number}.type` | `orders.${number}.status` | `orders.${number}.cancellation.cause` | `orders.${number}.cancellation.effectiveAt` | `orders.${number}.lastPaymentStatus` | `orders.${number}.currentCycle.index` | `orders.${number}.planName` | `orders.${number}.planDescription` | `orders.${number}.planPrice`, 4>>;
2133
- interface ManagementListOrdersOptions {
2134
- /**
2135
- * Filter by a buyer's member ID, from the Members API.
2136
- * @format GUID
2137
- */
2138
- buyerIds?: string[];
2139
- /**
2140
- * Filter by plan IDs, from the Plans API.
2141
- * @format GUID
2142
- */
2143
- planIds?: string[];
2144
- /** Filter by whether or not the auto-renewal of recurring orders was canceled. */
2145
- autoRenewCanceled?: boolean | null;
2146
- /** Filter by order status. */
2147
- orderStatuses?: OrderStatusWithLiterals[];
2148
- /** Filter by payment status. */
2149
- paymentStatuses?: PaymentStatusWithLiterals[];
2150
- /**
2151
- * Number of orders to return. See Sorting and Paging for more information.
2152
- *
2153
- * Max: `50`
2154
- * @min 1
2155
- * @max 50
2156
- */
2157
- limit?: number | null;
2158
- /** Number of orders to skip in the current sort order. */
2159
- offset?: number | null;
2160
- /**
2161
- * Sort order.
2162
- *
2163
- * Use `ASC` for ascending order or `DESC` for descending order.
2164
- *
2165
- * Default: `DESC`.
2166
- */
2167
- sorting?: Sorting;
2168
- /**
2169
- * Predefined set of fields to return.
2170
- *
2171
- * Default: If `fieldSet` is omitted, no order form submission data is returned.
2172
- */
2173
- fieldSet?: SetWithLiterals;
2174
- }
2175
- /**
2176
- * Extends the duration of a pricing plan order by postponing the order's `endDate`. Postponing the end date of an order does not impact payments.
2177
- *
2178
- * New `endDate` must be later than the order's current `endDate`. Can't postpone orders that are unlimited.
2179
- * Can't postpone an order with `status`: `PAUSED`.
2180
- * @param _id - Order ID.
2181
- * @param endDate - New end date and time.
2182
- *
2183
- * Must be later than the current end date and time.
2184
- * @public
2185
- * @requiredField _id
2186
- * @requiredField endDate
2187
- * @param options - Options for postponing the end date of an order.
2188
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
2189
- * @applicableIdentity APP
2190
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.PostponeEndDate
2191
- */
2192
- declare function postponeEndDate(_id: string, endDate: Date): Promise<void>;
2193
- /**
2194
- * Cancels an existing order.
2195
- *
2196
- * For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
2197
- * For orders with one-time payments, a cancellation can only be set for `IMMEDIATELY`.
2198
- *
2199
- * #### Canceling during the free trial period.
2200
- *
2201
- * When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end
2202
- * of the free trial period and they will not be billed. The buyer may continue using the benefits until the end
2203
- * of the free trial period.
2204
- *
2205
- * When a Wix user cancels an ordered plan during the free trial period, they choose whether to apply the cancellation
2206
- * `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`. Canceling `IMMEDIATELY` will end the subscription for the buyer
2207
- * immediately, even during the free trial period and the buyer won't be billed. Canceling at the
2208
- * `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period.
2209
- * Then, the subscription ends and the buyer is not billed.
2210
- * @param _id - Order ID.
2211
- * @param effectiveAt - __Required.__ When the order will be canceled. One-time orders can only be canceled `IMMEDIATELY`.
2212
- * @public
2213
- * @requiredField _id
2214
- * @requiredField effectiveAt
2215
- * @param options - Options for canceling orders.
2216
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
2217
- * @applicableIdentity APP
2218
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.CancelOrder
2219
- */
2220
- declare function cancelOrder(_id: string, effectiveAt: CancellationEffectiveAtWithLiterals): Promise<void>;
2221
- /**
2222
- * Marks an offline order as paid.
2223
- * > __Note__: Marking separate payment cycles as paid is not yet supported. The entire order will be marked as paid. Subsequent offline payments do trigger events and emails, but are not registered as additional offline payments.
2224
- *
2225
- * Marking an offline order as paid causes the following changes:
2226
- * - The order's `lastPaymentStatus` changes to `"PAID"`.
2227
- * - The order's status changes to either `"PENDING"` or `"ACTIVE"`, depending on the order's `startDate`.
2228
- *
2229
- * An error occurs if you attempt to:
2230
- * - Mark an already-paid, offline order as paid. You cannot mark an offline order as paid twice.
2231
- * - Mark an online order as paid. The Mark as Paid method is supported for offline orders only.
2232
- * @param _id - Order ID.
2233
- * @public
2234
- * @requiredField _id
2235
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
2236
- * @applicableIdentity APP
2237
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.MarkAsPaid
2056
+ * @webhook
2057
+ * @eventType wix.pricing_plans.v2.order_purchased
2058
+ * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
2059
+ * @slug purchased
2238
2060
  */
2239
- declare function markAsPaid(_id: string): Promise<void>;
2061
+ declare function onOrderPurchased(handler: (event: OrderPurchasedEnvelope) => void | Promise<void>): void;
2062
+ interface OrderResumedEnvelope {
2063
+ data: OrderResumed;
2064
+ metadata: EventMetadata;
2065
+ }
2240
2066
  /**
2241
- * Pauses an order. Calling this method changes the order status to `"PAUSED"` and updates the `pausePeriods` array.
2242
- *
2243
- * Only orders with `status`: `ACTIVE` can be paused.
2244
- * For orders with recurring payments, it also pauses the payment schedule. Buyers are not charged when an order is paused.
2245
- * Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`.
2246
- * The `endDate` and the `earliestEndDate` for the order are adjusted to include the pause period when the order is resumed.
2247
- *
2248
- * To resume a paused order, call Resume Order.
2249
- * @param _id - Order ID.
2250
- * @public
2251
- * @requiredField _id
2252
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
2253
- * @applicableIdentity APP
2254
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.PauseOrder
2067
+ * Triggered when a paused order is resumed.
2068
+ * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
2069
+ * @permissionScopeId SCOPE.RENTALS.MANAGE
2070
+ * @permissionScope Manage Orders
2071
+ * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
2072
+ * @permissionScope Read Orders
2073
+ * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
2074
+ * @permissionScope Manage plans and orders of Pricing Plans
2075
+ * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
2076
+ * @permissionScope Manage Events
2077
+ * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
2078
+ * @permissionId PRICING_PLANS.READ_ORDERS
2079
+ * @webhook
2080
+ * @eventType wix.pricing_plans.v2.order_resumed
2081
+ * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
2082
+ * @slug resumed
2255
2083
  */
2256
- declare function pauseOrder(_id: string): Promise<void>;
2084
+ declare function onOrderResumed(handler: (event: OrderResumedEnvelope) => void | Promise<void>): void;
2085
+ interface OrderStartedEnvelope {
2086
+ data: OrderStarted;
2087
+ metadata: EventMetadata;
2088
+ }
2257
2089
  /**
2258
- * Resumes a paused order. For orders with recurring payments, it also restarts the payment schedule.
2259
- *
2260
- * Resuming an order causes the following changes:
2261
- * - The order status changes to `"ACTIVE"`.
2262
- * - The `pausePeriods` array is updated.
2263
- * - The `endDate` for the order is adjusted to include the pause period.
2264
- * - For orders with recurring payments, the payment schedule is restarted.
2265
- * - The `earliestEndDate` is adjusted to include the pause period. (This property is reserved for future use).
2266
- *
2267
- * To pause an order, call Pause Order.
2268
- * @param _id - Order ID.
2269
- * @public
2270
- * @requiredField _id
2271
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
2272
- * @applicableIdentity APP
2273
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.ResumeOrder
2090
+ * Triggered when an order reaches its `startDate`. Applies to both purchased and free orders.
2091
+ * @permissionScope Manage_Wix_Rentals_App_Forms_submissions
2092
+ * @permissionScopeId SCOPE.RENTALS.MANAGE
2093
+ * @permissionScope Manage Orders
2094
+ * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
2095
+ * @permissionScope Read Orders
2096
+ * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
2097
+ * @permissionScope Manage plans and orders of Pricing Plans
2098
+ * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
2099
+ * @permissionScope Manage Events
2100
+ * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
2101
+ * @permissionId PRICING_PLANS.READ_ORDERS
2102
+ * @webhook
2103
+ * @eventType wix.pricing_plans.v2.order_started
2104
+ * @serviceIdentifier com.wixpress.membership.v2.orders.OrderManagementService
2105
+ * @slug started
2274
2106
  */
2275
- declare function resumeOrder(_id: string): Promise<void>;
2107
+ declare function onOrderStarted(handler: (event: OrderStartedEnvelope) => void | Promise<void>): void;
2276
2108
  /**
2277
2109
  * Creates an online order for a site member.
2278
2110
  *
@@ -2306,6 +2138,9 @@ interface CreateOnlineOrderOptions {
2306
2138
  onBehalf?: OnBehalf;
2307
2139
  /**
2308
2140
  * Submission ID of the form submitted with this order.
2141
+ *
2142
+ * The submission must belong to the form attached to the plan, and that form must belong to the Pricing Plans namespace.
2143
+ * An invalid submission ID is dropped and the order is created without a submission.
2309
2144
  * @format GUID
2310
2145
  */
2311
2146
  submissionId?: string | null;
@@ -2363,6 +2198,9 @@ interface CreateOfflineOrderOptions {
2363
2198
  couponCode?: string | null;
2364
2199
  /**
2365
2200
  * Form submission ID that was submitted with the order.
2201
+ *
2202
+ * The submission must belong to the form attached to the plan, and that form must belong to the Pricing Plans namespace.
2203
+ * An invalid submission ID is dropped and the order is created without a submission.
2366
2204
  * @format GUID
2367
2205
  */
2368
2206
  submissionId?: string | null;
@@ -2467,6 +2305,180 @@ interface GetPricePreviewOptions {
2467
2305
  */
2468
2306
  couponCode?: string | null;
2469
2307
  }
2308
+ /**
2309
+ * Retrieves an order by ID.
2310
+ * @param _id - Order ID.
2311
+ * @public
2312
+ * @requiredField _id
2313
+ * @param options - Options to use when getting an order.
2314
+ * @permissionId PRICING_PLANS.READ_ORDERS
2315
+ * @applicableIdentity APP
2316
+ * @fqn com.wixpress.membership.v2.orders.OrderManagementService.GetOrder
2317
+ */
2318
+ declare function managementGetOrder(_id: string, options?: ManagementGetOrderOptions): Promise<NonNullablePaths<GetOrderResponse, `order._id` | `order.planId` | `order.subscriptionId` | `order.buyer.memberId` | `order.buyer.contactId` | `order.priceDetails.subscription.cycleDuration.unit` | `order.priceDetails.subtotal` | `order.priceDetails.discount` | `order.priceDetails.tax.name` | `order.priceDetails.tax.includedInPrice` | `order.priceDetails.tax.rate` | `order.priceDetails.tax.amount` | `order.priceDetails.total` | `order.priceDetails.planPrice` | `order.priceDetails.currency` | `order.priceDetails.coupon.code` | `order.priceDetails.coupon.amount` | `order.priceDetails.coupon._id` | `order.pricing.prices` | `order.pricing.prices.${number}.duration.cycleFrom` | `order.pricing.prices.${number}.price.subtotal` | `order.pricing.prices.${number}.price.discount` | `order.pricing.prices.${number}.price.total` | `order.pricing.prices.${number}.price.currency` | `order.pricing.prices.${number}.price.proration` | `order.type` | `order.status` | `order.cancellation.cause` | `order.cancellation.effectiveAt` | `order.lastPaymentStatus` | `order.pausePeriods` | `order.pausePeriods.${number}.status` | `order.currentCycle.index` | `order.planName` | `order.planDescription` | `order.planPrice`, 5>>;
2319
+ interface ManagementGetOrderOptions {
2320
+ /**
2321
+ * Predefined set of fields to return.
2322
+ *
2323
+ * Default: If `fieldSet` is omitted, no order form submission data is returned.
2324
+ */
2325
+ fieldSet?: SetWithLiterals;
2326
+ }
2327
+ /**
2328
+ * Retrieves a list of up to 50 pricing plan orders and details, given the specified sorting and filtering.
2329
+ *
2330
+ * By default, this endpoint will retrieve all orders and return them sorted by `createdDate` in `DESC`, descending order.
2331
+ * `sort.fieldName` supports `endDate` and `createdDate` fields and defaults to `ASC`, ascending order.
2332
+ * @public
2333
+ * @param options - Filtering, sorting, and pagination options.
2334
+ * @permissionId PRICING_PLANS.READ_ORDERS
2335
+ * @applicableIdentity APP
2336
+ * @fqn com.wixpress.membership.v2.orders.OrderManagementService.ListOrders
2337
+ */
2338
+ declare function managementListOrders(options?: ManagementListOrdersOptions): Promise<NonNullablePaths<ListOrdersResponse, `orders` | `orders.${number}._id` | `orders.${number}.planId` | `orders.${number}.subscriptionId` | `orders.${number}.buyer.memberId` | `orders.${number}.buyer.contactId` | `orders.${number}.priceDetails.singlePaymentForDuration.unit` | `orders.${number}.priceDetails.subtotal` | `orders.${number}.priceDetails.discount` | `orders.${number}.priceDetails.tax.name` | `orders.${number}.priceDetails.tax.includedInPrice` | `orders.${number}.priceDetails.tax.rate` | `orders.${number}.priceDetails.tax.amount` | `orders.${number}.priceDetails.total` | `orders.${number}.priceDetails.planPrice` | `orders.${number}.priceDetails.currency` | `orders.${number}.priceDetails.coupon.code` | `orders.${number}.priceDetails.coupon.amount` | `orders.${number}.priceDetails.coupon._id` | `orders.${number}.type` | `orders.${number}.status` | `orders.${number}.cancellation.cause` | `orders.${number}.cancellation.effectiveAt` | `orders.${number}.lastPaymentStatus` | `orders.${number}.currentCycle.index` | `orders.${number}.planName` | `orders.${number}.planDescription` | `orders.${number}.planPrice`, 4>>;
2339
+ interface ManagementListOrdersOptions {
2340
+ /**
2341
+ * Filter by a buyer's member ID, from the Members API.
2342
+ * @format GUID
2343
+ */
2344
+ buyerIds?: string[];
2345
+ /**
2346
+ * Filter by plan IDs, from the Plans API.
2347
+ * @format GUID
2348
+ */
2349
+ planIds?: string[];
2350
+ /** Filter by whether or not the auto-renewal of recurring orders was canceled. */
2351
+ autoRenewCanceled?: boolean | null;
2352
+ /** Filter by order status. */
2353
+ orderStatuses?: OrderStatusWithLiterals[];
2354
+ /** Filter by payment status. */
2355
+ paymentStatuses?: PaymentStatusWithLiterals[];
2356
+ /**
2357
+ * Number of orders to return. See Sorting and Paging for more information.
2358
+ *
2359
+ * Max: `50`
2360
+ * @min 1
2361
+ * @max 50
2362
+ */
2363
+ limit?: number | null;
2364
+ /** Number of orders to skip in the current sort order. */
2365
+ offset?: number | null;
2366
+ /**
2367
+ * Sort order.
2368
+ *
2369
+ * Use `ASC` for ascending order or `DESC` for descending order.
2370
+ *
2371
+ * Default: `DESC`.
2372
+ */
2373
+ sorting?: Sorting;
2374
+ /**
2375
+ * Predefined set of fields to return.
2376
+ *
2377
+ * Default: If `fieldSet` is omitted, no order form submission data is returned.
2378
+ */
2379
+ fieldSet?: SetWithLiterals;
2380
+ }
2381
+ /**
2382
+ * Extends the duration of a pricing plan order by postponing the order's `endDate`. Postponing the end date of an order does not impact payments.
2383
+ *
2384
+ * New `endDate` must be later than the order's current `endDate`. Can't postpone orders that are unlimited.
2385
+ * Can't postpone an order with `status`: `PAUSED`.
2386
+ * @param _id - Order ID.
2387
+ * @param endDate - New end date and time.
2388
+ *
2389
+ * Must be later than the current end date and time.
2390
+ * @public
2391
+ * @requiredField _id
2392
+ * @requiredField endDate
2393
+ * @param options - Options for postponing the end date of an order.
2394
+ * @permissionId PRICING_PLANS.MANAGE_ORDERS
2395
+ * @applicableIdentity APP
2396
+ * @fqn com.wixpress.membership.v2.orders.OrderManagementService.PostponeEndDate
2397
+ */
2398
+ declare function postponeEndDate(_id: string, endDate: Date): Promise<void>;
2399
+ /**
2400
+ * Cancels an existing order.
2401
+ *
2402
+ * For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
2403
+ * For orders with one-time payments, a cancellation can only be set for `IMMEDIATELY`.
2404
+ *
2405
+ * #### Canceling during the free trial period.
2406
+ *
2407
+ * When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end
2408
+ * of the free trial period and they will not be billed. The buyer may continue using the benefits until the end
2409
+ * of the free trial period.
2410
+ *
2411
+ * When a Wix user cancels an ordered plan during the free trial period, they choose whether to apply the cancellation
2412
+ * `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`. Canceling `IMMEDIATELY` will end the subscription for the buyer
2413
+ * immediately, even during the free trial period and the buyer won't be billed. Canceling at the
2414
+ * `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period.
2415
+ * Then, the subscription ends and the buyer is not billed.
2416
+ * @param _id - Order ID.
2417
+ * @param effectiveAt - __Required.__ When the order will be canceled. One-time orders can only be canceled `IMMEDIATELY`.
2418
+ * @public
2419
+ * @requiredField _id
2420
+ * @requiredField effectiveAt
2421
+ * @param options - Options for canceling orders.
2422
+ * @permissionId PRICING_PLANS.MANAGE_ORDERS
2423
+ * @applicableIdentity APP
2424
+ * @fqn com.wixpress.membership.v2.orders.OrderManagementService.CancelOrder
2425
+ */
2426
+ declare function cancelOrder(_id: string, effectiveAt: CancellationEffectiveAtWithLiterals): Promise<void>;
2427
+ /**
2428
+ * Marks an offline order as paid.
2429
+ * > __Note__: Marking separate payment cycles as paid is not yet supported. The entire order will be marked as paid. Subsequent offline payments do trigger events and emails, but are not registered as additional offline payments.
2430
+ *
2431
+ * Marking an offline order as paid causes the following changes:
2432
+ * - The order's `lastPaymentStatus` changes to `"PAID"`.
2433
+ * - The order's status changes to either `"PENDING"` or `"ACTIVE"`, depending on the order's `startDate`.
2434
+ *
2435
+ * An error occurs if you attempt to:
2436
+ * - Mark an already-paid, offline order as paid. You cannot mark an offline order as paid twice.
2437
+ * - Mark an online order as paid. The Mark as Paid method is supported for offline orders only.
2438
+ * @param _id - Order ID.
2439
+ * @public
2440
+ * @requiredField _id
2441
+ * @permissionId PRICING_PLANS.MANAGE_ORDERS
2442
+ * @applicableIdentity APP
2443
+ * @fqn com.wixpress.membership.v2.orders.OrderManagementService.MarkAsPaid
2444
+ */
2445
+ declare function markAsPaid(_id: string): Promise<void>;
2446
+ /**
2447
+ * Pauses an order. Calling this method changes the order status to `"PAUSED"` and updates the `pausePeriods` array.
2448
+ *
2449
+ * Only orders with `status`: `ACTIVE` can be paused.
2450
+ * For orders with recurring payments, it also pauses the payment schedule. Buyers are not charged when an order is paused.
2451
+ * Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`.
2452
+ * The `endDate` and the `earliestEndDate` for the order are adjusted to include the pause period when the order is resumed.
2453
+ *
2454
+ * To resume a paused order, call Resume Order.
2455
+ * @param _id - Order ID.
2456
+ * @public
2457
+ * @requiredField _id
2458
+ * @permissionId PRICING_PLANS.MANAGE_ORDERS
2459
+ * @applicableIdentity APP
2460
+ * @fqn com.wixpress.membership.v2.orders.OrderManagementService.PauseOrder
2461
+ */
2462
+ declare function pauseOrder(_id: string): Promise<void>;
2463
+ /**
2464
+ * Resumes a paused order. For orders with recurring payments, it also restarts the payment schedule.
2465
+ *
2466
+ * Resuming an order causes the following changes:
2467
+ * - The order status changes to `"ACTIVE"`.
2468
+ * - The `pausePeriods` array is updated.
2469
+ * - The `endDate` for the order is adjusted to include the pause period.
2470
+ * - For orders with recurring payments, the payment schedule is restarted.
2471
+ * - The `earliestEndDate` is adjusted to include the pause period. (This property is reserved for future use).
2472
+ *
2473
+ * To pause an order, call Pause Order.
2474
+ * @param _id - Order ID.
2475
+ * @public
2476
+ * @requiredField _id
2477
+ * @permissionId PRICING_PLANS.MANAGE_ORDERS
2478
+ * @applicableIdentity APP
2479
+ * @fqn com.wixpress.membership.v2.orders.OrderManagementService.ResumeOrder
2480
+ */
2481
+ declare function resumeOrder(_id: string): Promise<void>;
2470
2482
  /**
2471
2483
  * Retrieves an order for the currently logged-in member by ID.
2472
2484
  * @param _id - Order ID.