@rechargeapps/storefront-client 0.23.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/cjs/api/bundle.js +42 -5
- package/dist/cjs/api/bundle.js.map +1 -1
- package/dist/cjs/api/customer.js +5 -0
- package/dist/cjs/api/customer.js.map +1 -1
- package/dist/cjs/api/metafield.js +29 -0
- package/dist/cjs/api/metafield.js.map +1 -0
- package/dist/cjs/api/onetime.js +1 -1
- package/dist/cjs/api/onetime.js.map +1 -1
- package/dist/cjs/api/paymentMethod.js.map +1 -1
- package/dist/cjs/index.js +10 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/request.js +2 -0
- package/dist/cjs/utils/request.js.map +1 -1
- package/dist/esm/api/bundle.js +39 -7
- package/dist/esm/api/bundle.js.map +1 -1
- package/dist/esm/api/customer.js +5 -1
- package/dist/esm/api/customer.js.map +1 -1
- package/dist/esm/api/metafield.js +23 -0
- package/dist/esm/api/metafield.js.map +1 -0
- package/dist/esm/api/onetime.js +1 -1
- package/dist/esm/api/onetime.js.map +1 -1
- package/dist/esm/api/paymentMethod.js.map +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/request.js +2 -0
- package/dist/esm/utils/request.js.map +1 -1
- package/dist/index.d.ts +462 -329
- package/dist/umd/recharge-client.min.js +8 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
declare type ColorString = string;
|
|
3
3
|
/** HTML String */
|
|
4
4
|
declare type HTMLString = string;
|
|
5
|
-
/** ISO 8601 date time, YYYY-MM-
|
|
5
|
+
/** ISO 8601 date time, YYYY-MM-DDTHH:MM:SS+00:00 */
|
|
6
6
|
declare type IsoDateString = string;
|
|
7
7
|
interface Property {
|
|
8
8
|
name: string;
|
|
@@ -122,6 +122,372 @@ interface AnalyticsData {
|
|
|
122
122
|
declare type IntervalUnit = 'day' | 'week' | 'month' | 'days' | 'Days' | 'weeks' | 'Weeks' | 'months' | 'Months';
|
|
123
123
|
declare type SubType<T, TRequired extends keyof T = keyof T, TOptional extends keyof T = keyof T> = Required<Pick<T, TRequired>> & Partial<Pick<T, TOptional>>;
|
|
124
124
|
|
|
125
|
+
declare type MetafieldOwnerResource = 'customer' | 'subscription' | 'order' | 'charge';
|
|
126
|
+
interface Metafield {
|
|
127
|
+
/** Unique numeric identifier for the metafield. */
|
|
128
|
+
id: number;
|
|
129
|
+
/** The date and time when the metafield was created. */
|
|
130
|
+
created_at: IsoDateString;
|
|
131
|
+
/** Description of the metafield. */
|
|
132
|
+
description: string;
|
|
133
|
+
/** The name of the metafield. */
|
|
134
|
+
key: string;
|
|
135
|
+
/** A category or container that differentiates your metadata from other metafields. */
|
|
136
|
+
namespace: string;
|
|
137
|
+
/** Unique numeric identifier of the owner_resource. */
|
|
138
|
+
owner_id: number;
|
|
139
|
+
/** Objects which support Metafields */
|
|
140
|
+
owner_resource: MetafieldOwnerResource;
|
|
141
|
+
/** The date and time when the metafield was last updated. */
|
|
142
|
+
updated_at: IsoDateString;
|
|
143
|
+
/** The content of the metafield. */
|
|
144
|
+
value: string;
|
|
145
|
+
/** The type of the value parameter. */
|
|
146
|
+
value_type: 'string' | 'integer' | 'json_string';
|
|
147
|
+
}
|
|
148
|
+
declare type MetafieldRequiredCreateProps = 'key' | 'namespace' | 'owner_id' | 'owner_resource' | 'value' | 'value_type';
|
|
149
|
+
declare type MetafieldOptionalCreateProps = 'description';
|
|
150
|
+
interface MetafieldCreateProps {
|
|
151
|
+
/** Instructs to add the Onetime to the next charge scheduled under this Address. */
|
|
152
|
+
add_to_next_charge?: boolean;
|
|
153
|
+
}
|
|
154
|
+
declare type CreateMetafieldRequest = SubType<Metafield, MetafieldRequiredCreateProps, MetafieldOptionalCreateProps> & MetafieldCreateProps;
|
|
155
|
+
declare type MetafieldOptionalUpdateProps = 'description' | 'owner_id' | 'owner_resource' | 'value' | 'value_type';
|
|
156
|
+
declare type UpdateMetafieldRequest = Partial<Pick<Metafield, MetafieldOptionalUpdateProps>>;
|
|
157
|
+
|
|
158
|
+
interface PaymentDetails {
|
|
159
|
+
/** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
|
|
160
|
+
brand?: string;
|
|
161
|
+
/** Payment_method expiry month. valid for CREDIT_CARD only. */
|
|
162
|
+
exp_month?: string;
|
|
163
|
+
/** Payment_method expiry year. valid for CREDIT_CARD only. */
|
|
164
|
+
exp_year?: string;
|
|
165
|
+
/** last 4-digits of the identifier. valid for CREDIT_CARD only. */
|
|
166
|
+
last4?: string;
|
|
167
|
+
/** email linked to paypal. valid for PAYPAL only. */
|
|
168
|
+
paypal_email?: string;
|
|
169
|
+
/** paypal user identifier. valid for PAYPAL only. */
|
|
170
|
+
paypal_payer_id?: string;
|
|
171
|
+
/** If a digital wallet. */
|
|
172
|
+
wallet_type?: string;
|
|
173
|
+
/** Type of funding for the Payment Method. */
|
|
174
|
+
funding_type?: string;
|
|
175
|
+
}
|
|
176
|
+
declare type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT' | 'IDEAL' | 'SHOP_PAY' | 'PAYPAL_EXPRESS' | 'SOFORT' | 'GIROPAY';
|
|
177
|
+
declare type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie' | 'adyen' | 'shopify_app_subscription_billing';
|
|
178
|
+
declare type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
|
|
179
|
+
interface PaymentMethod {
|
|
180
|
+
/** The unique payment method id for a customer. */
|
|
181
|
+
id: number;
|
|
182
|
+
/** An object with the customer’s address information. */
|
|
183
|
+
billing_address: AssociatedAddress;
|
|
184
|
+
/** The Recharge customer_id */
|
|
185
|
+
customer_id: number;
|
|
186
|
+
/** The time the payment method was created. */
|
|
187
|
+
created_at: IsoDateString;
|
|
188
|
+
/** If this is the default payment method for the customer */
|
|
189
|
+
default: boolean;
|
|
190
|
+
/** Details about the specific payment method */
|
|
191
|
+
payment_details: PaymentDetails;
|
|
192
|
+
/**
|
|
193
|
+
* The type of payment this is.
|
|
194
|
+
* If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
|
|
195
|
+
*/
|
|
196
|
+
payment_type: PaymentType;
|
|
197
|
+
/** The customer token at the processor. */
|
|
198
|
+
processor_customer_token: string;
|
|
199
|
+
/**
|
|
200
|
+
* This will impact validation on billing_details.
|
|
201
|
+
* Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
|
|
202
|
+
*/
|
|
203
|
+
processor_name: ProcessorName;
|
|
204
|
+
/** The payment token at the processor. */
|
|
205
|
+
processor_payment_method_token: string;
|
|
206
|
+
/** State of the Payment Method. */
|
|
207
|
+
status: PaymentMethodStatus;
|
|
208
|
+
/**
|
|
209
|
+
* The status reason for the payment method.
|
|
210
|
+
* Often used when invalid to provide background details in invalidity.
|
|
211
|
+
*/
|
|
212
|
+
status_reason: string;
|
|
213
|
+
/** The time the payment method was last updated. */
|
|
214
|
+
updated_at: IsoDateString;
|
|
215
|
+
/** Additional information as requested */
|
|
216
|
+
includes?: {
|
|
217
|
+
addresses?: Address[];
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
interface PaymentMethodsResponse {
|
|
221
|
+
next_cursor: null | string;
|
|
222
|
+
previous_cursor: null | string;
|
|
223
|
+
payment_methods: PaymentMethod[];
|
|
224
|
+
}
|
|
225
|
+
declare type PaymentMethodOptionalUpdateProps = 'billing_address' | 'default';
|
|
226
|
+
declare type UpdatePaymentMethodRequest = Partial<Pick<PaymentMethod, PaymentMethodOptionalUpdateProps>>;
|
|
227
|
+
declare type PaymentMethodIncludes = 'addresses';
|
|
228
|
+
interface GetPaymentMethodOptions {
|
|
229
|
+
include?: PaymentMethodIncludes[];
|
|
230
|
+
}
|
|
231
|
+
/** no sorting options for payment_methods, always by id-desc */
|
|
232
|
+
declare type PaymentMethodSortBy = null;
|
|
233
|
+
interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
234
|
+
/** Return the payment_methods linked to the given processor_name. */
|
|
235
|
+
processor_name?: ProcessorName;
|
|
236
|
+
/** Return the payment_methods linked to the given address_id. */
|
|
237
|
+
address_id?: string;
|
|
238
|
+
/** Return the payment_methods linked to the given processor_payment_method_token. */
|
|
239
|
+
processor_payment_method_token?: string;
|
|
240
|
+
/** Include related data options */
|
|
241
|
+
include?: PaymentMethodIncludes[];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare type SubscriptionStatus = 'active' | 'cancelled' | 'expired';
|
|
245
|
+
interface Subscription {
|
|
246
|
+
/** Unique numeric identifier for the subscription. */
|
|
247
|
+
id: number;
|
|
248
|
+
/** Unique numeric identifier for the address the subscription is associated with. */
|
|
249
|
+
address_id: number;
|
|
250
|
+
/** Unique numeric identifier for the customer the subscription is tied to. */
|
|
251
|
+
customer_id: number;
|
|
252
|
+
/** An object used to contain analytics data such as utm parameters. */
|
|
253
|
+
analytics_data: AnalyticsData;
|
|
254
|
+
/** Reason provided for cancellation. */
|
|
255
|
+
cancellation_reason: string | null;
|
|
256
|
+
/** Additional comment for cancellation. */
|
|
257
|
+
cancellation_reason_comments: string | null;
|
|
258
|
+
/** The time the subscription was cancelled. */
|
|
259
|
+
cancelled_at: string | null;
|
|
260
|
+
/**
|
|
261
|
+
* The number of units (specified in order_interval_unit) between each Charge. For example, order_interval_unit=month and charge_interval_frequency=3, indicate charge every 3 months.
|
|
262
|
+
* Charges must use the same unit types as orders.
|
|
263
|
+
* Max: 1000
|
|
264
|
+
*/
|
|
265
|
+
charge_interval_frequency: number;
|
|
266
|
+
/** The time the subscription was created. */
|
|
267
|
+
created_at: IsoDateString;
|
|
268
|
+
/** Set the number of charges until subscription expires. */
|
|
269
|
+
expire_after_specific_number_of_charges: number | null;
|
|
270
|
+
/** An object containing the product id as it appears in external platforms. */
|
|
271
|
+
external_product_id: ExternalId;
|
|
272
|
+
/** An object containing the variant id as it appears in external platforms. */
|
|
273
|
+
external_variant_id: ExternalId;
|
|
274
|
+
/** Retrieves true if there is queued charge. Otherwise, retrieves false. */
|
|
275
|
+
has_queued_charges: boolean;
|
|
276
|
+
/** Value is set to true if it is a prepaid item. */
|
|
277
|
+
is_prepaid: boolean;
|
|
278
|
+
/** Value is set to true if it is not a prepaid item */
|
|
279
|
+
is_skippable: boolean;
|
|
280
|
+
/** Value is set to true if it is not a prepaid item and if in Customer portal settings swap is allowed for customers. */
|
|
281
|
+
is_swappable: boolean;
|
|
282
|
+
/** Retrieves true if charge has an error max retries reached. Otherwise, retrieves false. */
|
|
283
|
+
max_retries_reached: boolean;
|
|
284
|
+
/** Date of the next charge for the subscription. */
|
|
285
|
+
next_charge_scheduled_at: IsoDateString;
|
|
286
|
+
/**
|
|
287
|
+
* The set day of the month order is created. Default is that there isn’t a strict day of the month when the order is created.
|
|
288
|
+
* This is only applicable to subscriptions with order_interval_unit:“month”.
|
|
289
|
+
*/
|
|
290
|
+
order_day_of_month: number | null;
|
|
291
|
+
/**
|
|
292
|
+
* The set day of the week order is created. Default is that there isn’t a strict day of the week order is created.
|
|
293
|
+
* This is only applicable to subscriptions with order_interval_unit = “week”.
|
|
294
|
+
* Value of 0 equals to Monday, 1 to Tuesday etc.
|
|
295
|
+
*/
|
|
296
|
+
order_day_of_week: number | null;
|
|
297
|
+
/**
|
|
298
|
+
* The number of units (specified in order_interval_unit) between each order. For example, order_interval_unit=month and order_interval_frequency=3, indicate order every 3 months. Max value: 1000
|
|
299
|
+
*/
|
|
300
|
+
order_interval_frequency: number;
|
|
301
|
+
/** The frequency unit used to determine when a subscription’s order is created. */
|
|
302
|
+
order_interval_unit: IntervalUnit;
|
|
303
|
+
/** The presentment currency of the subscription. */
|
|
304
|
+
presentment_currency: string | null;
|
|
305
|
+
/** The price of the item before discounts, taxes, or shipping have been applied. */
|
|
306
|
+
price: string;
|
|
307
|
+
/** The name of the product in a store’s catalog. */
|
|
308
|
+
product_title: string;
|
|
309
|
+
/** A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself. */
|
|
310
|
+
properties: Property[];
|
|
311
|
+
/** The number of items in the subscription. */
|
|
312
|
+
quantity: number;
|
|
313
|
+
/** A unique identifier of the item in the fulfillment. In cases where SKU is blank, it will be dynamically pulled whenever it is used. */
|
|
314
|
+
sku: string | null;
|
|
315
|
+
/** Flag that is automatically updated to true when SKU is passed on create or update. When sku_override is true, the SKU on the subscription will be used to generate charges and orders. When sku_override is false, Recharge will dynamically fetch the SKU from the corresponding external platform variant. */
|
|
316
|
+
sku_override: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* The status of the subscription.
|
|
319
|
+
* expired - This status occurs when the maximum number of charges for a product has been reached.
|
|
320
|
+
*/
|
|
321
|
+
status: SubscriptionStatus;
|
|
322
|
+
/** The date time at which the purchase_item record was last updated. */
|
|
323
|
+
updated_at: IsoDateString;
|
|
324
|
+
/** The name of the variant in a shop’s catalog. */
|
|
325
|
+
variant_title: string;
|
|
326
|
+
/** Additional information as requested */
|
|
327
|
+
includes?: {
|
|
328
|
+
address?: Address;
|
|
329
|
+
customer?: Customer;
|
|
330
|
+
metafields?: Metafield[];
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
interface SubscriptionsResponse {
|
|
334
|
+
next_cursor: null | string;
|
|
335
|
+
previous_cursor: null | string;
|
|
336
|
+
subscriptions: Subscription[];
|
|
337
|
+
}
|
|
338
|
+
declare type SubscriptionIncludes = 'address' | 'customer' | 'metafields';
|
|
339
|
+
interface GetSubscriptionOptions {
|
|
340
|
+
include?: SubscriptionIncludes[];
|
|
341
|
+
}
|
|
342
|
+
declare type SubscriptionSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
343
|
+
interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
344
|
+
/** Return the subscriptions linked to the given address_id. */
|
|
345
|
+
address_id?: string;
|
|
346
|
+
/** Return the subscriptions linked to the given address_ids. */
|
|
347
|
+
address_ids?: string[];
|
|
348
|
+
/** Return the subscriptions created before the given date. */
|
|
349
|
+
created_at_max?: IsoDateString;
|
|
350
|
+
/** Return the subscriptions created after the given date. */
|
|
351
|
+
created_at_min?: IsoDateString;
|
|
352
|
+
/** Return the subscriptions linked to the given external_variant_id */
|
|
353
|
+
external_variant_id?: string;
|
|
354
|
+
/** Comma-separated list of subscription_ids to filter */
|
|
355
|
+
ids?: string[];
|
|
356
|
+
/** Return the subscriptions with specified status. */
|
|
357
|
+
status?: SubscriptionStatus;
|
|
358
|
+
/** Return the subscriptions updated before the given date. */
|
|
359
|
+
updated_at_max?: IsoDateString;
|
|
360
|
+
/** Return the subscriptions updated after the given date. */
|
|
361
|
+
updated_at_min?: IsoDateString;
|
|
362
|
+
/** Include related data options */
|
|
363
|
+
include?: SubscriptionIncludes[];
|
|
364
|
+
}
|
|
365
|
+
declare type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
366
|
+
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'price' | 'product_title' | 'properties' | 'status';
|
|
367
|
+
declare type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
368
|
+
declare type SubscriptionOptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'external_variant_id' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'price' | 'product_title' | 'properties' | 'quantity' | 'sku' | 'sku_override' | 'variant_title';
|
|
369
|
+
declare type SubscriptionUpdateProps = {
|
|
370
|
+
/**
|
|
371
|
+
* Flag instructing to pull the price from the product variant passed.
|
|
372
|
+
* You need to pass the variant_id under external_variant_id.ecommerce and set this attribute to true in the request for the flag to work.
|
|
373
|
+
*/
|
|
374
|
+
use_external_variant_defaults?: boolean;
|
|
375
|
+
};
|
|
376
|
+
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>> & SubscriptionUpdateProps;
|
|
377
|
+
interface UpdateSubscriptionParams {
|
|
378
|
+
/** Controls whether the QUEUED charges linked to the subscription should be regenerated upon subscription update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
379
|
+
commit?: boolean;
|
|
380
|
+
}
|
|
381
|
+
interface CancelSubscriptionRequest {
|
|
382
|
+
cancellation_reason: string;
|
|
383
|
+
cancellation_reason_comments?: string;
|
|
384
|
+
send_email?: boolean;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare type CustomerIncludes = 'addresses' | 'metafields' | 'payment_methods' | 'subscriptions';
|
|
388
|
+
interface GetCustomerOptions {
|
|
389
|
+
include?: CustomerIncludes[];
|
|
390
|
+
}
|
|
391
|
+
interface Customer {
|
|
392
|
+
/** Unique numeric identifier for the Customer. */
|
|
393
|
+
id: number;
|
|
394
|
+
/** An object containing analytics data associated with the customer. */
|
|
395
|
+
analytics_data: AnalyticsData;
|
|
396
|
+
/** The date and time when the customer was created. */
|
|
397
|
+
created_at: IsoDateString;
|
|
398
|
+
/** The email address of the customer. */
|
|
399
|
+
email: string;
|
|
400
|
+
/** An object containing external ids for the customer record. */
|
|
401
|
+
external_customer_id: ExternalId;
|
|
402
|
+
/** Date when first charge was processed for the customer. */
|
|
403
|
+
first_charge_processed_at: IsoDateString;
|
|
404
|
+
/** The customer’s first name. */
|
|
405
|
+
first_name: string;
|
|
406
|
+
/** A boolean that indicates if the customer has a payment method that is in dunning (failed charge). */
|
|
407
|
+
has_payment_method_in_dunning: boolean;
|
|
408
|
+
/** Is the payment method valid or not. */
|
|
409
|
+
has_valid_payment_method: boolean;
|
|
410
|
+
/** The unique string identifier used in a customers portal link. */
|
|
411
|
+
hash: string;
|
|
412
|
+
/** The customer’s last name. */
|
|
413
|
+
last_name: string;
|
|
414
|
+
/** The number of active subscriptions on addresses associated with the customer. */
|
|
415
|
+
subscriptions_active_count: number;
|
|
416
|
+
/** The total number of subscriptions created on addresses associated with the customer. */
|
|
417
|
+
subscriptions_total_count: number;
|
|
418
|
+
/** The date and time when the customer was last updated. */
|
|
419
|
+
updated_at: IsoDateString;
|
|
420
|
+
/** Additional information as requested */
|
|
421
|
+
include?: {
|
|
422
|
+
addresses?: Address[];
|
|
423
|
+
metafields?: Metafield[];
|
|
424
|
+
payment_methods?: PaymentMethod[];
|
|
425
|
+
subscriptions?: Subscription[];
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
declare type CustomerOptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
429
|
+
declare type UpdateCustomerRequest = Partial<Pick<Customer, CustomerOptionalUpdateProps>>;
|
|
430
|
+
interface CustomerDeliveryScheduleParams {
|
|
431
|
+
delivery_count_future?: number;
|
|
432
|
+
future_internal?: number;
|
|
433
|
+
date_max?: IsoDateString;
|
|
434
|
+
}
|
|
435
|
+
declare type DeliveryLineItem = Omit<LineItem, 'external_inventory_policy' | 'grams' | 'handle' | 'purchase_item_id' | 'purchase_item_type' | 'sku' | 'tax_due' | 'tax_lines' | 'taxable_amount' | 'taxable' | 'title' | 'total_price' | 'unit_price_includes_tax'> & {
|
|
436
|
+
/** Value is set to true if it is not a onetime or a prepaid item */
|
|
437
|
+
is_skippable: boolean;
|
|
438
|
+
/** Value is set to true if the order is skipped. */
|
|
439
|
+
is_skipped: boolean;
|
|
440
|
+
/** The type of the plan. May return null value in certain cases. */
|
|
441
|
+
plan_type: 'subscription' | 'onetime';
|
|
442
|
+
/** Value is set to true if it is a prepaid item */
|
|
443
|
+
is_prepaid: boolean;
|
|
444
|
+
/** The name of the product in a store’s catalog. */
|
|
445
|
+
product_title: string;
|
|
446
|
+
/** Unique numeric identifier for the subscription linked to this line_item in the order. */
|
|
447
|
+
subscription_id: number;
|
|
448
|
+
/** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
|
|
449
|
+
subtotal_price: string;
|
|
450
|
+
};
|
|
451
|
+
declare type DeliveryPaymentMethod = Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> & {
|
|
452
|
+
payment_details: PaymentDetails;
|
|
453
|
+
billing_address: AssociatedAddress;
|
|
454
|
+
};
|
|
455
|
+
interface DeliveryOrder {
|
|
456
|
+
id: number;
|
|
457
|
+
address_id: number;
|
|
458
|
+
charge_id: number;
|
|
459
|
+
line_items: DeliveryLineItem[];
|
|
460
|
+
payment_method: DeliveryPaymentMethod;
|
|
461
|
+
shipping_address: AssociatedAddress;
|
|
462
|
+
order_subtotal: string;
|
|
463
|
+
currency: string;
|
|
464
|
+
}
|
|
465
|
+
interface Delivery {
|
|
466
|
+
date: IsoDateString;
|
|
467
|
+
orders: DeliveryOrder[];
|
|
468
|
+
}
|
|
469
|
+
interface CustomerDeliveryScheduleResponse {
|
|
470
|
+
customer: {
|
|
471
|
+
id: number;
|
|
472
|
+
email: string;
|
|
473
|
+
first_name: string;
|
|
474
|
+
last_name: string;
|
|
475
|
+
};
|
|
476
|
+
deliveries: Delivery[];
|
|
477
|
+
}
|
|
478
|
+
interface CustomerPortalAccessResponse {
|
|
479
|
+
/** base URL for customer portal */
|
|
480
|
+
base_url: string;
|
|
481
|
+
/** customer hash */
|
|
482
|
+
customer_hash: string;
|
|
483
|
+
/** Time when token expires */
|
|
484
|
+
expires_at: IsoDateString;
|
|
485
|
+
/** Full customer portal URL with token */
|
|
486
|
+
portal_url: string;
|
|
487
|
+
/** Token for use with customer portal */
|
|
488
|
+
temp_token: string;
|
|
489
|
+
}
|
|
490
|
+
|
|
125
491
|
interface ShippingLine {
|
|
126
492
|
/** The code associated with the shipping_line of a Charge. */
|
|
127
493
|
code: string;
|
|
@@ -226,7 +592,13 @@ interface Order {
|
|
|
226
592
|
updated_at: IsoDateString;
|
|
227
593
|
/** Error information about the order if status is 'error' */
|
|
228
594
|
error: string | null;
|
|
595
|
+
/** Additional information as requested */
|
|
596
|
+
include?: {
|
|
597
|
+
customer?: Customer;
|
|
598
|
+
metafields?: Metafield[];
|
|
599
|
+
};
|
|
229
600
|
}
|
|
601
|
+
declare type OrderIncludes = 'customer' | 'metafields';
|
|
230
602
|
interface OrdersResponse {
|
|
231
603
|
next_cursor: null | string;
|
|
232
604
|
previous_cursor: null | string;
|
|
@@ -256,98 +628,14 @@ interface OrderListParams extends ListParams<OrderSortBy> {
|
|
|
256
628
|
status?: OrderStatus;
|
|
257
629
|
/** Filter orders by type. */
|
|
258
630
|
type?: OrderType;
|
|
259
|
-
/** Filter orders by subscription or onetime. */
|
|
260
|
-
purchase_item_id?: string;
|
|
261
|
-
/** Show orders updated before the given date. */
|
|
262
|
-
updated_at_max?: IsoDateString;
|
|
263
|
-
/** Show orders updated after the given date. */
|
|
264
|
-
updated_at_min?: IsoDateString;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
interface PaymentDetails {
|
|
268
|
-
/** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
|
|
269
|
-
brand?: string;
|
|
270
|
-
/** Payment_method expiry month. valid for CREDIT_CARD only. */
|
|
271
|
-
exp_month?: string;
|
|
272
|
-
/** Payment_method expiry year. valid for CREDIT_CARD only. */
|
|
273
|
-
exp_year?: string;
|
|
274
|
-
/** last 4-digits of the identifier. valid for CREDIT_CARD only. */
|
|
275
|
-
last4?: string;
|
|
276
|
-
/** email linked to paypal. valid for PAYPAL only. */
|
|
277
|
-
paypal_email?: string;
|
|
278
|
-
/** paypal user identifier. valid for PAYPAL only. */
|
|
279
|
-
paypal_payer_id?: string;
|
|
280
|
-
/** If a digital wallet. */
|
|
281
|
-
wallet_type?: string;
|
|
282
|
-
/** Type of funding for the Payment Method. */
|
|
283
|
-
funding_type?: string;
|
|
284
|
-
}
|
|
285
|
-
declare type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT' | 'IDEAL' | 'SHOP_PAY' | 'PAYPAL_EXPRESS' | 'SOFORT' | 'GIROPAY';
|
|
286
|
-
declare type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie' | 'adyen' | 'shopify_app_subscription_billing';
|
|
287
|
-
declare type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
|
|
288
|
-
interface PaymentMethod {
|
|
289
|
-
/** The unique payment method id for a customer. */
|
|
290
|
-
id: number;
|
|
291
|
-
/** An object with the customer’s address information. */
|
|
292
|
-
billing_address: AssociatedAddress;
|
|
293
|
-
/** The Recharge customer_id */
|
|
294
|
-
customer_id: number;
|
|
295
|
-
/** The time the payment method was created. */
|
|
296
|
-
created_at: IsoDateString;
|
|
297
|
-
/** If this is the default payment method for the customer */
|
|
298
|
-
default: boolean;
|
|
299
|
-
/** Details about the specific payment method */
|
|
300
|
-
payment_details: PaymentDetails;
|
|
301
|
-
/**
|
|
302
|
-
* The type of payment this is.
|
|
303
|
-
* If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
|
|
304
|
-
*/
|
|
305
|
-
payment_type: PaymentType;
|
|
306
|
-
/** The customer token at the processor. */
|
|
307
|
-
processor_customer_token: string;
|
|
308
|
-
/**
|
|
309
|
-
* This will impact validation on billing_details.
|
|
310
|
-
* Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
|
|
311
|
-
*/
|
|
312
|
-
processor_name: ProcessorName;
|
|
313
|
-
/** The payment token at the processor. */
|
|
314
|
-
processor_payment_method_token: string;
|
|
315
|
-
/** State of the Payment Method. */
|
|
316
|
-
status: PaymentMethodStatus;
|
|
317
|
-
/**
|
|
318
|
-
* The status reason for the payment method.
|
|
319
|
-
* Often used when invalid to provide background details in invalidity.
|
|
320
|
-
*/
|
|
321
|
-
status_reason: string;
|
|
322
|
-
/** The time the payment method was last updated. */
|
|
323
|
-
updated_at: IsoDateString;
|
|
324
|
-
/** Additional information as requested */
|
|
325
|
-
includes?: {
|
|
326
|
-
addresses?: Address[];
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
interface PaymentMethodsResponse {
|
|
330
|
-
next_cursor: null | string;
|
|
331
|
-
previous_cursor: null | string;
|
|
332
|
-
payment_methods: PaymentMethod[];
|
|
333
|
-
}
|
|
334
|
-
declare type PaymentMethodOptionalUpdateProps = 'billing_address' | 'default';
|
|
335
|
-
declare type UpdatePaymentMethodRequest = Partial<Pick<PaymentMethod, PaymentMethodOptionalUpdateProps>>;
|
|
336
|
-
declare type PaymentMethodIncludes = 'addresses';
|
|
337
|
-
interface GetPaymentMethodOptions {
|
|
338
|
-
include?: PaymentMethodIncludes[];
|
|
339
|
-
}
|
|
340
|
-
/** no sorting options for payment_methods, always by id-desc */
|
|
341
|
-
declare type PaymentMethodSortBy = null;
|
|
342
|
-
interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
343
|
-
/** Return the payment_methods linked to the given processor_name. */
|
|
344
|
-
processor_name?: ProcessorName;
|
|
345
|
-
/** Return the payment_methods linked to the given address_id. */
|
|
346
|
-
address_id?: string;
|
|
347
|
-
/** Return the payment_methods linked to the given processor_payment_method_token. */
|
|
348
|
-
processor_payment_method_token?: string;
|
|
631
|
+
/** Filter orders by subscription or onetime. */
|
|
632
|
+
purchase_item_id?: string;
|
|
633
|
+
/** Show orders updated before the given date. */
|
|
634
|
+
updated_at_max?: IsoDateString;
|
|
635
|
+
/** Show orders updated after the given date. */
|
|
636
|
+
updated_at_min?: IsoDateString;
|
|
349
637
|
/** Include related data options */
|
|
350
|
-
include?:
|
|
638
|
+
include?: OrderIncludes[];
|
|
351
639
|
}
|
|
352
640
|
|
|
353
641
|
declare type ChargeStatus = 'success' | 'error' | 'queued' | 'skipped' | 'refunded' | 'partially_refunded' | 'pending_manual_payment' | 'pending';
|
|
@@ -436,6 +724,8 @@ interface Charge {
|
|
|
436
724
|
updated_at: IsoDateString;
|
|
437
725
|
/** Additional information as requested */
|
|
438
726
|
include?: {
|
|
727
|
+
customer?: Customer;
|
|
728
|
+
metafields?: Metafield[];
|
|
439
729
|
payment_methods?: PaymentMethod[];
|
|
440
730
|
};
|
|
441
731
|
}
|
|
@@ -447,7 +737,7 @@ interface ChargeListResponse {
|
|
|
447
737
|
previous_cursor: null | string;
|
|
448
738
|
charges: Charge[];
|
|
449
739
|
}
|
|
450
|
-
declare type ChargeIncludes = 'payment_methods';
|
|
740
|
+
declare type ChargeIncludes = 'customer' | 'metafields' | 'payment_methods';
|
|
451
741
|
interface GetChargeOptions {
|
|
452
742
|
include?: ChargeIncludes[];
|
|
453
743
|
}
|
|
@@ -494,231 +784,6 @@ interface ChargeListParams extends ListParams<ChargeSortBy> {
|
|
|
494
784
|
include?: ChargeIncludes[];
|
|
495
785
|
}
|
|
496
786
|
|
|
497
|
-
declare type SubscriptionStatus = 'active' | 'cancelled' | 'expired';
|
|
498
|
-
interface Subscription {
|
|
499
|
-
/** Unique numeric identifier for the subscription. */
|
|
500
|
-
id: number;
|
|
501
|
-
/** Unique numeric identifier for the address the subscription is associated with. */
|
|
502
|
-
address_id: number;
|
|
503
|
-
/** Unique numeric identifier for the customer the subscription is tied to. */
|
|
504
|
-
customer_id: number;
|
|
505
|
-
/** An object used to contain analytics data such as utm parameters. */
|
|
506
|
-
analytics_data: AnalyticsData;
|
|
507
|
-
/** Reason provided for cancellation. */
|
|
508
|
-
cancellation_reason: string | null;
|
|
509
|
-
/** Additional comment for cancellation. */
|
|
510
|
-
cancellation_reason_comments: string | null;
|
|
511
|
-
/** The time the subscription was cancelled. */
|
|
512
|
-
cancelled_at: string | null;
|
|
513
|
-
/**
|
|
514
|
-
* The number of units (specified in order_interval_unit) between each Charge. For example, order_interval_unit=month and charge_interval_frequency=3, indicate charge every 3 months.
|
|
515
|
-
* Charges must use the same unit types as orders.
|
|
516
|
-
* Max: 1000
|
|
517
|
-
*/
|
|
518
|
-
charge_interval_frequency: number;
|
|
519
|
-
/** The time the subscription was created. */
|
|
520
|
-
created_at: IsoDateString;
|
|
521
|
-
/** Set the number of charges until subscription expires. */
|
|
522
|
-
expire_after_specific_number_of_charges: number | null;
|
|
523
|
-
/** An object containing the product id as it appears in external platforms. */
|
|
524
|
-
external_product_id: ExternalId;
|
|
525
|
-
/** An object containing the variant id as it appears in external platforms. */
|
|
526
|
-
external_variant_id: ExternalId;
|
|
527
|
-
/** Retrieves true if there is queued charge. Otherwise, retrieves false. */
|
|
528
|
-
has_queued_charges: boolean;
|
|
529
|
-
/** Value is set to true if it is a prepaid item. */
|
|
530
|
-
is_prepaid: boolean;
|
|
531
|
-
/** Value is set to true if it is not a prepaid item */
|
|
532
|
-
is_skippable: boolean;
|
|
533
|
-
/** Value is set to true if it is not a prepaid item and if in Customer portal settings swap is allowed for customers. */
|
|
534
|
-
is_swappable: boolean;
|
|
535
|
-
/** Retrieves true if charge has an error max retries reached. Otherwise, retrieves false. */
|
|
536
|
-
max_retries_reached: boolean;
|
|
537
|
-
/** Date of the next charge for the subscription. */
|
|
538
|
-
next_charge_scheduled_at: IsoDateString;
|
|
539
|
-
/**
|
|
540
|
-
* The set day of the month order is created. Default is that there isn’t a strict day of the month when the order is created.
|
|
541
|
-
* This is only applicable to subscriptions with order_interval_unit:“month”.
|
|
542
|
-
*/
|
|
543
|
-
order_day_of_month: number | null;
|
|
544
|
-
/**
|
|
545
|
-
* The set day of the week order is created. Default is that there isn’t a strict day of the week order is created.
|
|
546
|
-
* This is only applicable to subscriptions with order_interval_unit = “week”.
|
|
547
|
-
* Value of 0 equals to Monday, 1 to Tuesday etc.
|
|
548
|
-
*/
|
|
549
|
-
order_day_of_week: number | null;
|
|
550
|
-
/**
|
|
551
|
-
* The number of units (specified in order_interval_unit) between each order. For example, order_interval_unit=month and order_interval_frequency=3, indicate order every 3 months. Max value: 1000
|
|
552
|
-
*/
|
|
553
|
-
order_interval_frequency: number;
|
|
554
|
-
/** The frequency unit used to determine when a subscription’s order is created. */
|
|
555
|
-
order_interval_unit: IntervalUnit;
|
|
556
|
-
/** The presentment currency of the subscription. */
|
|
557
|
-
presentment_currency: string | null;
|
|
558
|
-
/** The price of the item before discounts, taxes, or shipping have been applied. */
|
|
559
|
-
price: string;
|
|
560
|
-
/** The name of the product in a store’s catalog. */
|
|
561
|
-
product_title: string;
|
|
562
|
-
/** A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself. */
|
|
563
|
-
properties: Property[];
|
|
564
|
-
/** The number of items in the subscription. */
|
|
565
|
-
quantity: number;
|
|
566
|
-
/** A unique identifier of the item in the fulfillment. In cases where SKU is blank, it will be dynamically pulled whenever it is used. */
|
|
567
|
-
sku: string | null;
|
|
568
|
-
/** Flag that is automatically updated to true when SKU is passed on create or update. When sku_override is true, the SKU on the subscription will be used to generate charges and orders. When sku_override is false, Recharge will dynamically fetch the SKU from the corresponding external platform variant. */
|
|
569
|
-
sku_override: boolean;
|
|
570
|
-
/**
|
|
571
|
-
* The status of the subscription.
|
|
572
|
-
* expired - This status occurs when the maximum number of charges for a product has been reached.
|
|
573
|
-
*/
|
|
574
|
-
status: SubscriptionStatus;
|
|
575
|
-
/** The date time at which the purchase_item record was last updated. */
|
|
576
|
-
updated_at: IsoDateString;
|
|
577
|
-
/** The name of the variant in a shop’s catalog. */
|
|
578
|
-
variant_title: string;
|
|
579
|
-
/** Additional information as requested */
|
|
580
|
-
includes?: {
|
|
581
|
-
address?: Address;
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
interface SubscriptionsResponse {
|
|
585
|
-
next_cursor: null | string;
|
|
586
|
-
previous_cursor: null | string;
|
|
587
|
-
subscriptions: Subscription[];
|
|
588
|
-
}
|
|
589
|
-
declare type SubscriptionIncludes = 'address';
|
|
590
|
-
interface GetSubscriptionOptions {
|
|
591
|
-
include?: SubscriptionIncludes[];
|
|
592
|
-
}
|
|
593
|
-
declare type SubscriptionSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
594
|
-
interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
595
|
-
/** Return the subscriptions linked to the given address_id. */
|
|
596
|
-
address_id?: string;
|
|
597
|
-
/** Return the subscriptions linked to the given address_ids. */
|
|
598
|
-
address_ids?: string[];
|
|
599
|
-
/** Return the subscriptions created before the given date. */
|
|
600
|
-
created_at_max?: IsoDateString;
|
|
601
|
-
/** Return the subscriptions created after the given date. */
|
|
602
|
-
created_at_min?: IsoDateString;
|
|
603
|
-
/** Return the subscriptions linked to the given external_variant_id */
|
|
604
|
-
external_variant_id?: string;
|
|
605
|
-
/** Comma-separated list of subscription_ids to filter */
|
|
606
|
-
ids?: string[];
|
|
607
|
-
/** Return the subscriptions with specified status. */
|
|
608
|
-
status?: SubscriptionStatus;
|
|
609
|
-
/** Return the subscriptions updated before the given date. */
|
|
610
|
-
updated_at_max?: IsoDateString;
|
|
611
|
-
/** Return the subscriptions updated after the given date. */
|
|
612
|
-
updated_at_min?: IsoDateString;
|
|
613
|
-
/** Include related data options */
|
|
614
|
-
include?: SubscriptionIncludes[];
|
|
615
|
-
}
|
|
616
|
-
declare type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
617
|
-
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'price' | 'product_title' | 'properties' | 'status';
|
|
618
|
-
declare type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
619
|
-
declare type SubscriptionOptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity' | 'external_product_id' | 'external_variant_id' | 'properties' | 'sku' | 'sku_override';
|
|
620
|
-
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
621
|
-
interface UpdateSubscriptionParams {
|
|
622
|
-
/** Controls whether the QUEUED charges linked to the subscription should be regenerated upon subscription update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
623
|
-
commit?: boolean;
|
|
624
|
-
}
|
|
625
|
-
interface CancelSubscriptionRequest {
|
|
626
|
-
cancellation_reason: string;
|
|
627
|
-
cancellation_reason_comments?: string;
|
|
628
|
-
send_email?: boolean;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
declare type CustomerIncludes = 'addresses' | 'payment_methods' | 'subscriptions';
|
|
632
|
-
interface GetCustomerOptions {
|
|
633
|
-
include?: CustomerIncludes[];
|
|
634
|
-
}
|
|
635
|
-
interface Customer {
|
|
636
|
-
/** Unique numeric identifier for the Customer. */
|
|
637
|
-
id: number;
|
|
638
|
-
/** An object containing analytics data associated with the customer. */
|
|
639
|
-
analytics_data: AnalyticsData;
|
|
640
|
-
/** The date and time when the customer was created. */
|
|
641
|
-
created_at: IsoDateString;
|
|
642
|
-
/** The email address of the customer. */
|
|
643
|
-
email: string;
|
|
644
|
-
/** An object containing external ids for the customer record. */
|
|
645
|
-
external_customer_id: ExternalId;
|
|
646
|
-
/** Date when first charge was processed for the customer. */
|
|
647
|
-
first_charge_processed_at: IsoDateString;
|
|
648
|
-
/** The customer’s first name. */
|
|
649
|
-
first_name: string;
|
|
650
|
-
/** A boolean that indicates if the customer has a payment method that is in dunning (failed charge). */
|
|
651
|
-
has_payment_method_in_dunning: boolean;
|
|
652
|
-
/** Is the payment method valid or not. */
|
|
653
|
-
has_valid_payment_method: boolean;
|
|
654
|
-
/** The unique string identifier used in a customers portal link. */
|
|
655
|
-
hash: string;
|
|
656
|
-
/** The customer’s last name. */
|
|
657
|
-
last_name: string;
|
|
658
|
-
/** The number of active subscriptions on addresses associated with the customer. */
|
|
659
|
-
subscriptions_active_count: number;
|
|
660
|
-
/** The total number of subscriptions created on addresses associated with the customer. */
|
|
661
|
-
subscriptions_total_count: number;
|
|
662
|
-
/** The date and time when the customer was last updated. */
|
|
663
|
-
updated_at: IsoDateString;
|
|
664
|
-
/** Additional information as requested */
|
|
665
|
-
include?: {
|
|
666
|
-
addresses?: Address[];
|
|
667
|
-
payment_methods?: PaymentMethod[];
|
|
668
|
-
subscriptions?: Subscription[];
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
declare type CustomerOptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
672
|
-
declare type UpdateCustomerRequest = Partial<Pick<Customer, CustomerOptionalUpdateProps>>;
|
|
673
|
-
interface CustomerDeliveryScheduleParams {
|
|
674
|
-
delivery_count_future?: number;
|
|
675
|
-
future_internal?: number;
|
|
676
|
-
date_max?: IsoDateString;
|
|
677
|
-
}
|
|
678
|
-
declare type DeliveryLineItem = Omit<LineItem, 'external_inventory_policy' | 'grams' | 'handle' | 'purchase_item_id' | 'purchase_item_type' | 'sku' | 'tax_due' | 'tax_lines' | 'taxable_amount' | 'taxable' | 'title' | 'total_price' | 'unit_price_includes_tax'> & {
|
|
679
|
-
/** Value is set to true if it is not a onetime or a prepaid item */
|
|
680
|
-
is_skippable: boolean;
|
|
681
|
-
/** Value is set to true if the order is skipped. */
|
|
682
|
-
is_skipped: boolean;
|
|
683
|
-
/** The type of the plan. May return null value in certain cases. */
|
|
684
|
-
plan_type: 'subscription' | 'onetime';
|
|
685
|
-
/** Value is set to true if it is a prepaid item */
|
|
686
|
-
is_prepaid: boolean;
|
|
687
|
-
/** The name of the product in a store’s catalog. */
|
|
688
|
-
product_title: string;
|
|
689
|
-
/** Unique numeric identifier for the subscription linked to this line_item in the order. */
|
|
690
|
-
subscription_id: number;
|
|
691
|
-
/** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
|
|
692
|
-
subtotal_price: string;
|
|
693
|
-
};
|
|
694
|
-
declare type DeliveryPaymentMethod = Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> & {
|
|
695
|
-
payment_details: PaymentDetails;
|
|
696
|
-
billing_address: AssociatedAddress;
|
|
697
|
-
};
|
|
698
|
-
interface DeliveryOrder {
|
|
699
|
-
id: number;
|
|
700
|
-
address_id: number;
|
|
701
|
-
charge_id: number;
|
|
702
|
-
line_items: DeliveryLineItem[];
|
|
703
|
-
payment_method: DeliveryPaymentMethod;
|
|
704
|
-
shipping_address: AssociatedAddress;
|
|
705
|
-
order_subtotal: string;
|
|
706
|
-
currency: string;
|
|
707
|
-
}
|
|
708
|
-
interface Delivery {
|
|
709
|
-
date: IsoDateString;
|
|
710
|
-
orders: DeliveryOrder[];
|
|
711
|
-
}
|
|
712
|
-
interface CustomerDeliveryScheduleResponse {
|
|
713
|
-
customer: {
|
|
714
|
-
id: number;
|
|
715
|
-
email: string;
|
|
716
|
-
first_name: string;
|
|
717
|
-
last_name: string;
|
|
718
|
-
};
|
|
719
|
-
deliveries: Delivery[];
|
|
720
|
-
}
|
|
721
|
-
|
|
722
787
|
interface CreateAddressRequest {
|
|
723
788
|
/** Unique numeric identifier for the customer associated with the address. */
|
|
724
789
|
customer_id: number;
|
|
@@ -965,7 +1030,7 @@ interface PasswordlessValidateResponse {
|
|
|
965
1030
|
errors?: string;
|
|
966
1031
|
}
|
|
967
1032
|
|
|
968
|
-
interface
|
|
1033
|
+
interface BundleSelectionAppProxy {
|
|
969
1034
|
collectionId: string;
|
|
970
1035
|
externalProductId: string;
|
|
971
1036
|
externalVariantId: string;
|
|
@@ -975,12 +1040,12 @@ interface BundleSelection {
|
|
|
975
1040
|
shippingIntervalUnitType?: IntervalUnit;
|
|
976
1041
|
discountedVariantId?: number;
|
|
977
1042
|
}
|
|
978
|
-
interface
|
|
1043
|
+
interface BundleAppProxy {
|
|
979
1044
|
externalVariantId: string;
|
|
980
1045
|
externalProductId: string;
|
|
981
|
-
selections:
|
|
1046
|
+
selections: BundleSelectionAppProxy[];
|
|
982
1047
|
}
|
|
983
|
-
interface
|
|
1048
|
+
interface DynamicBundlePropertiesAppProxy {
|
|
984
1049
|
_rc_bundle: string;
|
|
985
1050
|
_rc_bundle_variant: string;
|
|
986
1051
|
_rc_bundle_parent: string;
|
|
@@ -988,12 +1053,65 @@ interface BundleProperties {
|
|
|
988
1053
|
shipping_interval_frequency?: number;
|
|
989
1054
|
shipping_interval_unit_type?: IntervalUnit;
|
|
990
1055
|
}
|
|
991
|
-
interface
|
|
1056
|
+
interface DynamicBundleItemAppProxy {
|
|
992
1057
|
id: string;
|
|
993
|
-
properties:
|
|
1058
|
+
properties: DynamicBundlePropertiesAppProxy;
|
|
994
1059
|
quantity: number;
|
|
995
1060
|
selling_plan?: number;
|
|
996
1061
|
}
|
|
1062
|
+
interface BundleSelectionItem {
|
|
1063
|
+
/** The unique numeric identifier for the item selection. */
|
|
1064
|
+
id: number;
|
|
1065
|
+
/** The collection id as it appears in the external e-commerce platform. */
|
|
1066
|
+
collection_id: string;
|
|
1067
|
+
/** The identifier of the external e-commerce platform. */
|
|
1068
|
+
collection_source: 'shopify';
|
|
1069
|
+
/** The date and time when this item was selected. */
|
|
1070
|
+
created_at: IsoDateString;
|
|
1071
|
+
/** The product id as it appears in the external e-commerce platform. This is the item which is going to be extracted when the Bundle is processed. */
|
|
1072
|
+
external_product_id: string;
|
|
1073
|
+
/** The variant id as it appears in the external e-commerce platform. This is the item which is going to be extracted when the Bundle is processed. */
|
|
1074
|
+
external_variant_id: string;
|
|
1075
|
+
/** The quantity of this product. */
|
|
1076
|
+
quantity: number;
|
|
1077
|
+
/** The date and time at which the item selection was most recently updated. */
|
|
1078
|
+
updated_at: IsoDateString;
|
|
1079
|
+
}
|
|
1080
|
+
interface BundleSelection {
|
|
1081
|
+
/** The unique numeric identifier for the BundleSelection. */
|
|
1082
|
+
id: number;
|
|
1083
|
+
/** The ID of the BundleVariant associated with the BundleSelection. */
|
|
1084
|
+
bundle_variant_id: number;
|
|
1085
|
+
/** The ID of the PurchaseItem associated with the BundleSelection. */
|
|
1086
|
+
purchase_item_id: number;
|
|
1087
|
+
/** The date and time when the contents were selected. */
|
|
1088
|
+
created_at: IsoDateString;
|
|
1089
|
+
/** The product id as it appears in the external e-commerce platform. The external_product_id of the Product record in Recharge, linking the BundleSelection to a Product associated with a Bundle. */
|
|
1090
|
+
external_product_id: string;
|
|
1091
|
+
/** The variant id as it appears in the external e-commerce platform. The external_variant_id of the Product record in Recharge, linking the BundleSelection to a Product associated with a Bundle. */
|
|
1092
|
+
external_variant_id: string;
|
|
1093
|
+
items: BundleSelectionItem[];
|
|
1094
|
+
/** The date and time at which the BundleSelection was most recently updated. */
|
|
1095
|
+
updated_at: IsoDateString;
|
|
1096
|
+
}
|
|
1097
|
+
declare type BundleSelectionItemRequiredCreateProps = 'collection_id' | 'collection_source' | 'external_product_id' | 'external_variant_id' | 'quantity';
|
|
1098
|
+
declare type CreateBundleSelectionRequest = {
|
|
1099
|
+
purchase_item_id: number;
|
|
1100
|
+
items: Pick<BundleSelectionItem, BundleSelectionItemRequiredCreateProps>[];
|
|
1101
|
+
};
|
|
1102
|
+
declare type UpdateBundleSelectionRequest = CreateBundleSelectionRequest;
|
|
1103
|
+
interface BundleSelectionsResponse {
|
|
1104
|
+
next_cursor: null | string;
|
|
1105
|
+
previous_cursor: null | string;
|
|
1106
|
+
bundle_selections: BundleSelection[];
|
|
1107
|
+
}
|
|
1108
|
+
declare type BundleSelectionsSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1109
|
+
interface BundleSelectionListParams extends ListParams<BundleSelectionsSortBy> {
|
|
1110
|
+
/** Filter BundleSelections by Subscription or Onetime ID. */
|
|
1111
|
+
purchase_item_ids?: string[];
|
|
1112
|
+
/** Filter BundleSelections by BundleVariants. */
|
|
1113
|
+
bundle_variant_ids?: string[];
|
|
1114
|
+
}
|
|
997
1115
|
|
|
998
1116
|
declare type FirstOption = 'onetime' | 'autodeliver';
|
|
999
1117
|
declare type PriceAdjustmentsType = 'percentage';
|
|
@@ -1592,16 +1710,21 @@ declare function getCDNProductAndSettings(externalProductId: string | number): P
|
|
|
1592
1710
|
declare function getCDNBundleSettings(externalProductId: string | number): Promise<CDNBundleSettings | null | undefined>;
|
|
1593
1711
|
declare function resetCDNCache(): Promise<void>;
|
|
1594
1712
|
|
|
1595
|
-
declare function getBundleId(bundle:
|
|
1596
|
-
declare function getDynamicBundleItems(bundle:
|
|
1597
|
-
declare function validateBundle(bundle:
|
|
1713
|
+
declare function getBundleId(bundle: BundleAppProxy): Promise<string>;
|
|
1714
|
+
declare function getDynamicBundleItems(bundle: BundleAppProxy, shopifyProductHandle: string): DynamicBundleItemAppProxy[];
|
|
1715
|
+
declare function validateBundle(bundle: BundleAppProxy): Promise<true | string>;
|
|
1598
1716
|
/**
|
|
1599
1717
|
* Validates a dynamic bundle
|
|
1600
1718
|
*
|
|
1601
1719
|
* @param bundle Dynamic Bundle being validated
|
|
1602
1720
|
* @returns true or error message
|
|
1603
1721
|
*/
|
|
1604
|
-
declare function validateDynamicBundle(bundle:
|
|
1722
|
+
declare function validateDynamicBundle(bundle: BundleAppProxy): true | string;
|
|
1723
|
+
declare function getBundleSelection(session: Session, id: string | number): Promise<BundleSelection>;
|
|
1724
|
+
declare function listBundleSelections(session: Session, query?: BundleSelectionListParams): Promise<BundleSelectionsResponse>;
|
|
1725
|
+
declare function createBundleSelection(session: Session, createRequest: CreateBundleSelectionRequest): Promise<BundleSelection>;
|
|
1726
|
+
declare function updateBundleSelection(session: Session, id: string | number, updateRequest: UpdateBundleSelectionRequest): Promise<BundleSelection>;
|
|
1727
|
+
declare function deleteBundleSelection(session: Session, id: string | number): Promise<void>;
|
|
1605
1728
|
|
|
1606
1729
|
/** @internal Retrieves membership information for passed in id */
|
|
1607
1730
|
declare function getMembership(session: Session, id: string | number): Promise<Membership>;
|
|
@@ -1612,6 +1735,10 @@ declare function cancelMembership(session: Session, id: string | number, cancelR
|
|
|
1612
1735
|
/** @internal Activates a membership */
|
|
1613
1736
|
declare function activateMembership(session: Session, id: string | number, activateRequest: ActivateMembershipRequest): Promise<Membership>;
|
|
1614
1737
|
|
|
1738
|
+
declare function createMetafield(session: Session, createRequest: CreateMetafieldRequest): Promise<Metafield>;
|
|
1739
|
+
declare function updateMetafield(session: Session, id: string | number, updateRequest: UpdateMetafieldRequest): Promise<Metafield>;
|
|
1740
|
+
declare function deleteMetafield(session: Session, id: string | number): Promise<void>;
|
|
1741
|
+
|
|
1615
1742
|
declare function getOnetime(session: Session, id: string | number): Promise<Onetime>;
|
|
1616
1743
|
declare function listOnetimes(session: Session, query?: OnetimeListParams): Promise<OnetimesResponse>;
|
|
1617
1744
|
declare function createOnetime(session: Session, createRequest: CreateOnetimeRequest): Promise<Onetime>;
|
|
@@ -1622,6 +1749,11 @@ declare function getOrder(session: Session, id: string | number): Promise<Order>
|
|
|
1622
1749
|
declare function listOrders(session: Session, query?: OrderListParams): Promise<OrdersResponse>;
|
|
1623
1750
|
|
|
1624
1751
|
declare function getPaymentMethod(session: Session, id: string | number, options?: GetPaymentMethodOptions): Promise<PaymentMethod>;
|
|
1752
|
+
/**
|
|
1753
|
+
* Modify an existing Payment Method
|
|
1754
|
+
*
|
|
1755
|
+
* Currently, `shopify_payments` is in read-only mode and can only be managed by Shopify.
|
|
1756
|
+
*/
|
|
1625
1757
|
declare function updatePaymentMethod(session: Session, id: string | number, updateRequest: UpdatePaymentMethodRequest): Promise<PaymentMethod>;
|
|
1626
1758
|
declare function listPaymentMethods(session: Session, query?: PaymentMethodListParams): Promise<PaymentMethodsResponse>;
|
|
1627
1759
|
|
|
@@ -1666,6 +1798,7 @@ declare function skipSubscriptionCharge(session: Session, id: number | string, d
|
|
|
1666
1798
|
declare function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer>;
|
|
1667
1799
|
declare function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer>;
|
|
1668
1800
|
declare function getDeliverySchedule(session: Session, query?: CustomerDeliveryScheduleParams): Promise<Delivery[]>;
|
|
1801
|
+
declare function getCustomerPortalAccess(session: Session): Promise<CustomerPortalAccessResponse>;
|
|
1669
1802
|
|
|
1670
1803
|
declare const api: {
|
|
1671
1804
|
get<T>(url: string, requestOptions?: GetRequestOptions): Promise<T>;
|
|
@@ -1675,4 +1808,4 @@ declare const api: {
|
|
|
1675
1808
|
};
|
|
1676
1809
|
declare function initRecharge(opt?: InitOptions): void;
|
|
1677
1810
|
|
|
1678
|
-
export { ActivateMembershipRequest, Address, AddressIncludes, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, AssociatedAddress,
|
|
1811
|
+
export { ActivateMembershipRequest, Address, AddressIncludes, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, AssociatedAddress, BundleAppProxy, BundleSelection, BundleSelectionAppProxy, BundleSelectionItem, BundleSelectionItemRequiredCreateProps, BundleSelectionListParams, BundleSelectionsResponse, BundleSelectionsSortBy, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, ChannelSettings, Charge, ChargeIncludes, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, ColorString, CreateAddressRequest, CreateBundleSelectionRequest, CreateMetafieldRequest, CreateOnetimeRequest, CreateSubscriptionRequest, Customer, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, CustomerIncludes, CustomerOptionalUpdateProps, CustomerPortalAccessResponse, Delivery, DeliveryLineItem, DeliveryOrder, DeliveryPaymentMethod, Discount, DynamicBundleItemAppProxy, DynamicBundlePropertiesAppProxy, ExternalId, ExternalTransactionId, FirstOption, GetAddressOptions, GetChargeOptions, GetCustomerOptions, GetPaymentMethodOptions, GetRequestOptions, GetSubscriptionOptions, HTMLString, InitOptions, IntervalUnit, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipIncludes, MembershipListParams, MembershipListResponse, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Metafield, MetafieldCreateProps, MetafieldOptionalCreateProps, MetafieldOptionalUpdateProps, MetafieldOwnerResource, MetafieldRequiredCreateProps, Method, Onetime, OnetimeCreateProps, OnetimeListParams, OnetimeOptionalCreateProps, OnetimeOptionalUpdateProps, OnetimeRequiredCreateProps, OnetimesResponse, OnetimesSortBy, Order, OrderIncludes, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, PasswordlessCodeResponse, PasswordlessValidateResponse, PaymentDetails, PaymentMethod, PaymentMethodIncludes, PaymentMethodListParams, PaymentMethodOptionalUpdateProps, PaymentMethodSortBy, PaymentMethodStatus, PaymentMethodsResponse, PaymentType, Plan, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceAdjustmentsType, ProcessorName, ProductImage, Property, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, Session, ShippingLine, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionIncludes, SubscriptionListParams, SubscriptionOptionalCreateProps, SubscriptionOptionalUpdateProps, SubscriptionPreferences, SubscriptionRequiredCreateProps, SubscriptionSortBy, SubscriptionStatus, SubscriptionsResponse, TaxLine, Translations, UpdateAddressRequest, UpdateBundleSelectionRequest, UpdateCustomerRequest, UpdateMetafieldRequest, UpdateOnetimeRequest, UpdatePaymentMethodRequest, UpdateSubscriptionParams, UpdateSubscriptionRequest, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, createAddress, createBundleSelection, createMetafield, createOnetime, createSubscription, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, getAddress, getBundleId, getBundleSelection, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getMembership, getOnetime, getOrder, getPaymentMethod, getPlan, getSubscription, initRecharge, listAddresses, listBundleSelections, listCharges, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, membershipIncludes, mergeAddresses, processCharge, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendPasswordlessCode, sendPasswordlessCodeAppProxy, skipCharge, skipFutureCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
|