@wix/pricing-plans 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/src/pricing-plans-v2-order.http.d.ts +140 -49
- package/build/cjs/src/pricing-plans-v2-order.http.js +140 -49
- package/build/cjs/src/pricing-plans-v2-order.http.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-order.universal.d.ts +282 -102
- package/build/cjs/src/pricing-plans-v2-order.universal.js +154 -48
- package/build/cjs/src/pricing-plans-v2-order.universal.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-plan.http.d.ts +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.http.js +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.http.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-plan.universal.d.ts +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.universal.js +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.universal.js.map +1 -1
- package/build/es/src/pricing-plans-v2-order.http.d.ts +140 -49
- package/build/es/src/pricing-plans-v2-order.http.js +140 -49
- package/build/es/src/pricing-plans-v2-order.http.js.map +1 -1
- package/build/es/src/pricing-plans-v2-order.universal.d.ts +282 -102
- package/build/es/src/pricing-plans-v2-order.universal.js +154 -48
- package/build/es/src/pricing-plans-v2-order.universal.js.map +1 -1
- package/build/es/src/pricing-plans-v2-plan.http.d.ts +2 -8
- package/build/es/src/pricing-plans-v2-plan.http.js +2 -8
- package/build/es/src/pricing-plans-v2-plan.http.js.map +1 -1
- package/build/es/src/pricing-plans-v2-plan.universal.d.ts +2 -8
- package/build/es/src/pricing-plans-v2-plan.universal.js +2 -8
- package/build/es/src/pricing-plans-v2-plan.universal.js.map +1 -1
- package/package.json +4 -4
@@ -25,8 +25,7 @@ export interface Order {
|
|
25
25
|
/**
|
26
26
|
* ID of the related Wix subscription.
|
27
27
|
*
|
28
|
-
* Every pricing plan order corresponds to a Wix subscription, including orders for single payment plans. See
|
29
|
-
* for a [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business).
|
28
|
+
* Every pricing plan order corresponds to a Wix subscription, including orders for single payment plans. See a [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business).
|
30
29
|
* @readonly
|
31
30
|
*/
|
32
31
|
subscriptionId?: string;
|
@@ -46,7 +45,8 @@ export interface Order {
|
|
46
45
|
*/
|
47
46
|
buyer?: Buyer;
|
48
47
|
/**
|
49
|
-
*
|
48
|
+
* @internal
|
49
|
+
* @internal
|
50
50
|
* @readonly
|
51
51
|
*/
|
52
52
|
priceDetails?: PriceDetails;
|
@@ -58,20 +58,20 @@ export interface Order {
|
|
58
58
|
*/
|
59
59
|
pricing?: PricingDetails;
|
60
60
|
/**
|
61
|
-
* How the order was processed.
|
62
|
-
* + `ONLINE`: The buyer purchased the plan using the site.
|
63
|
-
* + `OFFLINE`: The buyer made a manual, offline purchase without using the site.
|
61
|
+
* How the order was processed. Supported values:
|
62
|
+
* + `"ONLINE"`: The buyer purchased the plan using the site.
|
63
|
+
* + `"OFFLINE"`: The buyer made a manual, offline purchase without using the site.
|
64
64
|
* @readonly
|
65
65
|
*/
|
66
66
|
type?: OrderType;
|
67
67
|
/**
|
68
|
-
* Status of the order.
|
68
|
+
* Status of the order. Supported values:
|
69
69
|
* + `DRAFT`: Order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use to the buyer.
|
70
70
|
* + `PENDING`: Order has been purchased and its start date is set in the future.
|
71
71
|
* + `ACTIVE`: Order has been processed. The plan is available for use.
|
72
|
-
* + `PAUSED`: Order, and use of the plan, is [paused](https://
|
72
|
+
* + `PAUSED`: Order, and use of the plan, is [paused](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/pauseorder). The order, and use of the plan, can be [resumed](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder).
|
73
73
|
* + `ENDED`: Order has completed its duration and is no longer available for use.
|
74
|
-
* + `CANCELED`: Order has been [canceled](https://
|
74
|
+
* + `CANCELED`: Order has been [canceled](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/cancelorder).
|
75
75
|
* @readonly
|
76
76
|
*/
|
77
77
|
status?: OrderStatus;
|
@@ -91,7 +91,9 @@ export interface Order {
|
|
91
91
|
cancellation?: Cancellation;
|
92
92
|
/**
|
93
93
|
* Status of the last payment for the order.
|
94
|
-
* Updated automatically for online orders. Updated manually by the site owner for offline orders.
|
94
|
+
* Updated automatically for online orders. Updated manually by the site owner for offline orders.
|
95
|
+
*
|
96
|
+
* Supported values:
|
95
97
|
* + `PAID`: The last payment was paid.
|
96
98
|
* + `REFUNDED`: The last payment was refunded.
|
97
99
|
* + `FAILED`: The last payment transaction didn't complete.
|
@@ -109,8 +111,8 @@ export interface Order {
|
|
109
111
|
/**
|
110
112
|
* Current end date and time for the ordered plan.
|
111
113
|
*
|
112
|
-
* `endDate` may be updated over the course of an order. If the order is [paused](https://
|
113
|
-
* it will have a later `endDate` once it [resumes](https://
|
114
|
+
* `endDate` may be updated over the course of an order. If the order is [paused](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/pauseorder),
|
115
|
+
* it will have a later `endDate` once it [resumes](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder). `endDate` may also be [postponed](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/postponeenddate).
|
114
116
|
*
|
115
117
|
* Omitted if the order is valid until canceled and still `ACTIVE`.
|
116
118
|
* @readonly
|
@@ -170,12 +172,12 @@ export interface Order {
|
|
170
172
|
}
|
171
173
|
export interface Buyer {
|
172
174
|
/**
|
173
|
-
* Member ID for a
|
175
|
+
* Member ID for a buyer. Learn more about [`wix-members-backend`](https://www.wix.com/velo/reference/wix-members-backend/introduction).
|
174
176
|
* @readonly
|
175
177
|
*/
|
176
178
|
memberId?: string;
|
177
179
|
/**
|
178
|
-
* Contact ID for a
|
180
|
+
* Contact ID for a buyer. Learn more about [Contacts in `wix-crm-backend`](https://www.wix.com/velo/reference/wix-crm-backend/contacts/introduction).
|
179
181
|
* @readonly
|
180
182
|
*/
|
181
183
|
contactId?: string;
|
@@ -321,11 +323,7 @@ export interface PriceDuration {
|
|
321
323
|
export interface Price {
|
322
324
|
/** Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`. */
|
323
325
|
subtotal?: string;
|
324
|
-
/**
|
325
|
-
* Coupon applied to the order.
|
326
|
-
*
|
327
|
-
* See Coupons [to learn more about coupons](https://dev.wix.com/api/rest/coupons).
|
328
|
-
*/
|
326
|
+
/** Coupon applied to the order. */
|
329
327
|
coupon?: Coupon;
|
330
328
|
/** Total discount applied to the order. */
|
331
329
|
discount?: string;
|
@@ -436,10 +434,9 @@ export declare enum PaymentStatus {
|
|
436
434
|
}
|
437
435
|
export interface PausePeriod {
|
438
436
|
/**
|
439
|
-
* Status of the pause period.
|
440
|
-
*
|
441
|
-
* + `
|
442
|
-
* + `ENDED`: Status when the order is [resumed](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/resume-order).
|
437
|
+
* Status of the pause period. Supported values:
|
438
|
+
* + `ACTIVE`: Status while the order is [paused](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/pauseorder).
|
439
|
+
* + `ENDED`: Status when the order is [resumed](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder).
|
443
440
|
*/
|
444
441
|
status?: Status;
|
445
442
|
/** Start date and time of the pause period. */
|
@@ -549,6 +546,7 @@ export declare enum SortOrder {
|
|
549
546
|
DESC = "DESC"
|
550
547
|
}
|
551
548
|
export interface MemberListOrdersResponse {
|
549
|
+
/** List of orders. */
|
552
550
|
orders?: Order[];
|
553
551
|
/** Object containing paging-related data (number of orders returned, offset). */
|
554
552
|
pagingMetadata?: PagingMetadataV2;
|
@@ -636,7 +634,14 @@ export interface QueryOrdersResponse {
|
|
636
634
|
export interface RequestCancellationRequest {
|
637
635
|
/** Order ID. */
|
638
636
|
_id: string;
|
639
|
-
/**
|
637
|
+
/**
|
638
|
+
* Whether to cancel the order immediately or at the next payment date.
|
639
|
+
* One-time payment orders can only be canceled immediately.
|
640
|
+
*
|
641
|
+
* Supported values:
|
642
|
+
* - `"IMMEDIATELY"`: Indicates that the order should be canceled immediately.
|
643
|
+
* - `"NEXT_PAYMENT_DATE"`: Indicates that the order be canceled at the next payment date.
|
644
|
+
*/
|
640
645
|
effectiveAt?: CancellationEffectiveAt;
|
641
646
|
}
|
642
647
|
export interface RequestCancellationResponse {
|
@@ -713,7 +718,7 @@ export interface CreateGuestOnlineOrderResponse {
|
|
713
718
|
export interface CreateOfflineOrderRequest {
|
714
719
|
/** ID of the plan being ordered. See [Plans for more information about plan IDs](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans). */
|
715
720
|
planId: string;
|
716
|
-
/** ID of the member ordering the plan.
|
721
|
+
/** ID of the member ordering the plan. */
|
717
722
|
memberId: string;
|
718
723
|
/**
|
719
724
|
* Start date and time for the ordered plan.
|
@@ -786,7 +791,7 @@ export interface GetGuestOnlineOrderPreviewResponse {
|
|
786
791
|
export interface GetOfflineOrderPreviewRequest {
|
787
792
|
/** ID of the plan of the previewed order. See [Plans for more information about plan IDs](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans). */
|
788
793
|
planId: string;
|
789
|
-
/** Member ID of the buyer the previewed order is for.
|
794
|
+
/** Member ID of the buyer the previewed order is for. */
|
790
795
|
memberId: string;
|
791
796
|
/**
|
792
797
|
* Start date and time for plan of the previewed order.
|
@@ -819,7 +824,9 @@ export interface GetPricePreviewRequest {
|
|
819
824
|
couponCode?: string | null;
|
820
825
|
}
|
821
826
|
export interface GetPricePreviewResponse {
|
822
|
-
/**
|
827
|
+
/**
|
828
|
+
* @internal
|
829
|
+
* @internal */
|
823
830
|
price?: PriceDetails;
|
824
831
|
/** Pricing details. */
|
825
832
|
prices?: SpannedPrice[];
|
@@ -1080,20 +1087,26 @@ export interface BulkResumeOrderResponse {
|
|
1080
1087
|
bulkActionMetadata?: BulkActionMetadata;
|
1081
1088
|
}
|
1082
1089
|
/**
|
1083
|
-
*
|
1090
|
+
* Gets an order by ID for the currently logged-in member.
|
1091
|
+
*
|
1092
|
+
* The `getCurrentMemberOrder()` function returns a Promise that resolves to information about a specified order for the currently logged-in member.
|
1084
1093
|
* @param _id - Order ID.
|
1085
1094
|
* @public
|
1086
1095
|
* @documentationMaturity preview
|
1087
1096
|
* @requiredField _id
|
1097
|
+
* @param options - Options for getting a logged-in member's order.
|
1088
1098
|
*/
|
1089
1099
|
export declare function memberGetOrder(_id: string, options?: MemberGetOrderOptions): Promise<MemberGetOrderResponse>;
|
1090
1100
|
export interface MemberGetOrderOptions {
|
1091
1101
|
fieldSet?: Set;
|
1092
1102
|
}
|
1093
1103
|
/**
|
1094
|
-
*
|
1104
|
+
* Lists orders for the currently logged-in member.
|
1105
|
+
*
|
1106
|
+
* The `memberListOrders()` function returns a Promise that resolves to a list of up to 100 pricing plan orders.
|
1095
1107
|
* @public
|
1096
1108
|
* @documentationMaturity preview
|
1109
|
+
* @param options - Filtering, sorting, and pagination options.
|
1097
1110
|
*/
|
1098
1111
|
export declare function memberListOrders(options?: MemberListOrdersOptions): Promise<MemberListOrdersResponse>;
|
1099
1112
|
export interface MemberListOrdersOptions {
|
@@ -1101,50 +1114,123 @@ export interface MemberListOrdersOptions {
|
|
1101
1114
|
planIds?: string[];
|
1102
1115
|
/** Filter for orders where auto renewal was canceled. */
|
1103
1116
|
autoRenewCanceled?: boolean | null;
|
1104
|
-
/**
|
1117
|
+
/**
|
1118
|
+
* Filter by the order status. Supported values:
|
1119
|
+
* + `DRAFT`: Order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use to the buyer.
|
1120
|
+
* + `PENDING`: Order has been purchased and its start date is set in the future.
|
1121
|
+
* + `ACTIVE`: Order has been processed. The plan is available for use.
|
1122
|
+
* + `PAUSED`: Order, and use of the plan, is [paused](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/pauseorder). The order, and use of the plan, can be [resumed](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder).
|
1123
|
+
* + `ENDED`: Order has completed its duration and is no longer available for use.
|
1124
|
+
* + `CANCELED`: Order has been [canceled](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/cancelorder).
|
1125
|
+
*/
|
1105
1126
|
orderStatuses?: OrderStatus[];
|
1106
|
-
/**
|
1127
|
+
/**
|
1128
|
+
* Key Path to edit
|
1129
|
+
* ManagementListOrdersOptions.paymentStatuses
|
1130
|
+
* Production value
|
1131
|
+
* Filter by payment status.
|
1132
|
+
* Override
|
1133
|
+
* Filter by payment status.
|
1134
|
+
*
|
1135
|
+
* Supported values:
|
1136
|
+
* + `PAID`: The last payment was paid.
|
1137
|
+
* + `REFUNDED`: The last payment was refunded.
|
1138
|
+
* + `FAILED`: The last payment transaction didn't complete.
|
1139
|
+
* + `UNPAID`: The last payment wasn't paid.
|
1140
|
+
* + `PENDING`: Awaiting payment.
|
1141
|
+
* + `NOT_APPLICABLE`: No payment was necessary. For example, for free plans or free trials.
|
1142
|
+
* Mark down view
|
1143
|
+
* Filter by payment status.
|
1144
|
+
*
|
1145
|
+
* Supported values:
|
1146
|
+
*
|
1147
|
+
* PAID: The last payment was paid.
|
1148
|
+
* REFUNDED: The last payment was refunded.
|
1149
|
+
* FAILED: The last payment transaction didn't complete.
|
1150
|
+
* UNPAID: The last payment wasn't paid.
|
1151
|
+
* PENDING: Awaiting payment.
|
1152
|
+
* NOT_APPLICABLE: No payment was necessary. For example, for free plans or free trials.
|
1153
|
+
*/
|
1107
1154
|
paymentStatuses?: PaymentStatus[];
|
1108
|
-
/**
|
1155
|
+
/**
|
1156
|
+
* Number of pricing plan orders to return.
|
1157
|
+
*
|
1158
|
+
* Default: `50`
|
1159
|
+
*/
|
1109
1160
|
limit?: number | null;
|
1110
|
-
/** Number of
|
1161
|
+
/** Number of orders to skip in the current sort order. */
|
1111
1162
|
offset?: number | null;
|
1112
|
-
/**
|
1163
|
+
/**
|
1164
|
+
* Sort order.
|
1165
|
+
*
|
1166
|
+
* Use `ASC` for ascending order or `DESC` for descending order.
|
1167
|
+
*
|
1168
|
+
* Default: `ASC`
|
1169
|
+
*/
|
1113
1170
|
sorting?: Sorting;
|
1114
1171
|
}
|
1115
1172
|
/**
|
1116
|
-
*
|
1117
|
-
*
|
1173
|
+
* Starts the process of canceling an order.
|
1174
|
+
*
|
1175
|
+
*
|
1176
|
+
* The `requestCancellation()` function returns a Promise that resolves when the order cancellation is successfully requested.
|
1177
|
+
*
|
1178
|
+
* For orders with recurring payments, a cancellation can be set to occur either immediately or at the next payment date. For orders with one-time payments, a cancellation occurs immediately after the request is processed.
|
1179
|
+
*
|
1180
|
+
* Requesting an order cancellation starts the cancellation process. The event is triggered immediately and the function's promise is fulfilled. However, there may be some operations that continue to be processed before the status of the order is changed to `"CANCELED"`. For example, payments might need to be refunded before the order is fully canceled.
|
1181
|
+
*
|
1182
|
+
* The [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handler runs when a cancellation is requested. The [`onOrderCanceled()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercanceled) event handler runs when the cancellation is completed.
|
1118
1183
|
* @param _id - Order ID.
|
1119
1184
|
* @public
|
1120
1185
|
* @documentationMaturity preview
|
1121
1186
|
* @requiredField _id
|
1187
|
+
* @param options - Options for requesting a cancellation.
|
1188
|
+
* @returns Fulfilled - When the cancellation process is started.
|
1122
1189
|
*/
|
1123
1190
|
export declare function requestCancellation(_id: string, options?: RequestCancellationOptions): Promise<void>;
|
1124
1191
|
export interface RequestCancellationOptions {
|
1125
|
-
/**
|
1192
|
+
/**
|
1193
|
+
* Whether to cancel the order immediately or at the next payment date.
|
1194
|
+
* One-time payment orders can only be canceled immediately.
|
1195
|
+
*
|
1196
|
+
* Supported values:
|
1197
|
+
* - `"IMMEDIATELY"`: Indicates that the order should be canceled immediately.
|
1198
|
+
* - `"NEXT_PAYMENT_DATE"`: Indicates that the order be canceled at the next payment date.
|
1199
|
+
*/
|
1126
1200
|
effectiveAt?: CancellationEffectiveAt;
|
1127
1201
|
}
|
1128
1202
|
/**
|
1129
1203
|
* Creates an order for a buyer who purchased the plan with an offline transaction.
|
1130
1204
|
*
|
1131
|
-
*
|
1132
|
-
*
|
1133
|
-
*
|
1205
|
+
* The `createOfflineOrder()` function returns a Promise that resolves to an `order` object when the order has been created.
|
1206
|
+
*
|
1207
|
+
* Payment of an offline order is handled in 1 of 2 ways.
|
1208
|
+
* - When creating the order, select `true` in the `paid` request parameter.
|
1209
|
+
* - After creation, with the [`markAsPaid()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/markaspaid) function.
|
1210
|
+
*
|
1211
|
+
* When creating a non-free offline order:
|
1212
|
+
* - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
|
1213
|
+
* The order's last payment status is set to `"UNPAID"` or `"PAID"`.
|
1214
|
+
*
|
1215
|
+
* When creating a free offline order:
|
1216
|
+
* - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
|
1217
|
+
* - The order's last payment status is set to `"NOT_APPLICABLE"`.
|
1134
1218
|
*
|
1135
|
-
*
|
1136
|
-
*
|
1137
|
-
*
|
1219
|
+
* The [`onOrderCreated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercreated) event handler runs when an offline order is created.
|
1220
|
+
*
|
1221
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can create offline orders.
|
1138
1222
|
* @param planId - ID of the plan being ordered. See [Plans for more information about plan IDs](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans).
|
1139
1223
|
* @public
|
1140
1224
|
* @documentationMaturity preview
|
1141
1225
|
* @requiredField options
|
1142
1226
|
* @requiredField options.memberId
|
1143
1227
|
* @requiredField planId
|
1228
|
+
* @param options - Options for creating an offline order.
|
1229
|
+
* @returns Fulfilled - The order of the plan.
|
1144
1230
|
*/
|
1145
1231
|
export declare function createOfflineOrder(planId: string, options: CreateOfflineOrderOptions): Promise<CreateOfflineOrderResponse>;
|
1146
1232
|
export interface CreateOfflineOrderOptions {
|
1147
|
-
/** ID of the member ordering the plan.
|
1233
|
+
/** ID of the member ordering the plan. */
|
1148
1234
|
memberId: string;
|
1149
1235
|
/**
|
1150
1236
|
* Start date and time for the ordered plan.
|
@@ -1158,37 +1244,35 @@ export interface CreateOfflineOrderOptions {
|
|
1158
1244
|
* Default: `false`
|
1159
1245
|
*/
|
1160
1246
|
paid?: boolean | null;
|
1161
|
-
/**
|
1162
|
-
* Coupon code to apply.
|
1163
|
-
*
|
1164
|
-
* See [Coupons to learn more](https://dev.wix.com/api/rest/coupons).
|
1165
|
-
*/
|
1247
|
+
/** Coupon code to apply. */
|
1166
1248
|
couponCode?: string | null;
|
1167
|
-
/** Form submission
|
1249
|
+
/** Form submission ID that was submitted together with the order. */
|
1168
1250
|
submissionId?: string | null;
|
1169
1251
|
}
|
1170
1252
|
/**
|
1171
|
-
*
|
1253
|
+
* Provides a preview of an offline order as if it was purchased.
|
1172
1254
|
*
|
1173
|
-
* The
|
1174
|
-
* created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters
|
1175
|
-
* (`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
|
1176
|
-
* <br>
|
1177
|
-
* If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview.
|
1178
|
-
* But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then
|
1179
|
-
* `purchaseLimitExceeded` will return as `true`.
|
1255
|
+
* The `getOfflineOrderPreview()` function returns a Promise that resolves to a temporary preview of the offline order.
|
1180
1256
|
*
|
1181
|
-
*
|
1257
|
+
* The preview uses the same logic as purchasing a plan, but the preview is not saved. Because an order is not actually created, the preview's `_id` and `subscriptionId` properties are displayed as a string of multiple zero characters (`000000-0000`).
|
1258
|
+
*
|
1259
|
+
* If [taxes are configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection) for the site, taxes are applied to the preview. If not, `tax` previews as `null`.
|
1260
|
+
*
|
1261
|
+
* You can preview the order to check purchase limitations, but the limitations are not enforced for the preview. If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview. But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then `purchaseLimitExceeded` will return as `true`. Thus function is not available to the buyer. You specify the member ID for the buyer whose order should be previewed. To get a general price preview for a plan that's not buyer-specific, use the [`getPricePreview()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/getpricepreview) function.
|
1262
|
+
*
|
1263
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can get offline order previews.
|
1182
1264
|
* @param planId - ID of the plan of the previewed order. See [Plans for more information about plan IDs](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/plans).
|
1183
1265
|
* @public
|
1184
1266
|
* @documentationMaturity preview
|
1185
1267
|
* @requiredField options
|
1186
1268
|
* @requiredField options.memberId
|
1187
1269
|
* @requiredField planId
|
1270
|
+
* @param options - Options for previewing the offline order.
|
1271
|
+
* @returns Fulfilled - A preview of the order.
|
1188
1272
|
*/
|
1189
1273
|
export declare function getOfflineOrderPreview(planId: string, options: GetOfflineOrderPreviewOptions): Promise<GetOfflineOrderPreviewResponse>;
|
1190
1274
|
export interface GetOfflineOrderPreviewOptions {
|
1191
|
-
/** Member ID
|
1275
|
+
/** Member ID for the buyer who might order the plan offline. */
|
1192
1276
|
memberId: string;
|
1193
1277
|
/**
|
1194
1278
|
* Start date and time for plan of the previewed order.
|
@@ -1196,67 +1280,91 @@ export interface GetOfflineOrderPreviewOptions {
|
|
1196
1280
|
* Default: Current date and time
|
1197
1281
|
*/
|
1198
1282
|
startDate?: Date;
|
1199
|
-
/** Coupon code to apply.
|
1283
|
+
/** Coupon code to apply. */
|
1200
1284
|
couponCode?: string | null;
|
1201
1285
|
}
|
1202
1286
|
/**
|
1203
|
-
* Retrieves a
|
1287
|
+
* Retrieves a preview of an order's pricing as if it was purchased.
|
1288
|
+
*
|
1289
|
+
* The `getPricePreview()` function returns a Promise that resolves to a temporary preview of the order's price.
|
1204
1290
|
*
|
1205
|
-
* The price preview uses the same logic as purchasing a plan, but the preview is not saved.
|
1206
|
-
* the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection). The price is returned
|
1207
|
-
* in the [pricing model](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models) format used for orders.
|
1291
|
+
* The price preview uses the same logic for calculating prices as used when purchasing a plan, but the preview is not saved. If [taxes are configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection for the site, taxes are applied to the preview. If not, the `tax` previews as `null`.
|
1208
1292
|
*
|
1209
|
-
* Buyers do not have to be logged in to preview the price, as such, the details returned are not buyer-specific. To
|
1210
|
-
* generate a preview of a purchase for a specific buyer, use [Get Offline Order Preview](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/get-offline-order-preview).
|
1293
|
+
* Buyers do not have to be logged in to preview the price, as such, the details returned by this function are not buyer-specific. To generate a preview of a purchase for a specific-buyer, use the [`getOfflineOrderPreview()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/getofflineorderpreview).
|
1211
1294
|
* @param planId - ID of plan to preview.
|
1212
1295
|
* @public
|
1213
1296
|
* @documentationMaturity preview
|
1214
1297
|
* @requiredField planId
|
1298
|
+
* @param options - Options for getting a price preview.
|
1299
|
+
* @returns Fulfilled - A preview of the pricing for the order.
|
1215
1300
|
*/
|
1216
1301
|
export declare function getPricePreview(planId: string, options?: GetPricePreviewOptions): Promise<GetPricePreviewResponse>;
|
1217
1302
|
export interface GetPricePreviewOptions {
|
1218
|
-
/**
|
1219
|
-
* Coupon code to apply.
|
1220
|
-
*
|
1221
|
-
* See Coupons [to learn more](https://dev.wix.com/api/rest/coupons).
|
1222
|
-
*/
|
1303
|
+
/** Coupon code to apply. */
|
1223
1304
|
couponCode?: string | null;
|
1224
1305
|
}
|
1225
1306
|
/**
|
1226
1307
|
* Retrieves an order by ID.
|
1308
|
+
*
|
1309
|
+
* The `managementGetOrder()` function returns a Promise that resolves to information about the specified order.
|
1310
|
+
*
|
1311
|
+
* >**Note:** Only users with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can get orders.
|
1227
1312
|
* @param _id - Order ID.
|
1228
1313
|
* @public
|
1229
1314
|
* @documentationMaturity preview
|
1230
1315
|
* @requiredField _id
|
1316
|
+
* @param options - Options to use when getting an order.
|
1231
1317
|
*/
|
1232
1318
|
export declare function managementGetOrder(_id: string, options?: ManagementGetOrderOptions): Promise<GetOrderResponse>;
|
1233
1319
|
export interface ManagementGetOrderOptions {
|
1234
1320
|
fieldSet?: Set;
|
1235
1321
|
}
|
1236
1322
|
/**
|
1237
|
-
*
|
1323
|
+
* Lists pricing plan orders.
|
1238
1324
|
*
|
1239
|
-
*
|
1240
|
-
*
|
1325
|
+
* The `managementListOrders()` function returns a Promise that resolves to a list of up to 50 pricing plan orders. You can specify options for filtering, sorting, and paginating the results.
|
1326
|
+
*
|
1327
|
+
* This function returns the orders on the site. To list orders for the currently logged-in member, use [`listMemberOrders()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/memberlistorders).
|
1328
|
+
*
|
1329
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can list orders.
|
1241
1330
|
* @public
|
1242
1331
|
* @documentationMaturity preview
|
1332
|
+
* @param options - Filtering, sorting, and pagination options.
|
1243
1333
|
*/
|
1244
1334
|
export declare function managementListOrders(options?: ManagementListOrdersOptions): Promise<ListOrdersResponse>;
|
1245
1335
|
export interface ManagementListOrdersOptions {
|
1246
|
-
/** Filter by
|
1336
|
+
/** Filter by specific member IDs of buyers who ordered a pricing plan. */
|
1247
1337
|
buyerIds?: string[];
|
1248
|
-
/** Filter by
|
1338
|
+
/** Filter by specific IDs of plans that were ordered. */
|
1249
1339
|
planIds?: string[];
|
1250
1340
|
/** Filter by whether or not the auto-renewal of recurring orders was canceled. */
|
1251
1341
|
autoRenewCanceled?: boolean | null;
|
1252
|
-
/**
|
1342
|
+
/**
|
1343
|
+
* Filter by the order status. Supported values:
|
1344
|
+
* + `DRAFT`: Order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use to the buyer.
|
1345
|
+
* + `PENDING`: Order has been purchased and its start date is set in the future.
|
1346
|
+
* + `ACTIVE`: Order has been processed. The plan is available for use.
|
1347
|
+
* + `PAUSED`: Order, and use of the plan, is [paused](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/pauseorder). The order, and use of the plan, can be [resumed](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder).
|
1348
|
+
* + `ENDED`: Order has completed its duration and is no longer available for use.
|
1349
|
+
* + `CANCELED`: Order has been [canceled](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/cancelorder).
|
1350
|
+
*/
|
1253
1351
|
orderStatuses?: OrderStatus[];
|
1254
|
-
/**
|
1352
|
+
/**
|
1353
|
+
* Filter by payment status.
|
1354
|
+
*
|
1355
|
+
* Supported values:
|
1356
|
+
* + `PAID`: The last payment was paid.
|
1357
|
+
* + `REFUNDED`: The last payment was refunded.
|
1358
|
+
* + `FAILED`: The last payment transaction didn't complete.
|
1359
|
+
* + `UNPAID`: The last payment wasn't paid.
|
1360
|
+
* + `PENDING`: Awaiting payment.
|
1361
|
+
* + `NOT_APPLICABLE`: No payment was necessary. For example, for free plans or free trials.
|
1362
|
+
*/
|
1255
1363
|
paymentStatuses?: PaymentStatus[];
|
1256
1364
|
/**
|
1257
|
-
* Number of orders to return.
|
1365
|
+
* Number of pricing plan orders to return.
|
1258
1366
|
*
|
1259
|
-
*
|
1367
|
+
* Default: `50`
|
1260
1368
|
*/
|
1261
1369
|
limit?: number | null;
|
1262
1370
|
/** Number of orders to skip in the current sort order. */
|
@@ -1273,12 +1381,26 @@ export interface ManagementListOrdersOptions {
|
|
1273
1381
|
/**
|
1274
1382
|
* Extends the duration of a pricing plan order by postponing the order's `endDate`.
|
1275
1383
|
*
|
1276
|
-
*
|
1277
|
-
*
|
1384
|
+
* The `postponeEndDate()` function returns a Promise that resolves when the order's end date is successfully changed.
|
1385
|
+
*
|
1386
|
+
* The new end date and time must be later than the order's current `endDate`.
|
1387
|
+
*
|
1388
|
+
* Postponing the end date of an order does not impact payments. For example, if the pricing plan is for a membership to an online lecture series, and you want to extend the duration of the series because the lecturer could not attend some sessions, you can postpone the end date of the orders for all relevant participants. The participants will not be billed additionally.
|
1389
|
+
*
|
1390
|
+
* Postponing an order causes the following changes:
|
1391
|
+
* - The `endDate` for the order is adjusted to the new end date.
|
1392
|
+
* The `onOrderEndDatePostponed()` and `onOrderUpdated()` event handlers run when an order's end date is postponed or made earlier.
|
1393
|
+
*
|
1394
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can postpone the end date of an order.
|
1395
|
+
*
|
1278
1396
|
* @param _id - Order ID.
|
1279
1397
|
* @public
|
1280
1398
|
* @documentationMaturity preview
|
1281
1399
|
* @requiredField _id
|
1400
|
+
* @param options - Options for postponing the end date of an order.
|
1401
|
+
* @returns Fulfilled - When the order's end date has been postponed or made earlier.
|
1402
|
+
*
|
1403
|
+
*
|
1282
1404
|
*/
|
1283
1405
|
export declare function postponeEndDate(_id: string, options?: PostponeEndDateOptions): Promise<void>;
|
1284
1406
|
export interface PostponeEndDateOptions {
|
@@ -1292,61 +1414,119 @@ export interface PostponeEndDateOptions {
|
|
1292
1414
|
/**
|
1293
1415
|
* Cancels an existing order.
|
1294
1416
|
*
|
1417
|
+
* The `cancelOrder()` function returns a Promise that resolves when the order is successfully canceled.
|
1418
|
+
*
|
1295
1419
|
* For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
|
1296
|
-
* For orders with one-time payments, a cancellation
|
1420
|
+
* For orders with one-time payments, a cancellation occurs `IMMEDIATELY`.
|
1421
|
+
*
|
1422
|
+
* Canceling an order changes the order status to `"CANCELED"`.
|
1423
|
+
* The [`onOrderCanceled()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercanceled) event handler runs when an order is canceled.
|
1297
1424
|
*
|
1298
1425
|
* #### Canceling during the free trial period.
|
1299
1426
|
*
|
1300
|
-
* When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end
|
1301
|
-
*
|
1302
|
-
*
|
1427
|
+
* When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end of the free trial period and they won't be billed. The buyer may continue using the benefits until the end of the free trial period.
|
1428
|
+
*
|
1429
|
+
* When a site owner cancels an ordered plan during the free trial period, they choose to apply the cancellation `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
|
1430
|
+
*
|
1431
|
+
* Canceling `IMMEDIATELY` will end the subscription for the buyer
|
1432
|
+
* immediately, even during the free trial period and the buyer won't be billed.
|
1433
|
+
* Canceling at the `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period. Then, the subscription ends and the buyer is not billed.
|
1434
|
+
*
|
1435
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only users with the "Manage Pricing Plans" and "Manage Subscription" permissions can cancel orders.
|
1436
|
+
*
|
1437
|
+
*
|
1438
|
+
*
|
1303
1439
|
*
|
1304
|
-
* When a site owner cancels an ordered plan during the free trial period, they choose to apply the cancellation
|
1305
|
-
* `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`. Canceling `IMMEDIATELY` will end the subscription for the buyer
|
1306
|
-
* immediately, even during the free trial period and the buyer won't be billed. Canceling at the
|
1307
|
-
* `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period.
|
1308
|
-
* Then, the subscription ends and the buyer is not billed.
|
1309
1440
|
* @param _id - Order ID.
|
1310
1441
|
* @public
|
1311
1442
|
* @documentationMaturity preview
|
1312
1443
|
* @requiredField _id
|
1444
|
+
* @param options - Options for canceling orders.
|
1445
|
+
* @returns Fulfilled - When the order is canceled.
|
1313
1446
|
*/
|
1314
1447
|
export declare function cancelOrder(_id: string, options?: CancelOrderOptions): Promise<void>;
|
1315
1448
|
export interface CancelOrderOptions {
|
1316
|
-
/**
|
1449
|
+
/**
|
1450
|
+
* When the order is canceled.
|
1451
|
+
*
|
1452
|
+
* One time orders can only be canceled immediately. Supported values:
|
1453
|
+
* - `"IMMEDIATELY"`: The order is canceled immediately.
|
1454
|
+
* - `"NEXT_PAYMENT_DATE"`: The order is canceled at the next payment date.
|
1455
|
+
*/
|
1317
1456
|
effectiveAt?: CancellationEffectiveAt;
|
1318
1457
|
}
|
1319
1458
|
/**
|
1320
1459
|
* Marks an offline order as paid.
|
1321
|
-
*
|
1460
|
+
*
|
1461
|
+
* The `markAsPaid()` function returns a Promise that resolves when the offline order is successfully marked as paid.
|
1462
|
+
*
|
1463
|
+
* The entire order is marked as paid, even if the order's payments are recurring.
|
1464
|
+
*
|
1465
|
+
* >**Note:** Marking separate payment cycles as paid is not yet supported. Subsequent offline payments do trigger events and emails, but are not registered as additional offline payments.
|
1466
|
+
*
|
1467
|
+
* Marking an offline order as paid causes the following changes:
|
1468
|
+
* - The order's `lastPaymentStatus` changes to `"PAID"`.
|
1469
|
+
* - The order's status changes to either `"PENDING"` or `"ACTIVE"`, depending on the order's `startDate`.
|
1470
|
+
*
|
1471
|
+
* An error occurs if you attempt to:
|
1472
|
+
* - Mark an already-paid, offline order as paid. You cannot make an offline order as paid twice.
|
1473
|
+
* - Mark an online order as paid. The `markAsPaid()` function is supported for offline orders only.
|
1474
|
+
*
|
1475
|
+
* The [`onOrderMarkedAsPaid()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordermarkedaspaid) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an offline order is marked as paid.
|
1476
|
+
*
|
1477
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can mark offline orders as paid.
|
1322
1478
|
* @param _id - Order ID.
|
1323
1479
|
* @public
|
1324
1480
|
* @documentationMaturity preview
|
1325
1481
|
* @requiredField _id
|
1482
|
+
* @returns Fulfilled - When the order is marked as paid.
|
1326
1483
|
*/
|
1327
1484
|
export declare function markAsPaid(_id: string): Promise<void>;
|
1328
1485
|
/**
|
1329
|
-
* Pauses
|
1486
|
+
* Pauses a pricing plan order.
|
1487
|
+
*
|
1488
|
+
* The `pauseOrder()` function returns a Promise that resolves when the order is successfully paused.
|
1330
1489
|
*
|
1331
|
-
* For orders with recurring payments,
|
1332
|
-
* Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`. Can only pause orders with an `ACTIVE` status.
|
1490
|
+
* For orders with recurring payments, `pauseOrder()` also pauses the payment schedule. Buyers are not charged when an order is paused. Use `pauseOrder()`, for example, if the buyer is away and would like to put their pricing plan membership on hold until they return. Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`. You can only pause orders with an `"ACTIVE`" status.
|
1333
1491
|
*
|
1334
|
-
*
|
1492
|
+
* Pausing an order causes the following changes:
|
1493
|
+
* - The order status changes to `"PAUSED"`.
|
1494
|
+
* - The `pausePeriods` array is updated.
|
1495
|
+
*
|
1496
|
+
* The `endDate` and the `earliestEndDate` for the order are adjusted to include the pause period when the order is resumed.
|
1497
|
+
*
|
1498
|
+
* The [`onOrderPaused()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderpaused) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an order is paused.
|
1499
|
+
*
|
1500
|
+
* Paused orders can be continued with the [`resumeOrder()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder) function.
|
1501
|
+
*
|
1502
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can pause orders.
|
1335
1503
|
* @param _id - Order ID.
|
1336
1504
|
* @public
|
1337
1505
|
* @documentationMaturity preview
|
1338
1506
|
* @requiredField _id
|
1507
|
+
* @returns Fulfilled - When the order is paused.
|
1339
1508
|
*/
|
1340
1509
|
export declare function pauseOrder(_id: string): Promise<void>;
|
1341
1510
|
/**
|
1342
|
-
* Resumes a paused order.
|
1511
|
+
* Resumes a paused pricing plan order.
|
1512
|
+
*
|
1513
|
+
* The `resumeOrder()` function returns a Promise that resolves when a paused order is successfully resumed.
|
1514
|
+
*
|
1515
|
+
* For orders with recurring payments, `resumeOrder()` also restarts the payment schedule.
|
1516
|
+
*
|
1517
|
+
* Resuming an order causes the following changes:
|
1518
|
+
* - The order status changes to `"ACTIVE"`.
|
1519
|
+
* - The `pausePeriods` array is updated.
|
1520
|
+
* - The `endDate` for the order is adjusted to include the pause period.
|
1521
|
+
* - The `earliestEndDate` is adjusted to include the pause period. (This property is reserved for future use.)
|
1522
|
+
*
|
1523
|
+
* The [`onOrderResumed()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderresumed) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an order is resumed.
|
1343
1524
|
*
|
1344
|
-
*
|
1345
|
-
* For orders with recurring payments, it also restarts the payment schedule.
|
1346
|
-
* Use [Pause Order to pause an order](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/pause-order/).
|
1525
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can resume orders.
|
1347
1526
|
* @param _id - Order ID.
|
1348
1527
|
* @public
|
1349
1528
|
* @documentationMaturity preview
|
1350
1529
|
* @requiredField _id
|
1530
|
+
* @returns Fulfilled - When the order is resumed.
|
1351
1531
|
*/
|
1352
1532
|
export declare function resumeOrder(_id: string): Promise<void>;
|