@rechargeapps/storefront-client 0.23.0 → 0.25.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 +32 -0
- package/dist/cjs/api/bundle.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 +9 -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 +29 -2
- package/dist/esm/api/bundle.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 +2 -1
- 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 +440 -327
- 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,353 @@ 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' | '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';
|
|
369
|
+
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
370
|
+
interface UpdateSubscriptionParams {
|
|
371
|
+
/** 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. */
|
|
372
|
+
commit?: boolean;
|
|
373
|
+
}
|
|
374
|
+
interface CancelSubscriptionRequest {
|
|
375
|
+
cancellation_reason: string;
|
|
376
|
+
cancellation_reason_comments?: string;
|
|
377
|
+
send_email?: boolean;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
declare type CustomerIncludes = 'addresses' | 'metafields' | 'payment_methods' | 'subscriptions';
|
|
381
|
+
interface GetCustomerOptions {
|
|
382
|
+
include?: CustomerIncludes[];
|
|
383
|
+
}
|
|
384
|
+
interface Customer {
|
|
385
|
+
/** Unique numeric identifier for the Customer. */
|
|
386
|
+
id: number;
|
|
387
|
+
/** An object containing analytics data associated with the customer. */
|
|
388
|
+
analytics_data: AnalyticsData;
|
|
389
|
+
/** The date and time when the customer was created. */
|
|
390
|
+
created_at: IsoDateString;
|
|
391
|
+
/** The email address of the customer. */
|
|
392
|
+
email: string;
|
|
393
|
+
/** An object containing external ids for the customer record. */
|
|
394
|
+
external_customer_id: ExternalId;
|
|
395
|
+
/** Date when first charge was processed for the customer. */
|
|
396
|
+
first_charge_processed_at: IsoDateString;
|
|
397
|
+
/** The customer’s first name. */
|
|
398
|
+
first_name: string;
|
|
399
|
+
/** A boolean that indicates if the customer has a payment method that is in dunning (failed charge). */
|
|
400
|
+
has_payment_method_in_dunning: boolean;
|
|
401
|
+
/** Is the payment method valid or not. */
|
|
402
|
+
has_valid_payment_method: boolean;
|
|
403
|
+
/** The unique string identifier used in a customers portal link. */
|
|
404
|
+
hash: string;
|
|
405
|
+
/** The customer’s last name. */
|
|
406
|
+
last_name: string;
|
|
407
|
+
/** The number of active subscriptions on addresses associated with the customer. */
|
|
408
|
+
subscriptions_active_count: number;
|
|
409
|
+
/** The total number of subscriptions created on addresses associated with the customer. */
|
|
410
|
+
subscriptions_total_count: number;
|
|
411
|
+
/** The date and time when the customer was last updated. */
|
|
412
|
+
updated_at: IsoDateString;
|
|
413
|
+
/** Additional information as requested */
|
|
414
|
+
include?: {
|
|
415
|
+
addresses?: Address[];
|
|
416
|
+
metafields?: Metafield[];
|
|
417
|
+
payment_methods?: PaymentMethod[];
|
|
418
|
+
subscriptions?: Subscription[];
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
declare type CustomerOptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
422
|
+
declare type UpdateCustomerRequest = Partial<Pick<Customer, CustomerOptionalUpdateProps>>;
|
|
423
|
+
interface CustomerDeliveryScheduleParams {
|
|
424
|
+
delivery_count_future?: number;
|
|
425
|
+
future_internal?: number;
|
|
426
|
+
date_max?: IsoDateString;
|
|
427
|
+
}
|
|
428
|
+
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'> & {
|
|
429
|
+
/** Value is set to true if it is not a onetime or a prepaid item */
|
|
430
|
+
is_skippable: boolean;
|
|
431
|
+
/** Value is set to true if the order is skipped. */
|
|
432
|
+
is_skipped: boolean;
|
|
433
|
+
/** The type of the plan. May return null value in certain cases. */
|
|
434
|
+
plan_type: 'subscription' | 'onetime';
|
|
435
|
+
/** Value is set to true if it is a prepaid item */
|
|
436
|
+
is_prepaid: boolean;
|
|
437
|
+
/** The name of the product in a store’s catalog. */
|
|
438
|
+
product_title: string;
|
|
439
|
+
/** Unique numeric identifier for the subscription linked to this line_item in the order. */
|
|
440
|
+
subscription_id: number;
|
|
441
|
+
/** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
|
|
442
|
+
subtotal_price: string;
|
|
443
|
+
};
|
|
444
|
+
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'> & {
|
|
445
|
+
payment_details: PaymentDetails;
|
|
446
|
+
billing_address: AssociatedAddress;
|
|
447
|
+
};
|
|
448
|
+
interface DeliveryOrder {
|
|
449
|
+
id: number;
|
|
450
|
+
address_id: number;
|
|
451
|
+
charge_id: number;
|
|
452
|
+
line_items: DeliveryLineItem[];
|
|
453
|
+
payment_method: DeliveryPaymentMethod;
|
|
454
|
+
shipping_address: AssociatedAddress;
|
|
455
|
+
order_subtotal: string;
|
|
456
|
+
currency: string;
|
|
457
|
+
}
|
|
458
|
+
interface Delivery {
|
|
459
|
+
date: IsoDateString;
|
|
460
|
+
orders: DeliveryOrder[];
|
|
461
|
+
}
|
|
462
|
+
interface CustomerDeliveryScheduleResponse {
|
|
463
|
+
customer: {
|
|
464
|
+
id: number;
|
|
465
|
+
email: string;
|
|
466
|
+
first_name: string;
|
|
467
|
+
last_name: string;
|
|
468
|
+
};
|
|
469
|
+
deliveries: Delivery[];
|
|
470
|
+
}
|
|
471
|
+
|
|
125
472
|
interface ShippingLine {
|
|
126
473
|
/** The code associated with the shipping_line of a Charge. */
|
|
127
474
|
code: string;
|
|
@@ -226,7 +573,13 @@ interface Order {
|
|
|
226
573
|
updated_at: IsoDateString;
|
|
227
574
|
/** Error information about the order if status is 'error' */
|
|
228
575
|
error: string | null;
|
|
576
|
+
/** Additional information as requested */
|
|
577
|
+
include?: {
|
|
578
|
+
customer?: Customer;
|
|
579
|
+
metafields?: Metafield[];
|
|
580
|
+
};
|
|
229
581
|
}
|
|
582
|
+
declare type OrderIncludes = 'customer' | 'metafields';
|
|
230
583
|
interface OrdersResponse {
|
|
231
584
|
next_cursor: null | string;
|
|
232
585
|
previous_cursor: null | string;
|
|
@@ -258,96 +611,12 @@ interface OrderListParams extends ListParams<OrderSortBy> {
|
|
|
258
611
|
type?: OrderType;
|
|
259
612
|
/** Filter orders by subscription or onetime. */
|
|
260
613
|
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;
|
|
614
|
+
/** Show orders updated before the given date. */
|
|
615
|
+
updated_at_max?: IsoDateString;
|
|
616
|
+
/** Show orders updated after the given date. */
|
|
617
|
+
updated_at_min?: IsoDateString;
|
|
349
618
|
/** Include related data options */
|
|
350
|
-
include?:
|
|
619
|
+
include?: OrderIncludes[];
|
|
351
620
|
}
|
|
352
621
|
|
|
353
622
|
declare type ChargeStatus = 'success' | 'error' | 'queued' | 'skipped' | 'refunded' | 'partially_refunded' | 'pending_manual_payment' | 'pending';
|
|
@@ -436,6 +705,8 @@ interface Charge {
|
|
|
436
705
|
updated_at: IsoDateString;
|
|
437
706
|
/** Additional information as requested */
|
|
438
707
|
include?: {
|
|
708
|
+
customer?: Customer;
|
|
709
|
+
metafields?: Metafield[];
|
|
439
710
|
payment_methods?: PaymentMethod[];
|
|
440
711
|
};
|
|
441
712
|
}
|
|
@@ -447,7 +718,7 @@ interface ChargeListResponse {
|
|
|
447
718
|
previous_cursor: null | string;
|
|
448
719
|
charges: Charge[];
|
|
449
720
|
}
|
|
450
|
-
declare type ChargeIncludes = 'payment_methods';
|
|
721
|
+
declare type ChargeIncludes = 'customer' | 'metafields' | 'payment_methods';
|
|
451
722
|
interface GetChargeOptions {
|
|
452
723
|
include?: ChargeIncludes[];
|
|
453
724
|
}
|
|
@@ -494,231 +765,6 @@ interface ChargeListParams extends ListParams<ChargeSortBy> {
|
|
|
494
765
|
include?: ChargeIncludes[];
|
|
495
766
|
}
|
|
496
767
|
|
|
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
768
|
interface CreateAddressRequest {
|
|
723
769
|
/** Unique numeric identifier for the customer associated with the address. */
|
|
724
770
|
customer_id: number;
|
|
@@ -965,7 +1011,7 @@ interface PasswordlessValidateResponse {
|
|
|
965
1011
|
errors?: string;
|
|
966
1012
|
}
|
|
967
1013
|
|
|
968
|
-
interface
|
|
1014
|
+
interface BundleSelectionAppProxy {
|
|
969
1015
|
collectionId: string;
|
|
970
1016
|
externalProductId: string;
|
|
971
1017
|
externalVariantId: string;
|
|
@@ -975,12 +1021,12 @@ interface BundleSelection {
|
|
|
975
1021
|
shippingIntervalUnitType?: IntervalUnit;
|
|
976
1022
|
discountedVariantId?: number;
|
|
977
1023
|
}
|
|
978
|
-
interface
|
|
1024
|
+
interface BundleAppProxy {
|
|
979
1025
|
externalVariantId: string;
|
|
980
1026
|
externalProductId: string;
|
|
981
|
-
selections:
|
|
1027
|
+
selections: BundleSelectionAppProxy[];
|
|
982
1028
|
}
|
|
983
|
-
interface
|
|
1029
|
+
interface DynamicBundlePropertiesAppProxy {
|
|
984
1030
|
_rc_bundle: string;
|
|
985
1031
|
_rc_bundle_variant: string;
|
|
986
1032
|
_rc_bundle_parent: string;
|
|
@@ -988,12 +1034,65 @@ interface BundleProperties {
|
|
|
988
1034
|
shipping_interval_frequency?: number;
|
|
989
1035
|
shipping_interval_unit_type?: IntervalUnit;
|
|
990
1036
|
}
|
|
991
|
-
interface
|
|
1037
|
+
interface DynamicBundleItemAppProxy {
|
|
992
1038
|
id: string;
|
|
993
|
-
properties:
|
|
1039
|
+
properties: DynamicBundlePropertiesAppProxy;
|
|
994
1040
|
quantity: number;
|
|
995
1041
|
selling_plan?: number;
|
|
996
1042
|
}
|
|
1043
|
+
interface BundleSelectionItem {
|
|
1044
|
+
/** The unique numeric identifier for the item selection. */
|
|
1045
|
+
id: number;
|
|
1046
|
+
/** The collection id as it appears in the external e-commerce platform. */
|
|
1047
|
+
collection_id: string;
|
|
1048
|
+
/** The identifier of the external e-commerce platform. */
|
|
1049
|
+
collection_source: 'shopify';
|
|
1050
|
+
/** The date and time when this item was selected. */
|
|
1051
|
+
created_at: IsoDateString;
|
|
1052
|
+
/** 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. */
|
|
1053
|
+
external_product_id: string;
|
|
1054
|
+
/** 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. */
|
|
1055
|
+
external_variant_id: string;
|
|
1056
|
+
/** The quantity of this product. */
|
|
1057
|
+
quantity: number;
|
|
1058
|
+
/** The date and time at which the item selection was most recently updated. */
|
|
1059
|
+
updated_at: IsoDateString;
|
|
1060
|
+
}
|
|
1061
|
+
interface BundleSelection {
|
|
1062
|
+
/** The unique numeric identifier for the BundleSelection. */
|
|
1063
|
+
id: number;
|
|
1064
|
+
/** The ID of the BundleVariant associated with the BundleSelection. */
|
|
1065
|
+
bundle_variant_id: number;
|
|
1066
|
+
/** The ID of the PurchaseItem associated with the BundleSelection. */
|
|
1067
|
+
purchase_item_id: number;
|
|
1068
|
+
/** The date and time when the contents were selected. */
|
|
1069
|
+
created_at: IsoDateString;
|
|
1070
|
+
/** 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. */
|
|
1071
|
+
external_product_id: string;
|
|
1072
|
+
/** 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. */
|
|
1073
|
+
external_variant_id: string;
|
|
1074
|
+
items: BundleSelectionItem[];
|
|
1075
|
+
/** The date and time at which the BundleSelection was most recently updated. */
|
|
1076
|
+
updated_at: IsoDateString;
|
|
1077
|
+
}
|
|
1078
|
+
declare type BundleSelectionItemRequiredCreateProps = 'collection_id' | 'collection_source' | 'external_product_id' | 'external_variant_id' | 'quantity';
|
|
1079
|
+
declare type CreateBundleSelectionRequest = {
|
|
1080
|
+
purchase_item_id: number;
|
|
1081
|
+
items: Pick<BundleSelectionItem, BundleSelectionItemRequiredCreateProps>[];
|
|
1082
|
+
};
|
|
1083
|
+
declare type UpdateBundleSelectionRequest = CreateBundleSelectionRequest;
|
|
1084
|
+
interface BundleSelectionsResponse {
|
|
1085
|
+
next_cursor: null | string;
|
|
1086
|
+
previous_cursor: null | string;
|
|
1087
|
+
bundle_selections: BundleSelection[];
|
|
1088
|
+
}
|
|
1089
|
+
declare type BundleSelectionsSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1090
|
+
interface BundleSelectionListParams extends ListParams<BundleSelectionsSortBy> {
|
|
1091
|
+
/** Filter BundleSelections by Subscription or Onetime ID. */
|
|
1092
|
+
purchase_item_ids?: string[];
|
|
1093
|
+
/** Filter BundleSelections by BundleVariants. */
|
|
1094
|
+
bundle_variant_ids?: string[];
|
|
1095
|
+
}
|
|
997
1096
|
|
|
998
1097
|
declare type FirstOption = 'onetime' | 'autodeliver';
|
|
999
1098
|
declare type PriceAdjustmentsType = 'percentage';
|
|
@@ -1592,16 +1691,21 @@ declare function getCDNProductAndSettings(externalProductId: string | number): P
|
|
|
1592
1691
|
declare function getCDNBundleSettings(externalProductId: string | number): Promise<CDNBundleSettings | null | undefined>;
|
|
1593
1692
|
declare function resetCDNCache(): Promise<void>;
|
|
1594
1693
|
|
|
1595
|
-
declare function getBundleId(bundle:
|
|
1596
|
-
declare function getDynamicBundleItems(bundle:
|
|
1597
|
-
declare function validateBundle(bundle:
|
|
1694
|
+
declare function getBundleId(bundle: BundleAppProxy): Promise<string>;
|
|
1695
|
+
declare function getDynamicBundleItems(bundle: BundleAppProxy, shopifyProductHandle: string): DynamicBundleItemAppProxy[];
|
|
1696
|
+
declare function validateBundle(bundle: BundleAppProxy): Promise<boolean>;
|
|
1598
1697
|
/**
|
|
1599
1698
|
* Validates a dynamic bundle
|
|
1600
1699
|
*
|
|
1601
1700
|
* @param bundle Dynamic Bundle being validated
|
|
1602
1701
|
* @returns true or error message
|
|
1603
1702
|
*/
|
|
1604
|
-
declare function validateDynamicBundle(bundle:
|
|
1703
|
+
declare function validateDynamicBundle(bundle: BundleAppProxy): true | string;
|
|
1704
|
+
declare function getBundleSelection(session: Session, id: string | number): Promise<BundleSelection>;
|
|
1705
|
+
declare function listBundleSelections(session: Session, query?: BundleSelectionListParams): Promise<BundleSelectionsResponse>;
|
|
1706
|
+
declare function createBundleSelection(session: Session, createRequest: CreateBundleSelectionRequest): Promise<BundleSelection>;
|
|
1707
|
+
declare function updateBundleSelection(session: Session, id: string | number, updateRequest: UpdateBundleSelectionRequest): Promise<BundleSelection>;
|
|
1708
|
+
declare function deleteBundleSelection(session: Session, id: string | number): Promise<void>;
|
|
1605
1709
|
|
|
1606
1710
|
/** @internal Retrieves membership information for passed in id */
|
|
1607
1711
|
declare function getMembership(session: Session, id: string | number): Promise<Membership>;
|
|
@@ -1612,6 +1716,10 @@ declare function cancelMembership(session: Session, id: string | number, cancelR
|
|
|
1612
1716
|
/** @internal Activates a membership */
|
|
1613
1717
|
declare function activateMembership(session: Session, id: string | number, activateRequest: ActivateMembershipRequest): Promise<Membership>;
|
|
1614
1718
|
|
|
1719
|
+
declare function createMetafield(session: Session, createRequest: CreateMetafieldRequest): Promise<Metafield>;
|
|
1720
|
+
declare function updateMetafield(session: Session, id: string | number, updateRequest: UpdateMetafieldRequest): Promise<Metafield>;
|
|
1721
|
+
declare function deleteMetafield(session: Session, id: string | number): Promise<void>;
|
|
1722
|
+
|
|
1615
1723
|
declare function getOnetime(session: Session, id: string | number): Promise<Onetime>;
|
|
1616
1724
|
declare function listOnetimes(session: Session, query?: OnetimeListParams): Promise<OnetimesResponse>;
|
|
1617
1725
|
declare function createOnetime(session: Session, createRequest: CreateOnetimeRequest): Promise<Onetime>;
|
|
@@ -1622,6 +1730,11 @@ declare function getOrder(session: Session, id: string | number): Promise<Order>
|
|
|
1622
1730
|
declare function listOrders(session: Session, query?: OrderListParams): Promise<OrdersResponse>;
|
|
1623
1731
|
|
|
1624
1732
|
declare function getPaymentMethod(session: Session, id: string | number, options?: GetPaymentMethodOptions): Promise<PaymentMethod>;
|
|
1733
|
+
/**
|
|
1734
|
+
* Modify an existing Payment Method
|
|
1735
|
+
*
|
|
1736
|
+
* Currently, `shopify_payments` is in read-only mode and can only be managed by Shopify.
|
|
1737
|
+
*/
|
|
1625
1738
|
declare function updatePaymentMethod(session: Session, id: string | number, updateRequest: UpdatePaymentMethodRequest): Promise<PaymentMethod>;
|
|
1626
1739
|
declare function listPaymentMethods(session: Session, query?: PaymentMethodListParams): Promise<PaymentMethodsResponse>;
|
|
1627
1740
|
|
|
@@ -1675,4 +1788,4 @@ declare const api: {
|
|
|
1675
1788
|
};
|
|
1676
1789
|
declare function initRecharge(opt?: InitOptions): void;
|
|
1677
1790
|
|
|
1678
|
-
export { ActivateMembershipRequest, Address, AddressIncludes, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, AssociatedAddress,
|
|
1791
|
+
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, 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, 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 };
|