@rechargeapps/storefront-client 2.8.0 → 2.10.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/dist/index.d.ts CHANGED
@@ -262,1201 +262,1226 @@ type BooleanNumbers = 0 | 1;
262
262
  type BooleanStringNumbers = '0' | '1';
263
263
  type BooleanLike = boolean | BooleanNumbers | BooleanStringNumbers | BooleanString;
264
264
 
265
- type MetafieldOwnerResource = 'customer' | 'subscription' | 'order' | 'charge';
266
- interface Metafield {
267
- /** Unique numeric identifier for the metafield. */
268
- id: number;
269
- /** The date and time when the metafield was created. */
270
- created_at: IsoDateString;
271
- /** Description of the metafield. */
272
- description: string;
273
- /** The name of the metafield. */
274
- key: string;
275
- /** A category or container that differentiates your metadata from other metafields. */
276
- namespace: string;
277
- /** Unique numeric identifier of the owner_resource. */
278
- owner_id: number;
279
- /** Objects which support Metafields */
280
- owner_resource: MetafieldOwnerResource;
281
- /** The date and time when the metafield was last updated. */
282
- updated_at: IsoDateString;
283
- /** The content of the metafield. */
284
- value: string;
285
- /** The type of the value parameter. */
286
- value_type: 'string' | 'integer' | 'json_string';
287
- }
288
- type MetafieldRequiredCreateProps = 'key' | 'namespace' | 'owner_id' | 'owner_resource' | 'value' | 'value_type';
289
- type MetafieldOptionalCreateProps = 'description';
290
- interface CreateMetafieldRequest extends SubType<Metafield, MetafieldRequiredCreateProps, MetafieldOptionalCreateProps> {
291
- /** Instructs to add the Onetime to the next charge scheduled under this Address. */
292
- add_to_next_charge?: boolean;
265
+ type CreditSummaryIncludes = 'credit_details';
266
+ interface GetCreditSummaryOptions {
267
+ include?: CreditSummaryIncludes[];
268
+ presentment_currency_code?: string;
293
269
  }
294
- interface UpdateMetafieldRequest extends Partial<Pick<Metafield, 'description' | 'owner_id' | 'owner_resource' | 'value' | 'value_type'>> {
270
+ type CreditAccountType = 'reward' | 'manual' | 'gift';
271
+ interface PriceSet {
272
+ amount: string;
273
+ currency_code: string;
295
274
  }
296
-
297
- interface ShippingLine {
298
- /** The code associated with the shipping_line of a Charge. */
299
- code: string;
300
- /** The price of the shipping_line. */
301
- price: string;
302
- /** The date and time when the shipping_line was retrieved. */
303
- retrieved_at: IsoDateString | null;
304
- /** The source of the shipping_line. */
305
- source: string;
306
- /** The status the shipping_line. */
307
- status?: 'active' | 'pending' | 'queued';
308
- /** An array of tax lines associated with the shipping_line. */
309
- tax_lines: TaxLine[];
310
- /** A boolean indicating if the shipping_line is taxable. */
311
- taxable: boolean;
312
- /** The title of the shipping_line. */
313
- title: string;
275
+ interface CurrencyPriceSet {
276
+ store_default_currency: PriceSet;
277
+ presentment_currency: PriceSet;
314
278
  }
315
- type OrderStatus = 'success' | 'error' | 'queued' | 'cancelled' | 'pending_charge_status';
316
- type OrderType = 'checkout' | 'recurring';
317
- interface Order {
318
- /** The unique numeric identifier for the order. */
279
+ interface CreditAccount {
280
+ /** id of the credit account */
319
281
  id: number;
320
- /** The id of the associated Address within Recharge. */
321
- address_id: number;
322
- /** The billing address at the time the order was created. See Addresses for detailed address information. */
323
- billing_address: AssociatedAddress;
324
- /** An object containing parameters of the Charge. */
325
- charge: {
326
- /** The id of the charge associated with this order. */
327
- id: number;
328
- /** An object containing external transaction ids associated with this charge, as they appear in external platforms. */
329
- external_transaction_id: ExternalTransactionId;
330
- /** The name of the payment processor used for this charge. */
331
- payment_processor_name: string;
332
- /** The status of the charge. */
333
- status: ChargeStatus | null;
334
- };
335
- /** Details of the access method used by the purchase. */
336
- client_details: {
337
- /** The IP address of the buyer as detected in Checkout. */
338
- browser_ip: string | null;
339
- /** The user agent detected during Checkout. */
340
- user_agent: string | null;
341
- };
342
- /** The date when the order was created. */
282
+ /** Customer the credit account is associated with */
283
+ customer_id: number;
284
+ /** Store the credit account is associated with */
285
+ store_id: number;
286
+ /** Current balance of the credit account */
287
+ available_balance: string;
288
+ /** Starting balance of the credit account */
289
+ initial_balance: string;
290
+ /** When the credit account was created */
343
291
  created_at: IsoDateString;
344
- /** The currency of the payment used to create the order. */
345
- currency: string;
346
- /** Object that contains information about the Customer. */
347
- customer: {
348
- /** The ID of the associated customer record. */
349
- id: number;
350
- /** The user email. */
351
- email: string;
352
- /** An object containing customer information associated with this charge. */
353
- external_customer_id: ExternalId;
354
- /** The hash of the Customer associated with the Charge. */
355
- hash: string;
356
- };
357
- /** An array of Discounts associated with the Order. */
358
- discounts: Discount[];
359
- /** The cart token as it appears in an external system. */
360
- external_cart_token: string | null;
361
- /** An object containing external order ids. */
362
- external_order_id?: ExternalId;
363
- /** An object containing the external order numbers. */
364
- external_order_number: ExternalId;
365
- /** A boolean representing if this Order is generated from a prepaid purchase. */
366
- is_prepaid?: boolean;
367
- /** A list of line_item objects. */
368
- line_items: LineItem[];
369
- /** Notes associated with the Order. */
370
- note: string | null;
371
- /** An array of name value pairs of note attributes on the Order. */
372
- order_attributes: Property[];
373
- /** The date time that the associated charge was processed at. */
374
- processed_at: IsoDateString | null;
375
- /** The date time of when the associated charge is/was scheduled to process. */
376
- scheduled_at: IsoDateString;
377
- /** The shipping address where the order will be shipped. See Addresses for detailed Address information. */
378
- shipping_address: AssociatedAddress;
379
- /** An array of shipping lines associated with the order. */
380
- shipping_lines: ShippingLine[];
381
- /** The status of creating the Order. */
382
- status: OrderStatus;
383
- /** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
384
- subtotal_price: string;
385
- /** A comma separated list of tags on the Order. */
386
- tags: string | null;
387
- /** An array of tax lines that apply to the Order. */
388
- tax_lines: TaxLine[];
389
- /** A boolean indicator of the taxability of the Order. */
390
- taxable: boolean;
391
- /** The total discounted dollar value of the Order. */
392
- total_discounts: string;
393
- /** The total price of all line items of the Order. */
394
- total_line_items_price: string;
395
- /** The total amount due of the Order. */
396
- total_price: string;
397
- /** The total dollar amount of refunds associated with the Order. */
398
- total_refunds: string;
399
- /** The total tax due associated with the Order. */
400
- total_tax: string;
401
- /** The total weight of the order in grams. */
402
- total_weight_grams: number;
403
- /** An indicator of the order’s type. */
404
- type: OrderType;
405
- /** The date time at which the order was most recently updated. */
292
+ /** Currency of the credit account */
293
+ currency_code: string;
294
+ /** When the credit account expires */
295
+ expires_at: IsoDateString | null;
296
+ /** Name of the credit account */
297
+ name: string;
298
+ /** Redemption_code associated with credit account */
299
+ redemption_code: string;
300
+ /** The last time the credit account was updated */
406
301
  updated_at: IsoDateString;
407
- /** Error information about the order if status is 'error' */
408
- error: string | null;
409
- /** Additional information as requested */
302
+ api_client_id: number;
303
+ api_client_restricted: boolean;
304
+ /** Type of credit account */
305
+ type: CreditAccountType;
306
+ /** Currency price set of the credit account */
307
+ available_balance_set?: CurrencyPriceSet;
308
+ }
309
+ interface CustomerCreditSummary {
310
+ /** Unique numeric identifier for the Customer. */
311
+ customer_id: number;
312
+ /** The total balance of the customer’s credit accounts. */
313
+ total_available_balance: string;
314
+ /** The currency of the customer’s credit balance. */
315
+ currency_code: string;
410
316
  include?: {
411
- customer?: Customer;
412
- metafields?: Metafield[];
317
+ credit_details: CreditAccount[];
318
+ };
319
+ /** Currency price set of the customer's total credit balance */
320
+ total_available_balance_set?: CurrencyPriceSet;
321
+ /** Maximum amount of credits that can be redeemed per charge */
322
+ max_redemption_limit?: number | null;
323
+ /** Currency price set of the customer's max redemption limit */
324
+ max_redemption_limit_set?: CurrencyPriceSet;
325
+ /** Total available balance by credit type */
326
+ total_available_balance_by_credit_type?: {
327
+ [key in CreditAccountType]: number;
413
328
  };
414
329
  }
415
- type OrderIncludes = 'customer' | 'metafields';
416
- interface OrdersResponse {
330
+ type CreditAccountsSortBy = 'id-desc' | 'id-asc' | 'expires_at-asc' | 'expires_at-desc';
331
+ type CreditAccountIncludes = 'customer';
332
+ interface CreditAccountListParams extends ListParams<CreditAccountsSortBy> {
333
+ /** Filter credit accounts by type. */
334
+ credit_type?: CreditAccountType;
335
+ /** Filter credit accounts by id. */
336
+ ids?: (string | number)[];
337
+ /** Show credit accounts that expire after the given date. */
338
+ expires_at_min?: IsoDateString;
339
+ /** Show credit accounts that expire before the given date. */
340
+ expires_at_max?: IsoDateString;
341
+ /** Include related data options */
342
+ include?: CreditAccountIncludes[];
343
+ }
344
+ interface CreditAccountsResponse {
417
345
  next_cursor: null | string;
418
346
  previous_cursor: null | string;
419
- orders: Order[];
347
+ credit_accounts: CreditAccount[];
420
348
  }
421
- type OrderSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'processed_at-asc' | 'processed_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
422
- interface OrderListParams extends ListParams<OrderSortBy> {
423
- /** Filter orders by address. */
424
- address_id?: string | number;
425
- /** Filter orders by charge. */
426
- charge_id?: string | number;
427
- /** Show orders created after the given date. */
428
- created_at_min?: IsoDateString;
429
- /** Show orders created before the given date. */
430
- created_at_max?: IsoDateString;
431
- /** Filter orders by external_order_id. */
432
- external_order_id?: string | number;
433
- /** Filter orders by id. */
434
- ids?: (string | number)[];
435
- /** Show orders scheduled before the given date. */
436
- scheduled_at_max?: IsoDateString;
437
- /** Show orders scheduled after the given date. */
438
- scheduled_at_min?: IsoDateString;
439
- /** Filter orders with/without external_order_id. */
440
- has_external_order?: boolean;
441
- /** Filter orders by status. */
442
- status?: OrderStatus;
443
- /** Filter orders by type. */
444
- type?: OrderType;
445
- /** Filter orders by subscription or onetime. */
446
- purchase_item_id?: string | number;
447
- /** Show orders updated before the given date. */
448
- updated_at_max?: IsoDateString;
449
- /** Show orders updated after the given date. */
450
- updated_at_min?: IsoDateString;
451
- /** Include related data options */
452
- include?: OrderIncludes[];
349
+ interface ApplyCreditOptions {
350
+ recurring?: boolean;
453
351
  }
454
352
 
455
- interface PaymentDetails {
456
- /** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
457
- brand?: string;
458
- /** Payment_method expiry month. valid for CREDIT_CARD only. */
459
- exp_month?: number;
460
- /** Payment_method expiry year. valid for CREDIT_CARD only. */
461
- exp_year?: number;
462
- /** last 4-digits of the identifier. valid for CREDIT_CARD only. */
463
- last4?: string;
464
- /** email linked to paypal. valid for PAYPAL only. */
465
- paypal_email?: string;
466
- /** paypal user identifier. valid for PAYPAL only. */
467
- paypal_payer_id?: string;
468
- /** If a digital wallet. */
469
- wallet_type?: string;
470
- /** Type of funding for the Payment Method. */
471
- funding_type?: string;
472
- }
473
- type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT' | 'IDEAL' | 'SHOP_PAY' | 'PAYPAL_EXPRESS' | 'SOFORT' | 'GIROPAY' | 'STORED_VALUE' | 'AMAZON_PAY' | 'INVOICE' | 'AFTERPAY_CLEARPAY' | 'KLARNA';
474
- type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie' | 'adyen' | 'shopify_app_subscription_billing' | 'frictionless';
475
- type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
476
- interface PaymentMethod {
477
- /** The unique payment method id for a customer. */
353
+ /**
354
+ * Types for Recharge tiered discount incentives: rules that apply larger discounts
355
+ * when qualifying subscription or one-time line items meet per-tier quantity or
356
+ * line-price thresholds on checkout or recurring charges.
357
+ *
358
+ * Consumers use these shapes with the incentives tiered-discount API and on
359
+ * incentive payloads scoped to a bundle product, a single product, or a collection.
360
+ */
361
+
362
+ /**
363
+ * Which line item kinds a tiered discount may apply to.
364
+ * - `subscription`: recurring subscription items
365
+ * - `onetime`: one-time purchase items
366
+ */
367
+ type EligibleLineItemType = 'subscription' | 'onetime';
368
+ /**
369
+ * Which charge types a tiered discount may apply to.
370
+ * - `checkout`: first purchase / checkout charge
371
+ * - `recurring`: subsequent subscription charges
372
+ */
373
+ type EligibleChargeType = 'checkout' | 'recurring';
374
+ /**
375
+ * Lifecycle state of a tiered discount configuration.
376
+ * - `draft`: not yet published
377
+ * - `unpublished`: only active for existing customers
378
+ * - `published`: active for all customers
379
+ * - `inactive`: inactive for all customers
380
+ */
381
+ type TieredDiscountStatus = 'draft' | 'unpublished' | 'published' | 'inactive';
382
+ /** @internal Common fields present on every tier row before the quantity vs line-price condition. */
383
+ type TierBase = {
384
+ /** Whether the discount is a percentage or fixed amount. */
385
+ discount_type: 'percentage' | 'fixed_amount';
386
+ /** Discount value (percentage or currency amount, depending on `discount_type`). */
387
+ discount_value: number | string;
388
+ /** Stable identifier for this tier within the discount configuration. */
389
+ lookup_key: string;
390
+ /**
391
+ * Spend threshold in both store-default and presentment currencies.
392
+ * Only present on spend-based tiers when `presentment_currency_code` is passed.
393
+ */
394
+ condition_line_price_gte_set?: CurrencyPriceSet;
395
+ };
396
+ /**
397
+ * Each tier uses exactly one threshold:
398
+ * either condition quantity greater than or equal to or
399
+ * condition line price greater than or equal to, never both.
400
+ */
401
+ type Tier = TierBase & ({
402
+ condition_quantity_gte: number | string;
403
+ condition_line_price_gte?: never;
404
+ } | {
405
+ condition_line_price_gte: number | string;
406
+ condition_quantity_gte?: never;
407
+ });
408
+ /**
409
+ * A tiered discount definition scoped to a bundle product, a single product, or a
410
+ * collection (via the corresponding optional fields), including eligible charge and
411
+ * line item types and the ordered list of tiers.
412
+ */
413
+ interface TieredDiscount {
414
+ /** Incentive config id. */
478
415
  id: number;
479
- /** An object with the customer’s address information. */
480
- billing_address: AssociatedAddress;
481
- /** The Recharge customer_id */
482
- customer_id: number;
483
- /** The time the payment method was created. */
416
+ /** Created timestamp (ISO 8601). */
484
417
  created_at: IsoDateString;
485
- /** If this is the default payment method for the customer */
486
- default: boolean;
487
- /** Details about the specific payment method */
488
- payment_details: PaymentDetails;
418
+ /** Updated timestamp (ISO 8601). */
419
+ updated_at: IsoDateString;
420
+ /** Shopify automatic discount title used at checkout; may be null. */
421
+ shopify_display_name: string | null;
422
+ /** Charge types (checkout vs recurring) this discount applies to. */
423
+ eligible_charge_types: EligibleChargeType[];
424
+ /** Line item types (subscription vs onetime) this discount applies to. */
425
+ eligible_line_item_types: EligibleLineItemType[];
489
426
  /**
490
- * The type of payment this is.
491
- * If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
427
+ * Bundle scope: external bundle product id on the ecommerce platform.
428
+ * Present when the discount targets one bundle product.
492
429
  */
493
- payment_type: PaymentType;
494
- /** The customer token at the processor. */
495
- processor_customer_token: string;
430
+ external_bundle_product_id?: {
431
+ ecommerce: string | null;
432
+ };
496
433
  /**
497
- * This will impact validation on billing_details.
498
- * Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
434
+ * Single-product scope: external product id on the ecommerce platform.
435
+ * Present when the discount targets one product.
499
436
  */
500
- processor_name: ProcessorName;
501
- /** The payment token at the processor. */
502
- processor_payment_method_token: string;
503
- /** State of the Payment Method. */
504
- status: PaymentMethodStatus;
437
+ external_product_id?: {
438
+ ecommerce: string | null;
439
+ };
505
440
  /**
506
- * The status reason for the payment method.
507
- * Often used when invalid to provide background details in invalidity.
441
+ * Collection scope: Recharge collection id when the discount applies to a collection.
442
+ * Present when the discount targets a collection.
508
443
  */
509
- status_reason: string;
510
- /** The time the payment method was last updated. */
511
- updated_at: IsoDateString;
512
- /** The time the payment method was deleted. This is only included if `include_deleted` is true. */
513
- deleted_at?: IsoDateString;
514
- /** Additional information as requested */
515
- include?: {
516
- addresses?: Address[];
517
- };
444
+ collection_id?: string | null;
445
+ /** Stable identifier for this tiered discount configuration. */
446
+ lookup_key: string;
447
+ /** Internal name for the Tiered Discount. */
448
+ name: string;
449
+ /** Publication and lifecycle state. */
450
+ status: TieredDiscountStatus;
451
+ /** Ordered tiers as returned by the API (each entry wraps one tier object). */
452
+ tiers: {
453
+ tier: Tier;
454
+ }[];
518
455
  }
519
- interface PaymentMethodsResponse {
520
- next_cursor: null | string;
521
- previous_cursor: null | string;
522
- payment_methods: PaymentMethod[];
456
+ /** Payload (e.g. bundle-data or incentives API) that can embed tiered discount definitions. */
457
+ interface Incentives {
458
+ /** Tiered discount configurations for the current context. */
459
+ tiered_discounts: TieredDiscount[];
523
460
  }
524
- type PaymentMethodRequiredCreateProps = 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token';
525
- type PaymentMethodOptionalCreateProps = 'default' | 'billing_address';
526
- interface CreatePaymentMethodRequest extends SubType<PaymentMethod, PaymentMethodRequiredCreateProps, PaymentMethodOptionalCreateProps> {
527
- /** Array of address ids the new payment methods should be associated to */
528
- address_ids?: number[];
529
- /** like “mandate_1O7lt8FHTwP5c651R…” */
530
- external_mandate_id?: string;
531
- /** The payment method intent id */
532
- payment_method_intent_id?: string;
533
- /** The external payment method id */
534
- external_payment_method_id?: string;
535
- /** Whether to apply the payment method to all existing subscription addresses, will override address_ids if true */
536
- apply_to_all_subscription_addresses?: boolean;
461
+ /**
462
+ * A line item in the request body for evaluating tiered discount offers.
463
+ *
464
+ * Omit `quantity` / `total_price` (default `0` / `"0.00"`) to send a
465
+ * "product of interest" marker: the entry participates in target /
466
+ * collection-membership matching but contributes nothing to spend or
467
+ * quantity totals.
468
+ */
469
+ interface TieredDiscountOfferLineItem {
470
+ external_product_id: string;
471
+ /** Defaults to `0` when omitted (product-of-interest marker). */
472
+ quantity?: number;
473
+ /** 2dp string. Defaults to `"0.00"` when omitted. */
474
+ total_price?: string;
475
+ purchase_type: 'subscription' | 'onetime';
537
476
  }
538
- interface UpdatePaymentMethodRequest extends Partial<Pick<PaymentMethod, 'billing_address' | 'default'>> {
539
- /** Whether to apply the payment method to all existing subscription addresses */
540
- apply_to_all_subscription_addresses?: boolean;
477
+ /** Request body for `POST /incentives/tiered_discounts/offers`. */
478
+ interface TieredDiscountOffersRequest {
479
+ tiered_discount_context: EligibleChargeType;
480
+ charge_id?: number;
481
+ line_items?: TieredDiscountOfferLineItem[];
482
+ presentment_currency?: string;
541
483
  }
542
- type PaymentMethodIncludes = 'addresses';
543
- interface GetPaymentMethodOptions {
544
- include?: PaymentMethodIncludes[];
484
+ /** The target entity (product or collection) a tiered discount offer applies to. */
485
+ interface TieredDiscountOfferTarget {
486
+ type: 'product' | 'collection';
487
+ external_product_id?: string | null;
488
+ collection_id?: string | null;
489
+ collection_title?: string | null;
545
490
  }
546
- /** no sorting options for payment_methods, always by id-desc */
547
- type PaymentMethodSortBy = null;
548
- interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
549
- /** Return the payment_methods linked to the given processor_name. */
550
- processor_name?: ProcessorName;
551
- /** Return the payment_methods linked to the given address_id. */
552
- address_id?: string | number;
553
- /** Return the payment_methods linked to the given processor_payment_method_token. */
554
- processor_payment_method_token?: string;
555
- /** Include related data options */
556
- include?: PaymentMethodIncludes[];
557
- /** Include deleted payment methods */
558
- include_deleted?: boolean;
491
+ /** A single tier within a tiered discount offer response. */
492
+ interface TieredDiscountOfferTier {
493
+ lookup_key: string;
494
+ is_current: boolean;
495
+ discount_type: 'percentage' | 'fixed_amount';
496
+ discount_value: string;
497
+ threshold_type: 'quantity' | 'price';
498
+ threshold_value: string;
499
+ threshold_value_needed: string;
559
500
  }
560
- interface BaseCardDetails {
561
- /** Expiration month (1-12 or '01'-'12') */
562
- month: string | number;
563
- /** Expiration year (YYYY or YY format) */
564
- year: string | number;
501
+ /** A single tiered discount offer candidate returned by the offers endpoint. */
502
+ interface TieredDiscountOffer {
503
+ tiered_discount_id: number;
504
+ tiered_discount_name: string | null;
505
+ target: TieredDiscountOfferTarget;
506
+ applies_to_external_product_ids: string[];
507
+ tiers: TieredDiscountOfferTier[];
565
508
  }
566
- interface CardDetailsFirstNameLastName extends BaseCardDetails {
567
- /** First name on the card */
568
- first_name: string;
569
- /** Last name on the card */
570
- last_name: string;
509
+ /** Response from `POST /incentives/tiered_discounts/offers`. */
510
+ interface TieredDiscountOffersResponse {
511
+ charge_id: number | null;
512
+ currency: string;
513
+ presentment_currency: string;
514
+ offers: TieredDiscountOffer[];
571
515
  }
572
- interface CardDetailsFullName extends BaseCardDetails {
573
- /** Full name on the card */
574
- full_name: string;
516
+ /** Paginated list response for tiered discounts. */
517
+ interface TieredDiscountsResponse {
518
+ /** Cursor for the next page, or `null` if none. */
519
+ next_cursor: string | null;
520
+ /** Cursor for the previous page, or `null` if none. */
521
+ previous_cursor: string | null;
522
+ /** Tiered discounts in this page. */
523
+ tiered_discounts: TieredDiscount[];
575
524
  }
576
- interface PaymentMethodFormOptions {
577
- /** Card holder details */
578
- card_details: CardDetailsFirstNameLastName | CardDetailsFullName;
579
- /** Billing address for the payment method */
580
- billing_address: AssociatedAddress;
581
- /** Whether to set this payment method as the default */
582
- default_payment_method?: boolean;
583
- /** Recharge address IDs to associate with this payment method */
584
- address_ids?: number[];
585
- /** Whether to apply the payment method to all existing subscription addresses, will override address_ids if true */
586
- apply_to_all_subscription_addresses?: boolean;
587
- }
588
- interface PaymentFormConfig {
589
- /** DOM element ID where the card number field will be mounted */
590
- numberElementId: string;
591
- /** DOM element ID where the CVV field will be mounted */
592
- cvvElementId: string;
593
- /** Optional css styles for the hosted fields (number and cvv) */
594
- styles?: string;
595
- /** Field type for the card number field, defaults to 'number' */
596
- numberFieldType?: spreedly.SpreedlyFieldType;
597
- /** Field type for the CVV field, defaults to 'number' */
598
- cvvFieldType?: spreedly.SpreedlyFieldType;
599
- /** Label for the card number field, defaults to 'Card Number' */
600
- numberLabel?: string;
601
- /** Label for the CVV field, defaults to 'CVV' */
602
- cvvLabel?: string;
603
- /** Placeholder text for card number field, default is empty string */
604
- numberPlaceholder?: string;
605
- /** Placeholder text for CVV field, default is empty string */
606
- cvvPlaceholder?: string;
607
- /**
608
- * Format for card number and CVV display
609
- * 'plainFormat' - default (no formatting)
610
- * 'prettyFormat' - adds spaces between groups of 4 digits, requires numberFieldType to be 'text' or 'tel'
611
- * 'maskedFormat' - masked via '*' no spaces, forces numberFieldType to 'text'
612
- */
613
- numberFormat?: 'plainFormat' | 'prettyFormat' | 'maskedFormat';
614
- }
615
- interface PaymentFieldEventCallback {
616
- (fieldName: spreedly.SpreedlyField, eventType: spreedly.SpreedlyFieldEventType, activeElement: spreedly.SpreedlyField, inputProperties: spreedly.SpreedlyFieldEventInputProperties): void;
617
- }
618
- interface PaymentMethodTokenCallback {
619
- (token: string, paymentMethod: spreedly.SpreedlyPaymentMethod): void;
620
- }
621
- interface PaymentErrorCallback {
622
- (errors: spreedly.SpreedlyError[]): void;
623
- }
624
- interface PaymentFormEventHandlers {
625
- /** Called when the form is ready for input */
626
- onReady?: () => void;
627
- /** Called when a field event occurs */
628
- onFieldEvent?: PaymentFieldEventCallback;
629
- /** Called when a payment method token is received */
630
- onPaymentMethod?: PaymentMethodTokenCallback;
631
- /** Called when validation errors occur */
632
- onErrors?: PaymentErrorCallback;
633
- }
634
- interface PaymentFormController {
635
- /**
636
- * Initialize the payment form with the payment script
637
- * @param config - Configuration for the form
638
- * @param handlers - Event handlers for form events
639
- */
640
- mount(config: PaymentFormConfig, handlers?: PaymentFormEventHandlers): void;
641
- /**
642
- * Tokenize the current card data
643
- * This triggers the payment script to create a payment method token
644
- * @param cardDetails - Card holder name and expiration
645
- */
646
- tokenize(cardDetails: CardDetailsFirstNameLastName | CardDetailsFullName): void;
647
- /**
648
- * Submit the tokenized payment method to Recharge, will not tokenize the card data again if tokenize has already been called
649
- * @param options - Payment method options including billing address
650
- * @returns Result of the submission
651
- */
652
- submit(options: PaymentMethodFormOptions): Promise<PaymentMethod>;
653
- /**
654
- * Reset the form fields
655
- */
656
- reset(): void;
657
- /**
658
- * Clean up and remove event handlers
659
- */
660
- unmount(): void;
661
- /**
662
- * Add event handlers to the form
663
- * @param handlers - The event handlers to add
664
- */
665
- addEventHandlers(handlers: PaymentFormEventHandlers): void;
666
- /**
667
- * Remove all event handlers currently registered via mount
668
- */
669
- removeHandlers(): void;
670
- /**
671
- * Set the field type for a field
672
- * @param name - The name of the field
673
- * @param type - The type of the field
674
- */
675
- setFieldType(name: spreedly.SpreedlyField, type: spreedly.SpreedlyFieldType): void;
676
- /**
677
- * Set the label for a field
678
- * @param name - The name of the field
679
- * @param label - The label for the field
680
- */
681
- setLabel(name: spreedly.SpreedlyField, label: string): void;
682
- /**
683
- * Set the number format for the form
684
- * @param format - The number format
685
- */
686
- setNumberFormat(format: 'plainFormat' | 'prettyFormat' | 'maskedFormat'): void;
687
- /**
688
- * Set the placeholder for a field
689
- * @param name - The name of the field
690
- * @param placeholder - The placeholder for the field
691
- */
692
- setPlaceholder(name: spreedly.SpreedlyField, placeholder: string): void;
525
+ /** Query parameters when listing tiered discounts. */
526
+ interface TieredDiscountsParams {
527
+ /** Restrict to discounts in this status. */
528
+ status?: TieredDiscountStatus;
529
+ /** Filter by external (ecommerce) product id. */
530
+ external_product_id?: string;
531
+ /** Filter by external bundle product id. */
532
+ external_bundle_product_id?: string;
533
+ /** Filter by Recharge collection id. */
534
+ collection_id?: string;
535
+ /** Pagination cursor from a prior response. */
536
+ cursor?: string;
537
+ /** Maximum number of records to return. */
538
+ limit?: number;
693
539
  /**
694
- * Set the style for a field
695
- * @param name - The name of the field
696
- * @param style - The css string to apply to the field
540
+ * ISO 4217 currency code for the customer's presentment currency.
541
+ * When provided and different from the store currency, spend-based tiers
542
+ * include a `condition_line_price_gte_set` with converted amounts.
697
543
  */
698
- setStyle(name: spreedly.SpreedlyField, style: string): void;
544
+ presentment_currency_code?: string;
699
545
  }
700
546
 
701
- type AddonType = 'child' | 'parent';
702
- interface Addon {
703
- child_subscription_id: number;
704
- parent_subscription_id: number;
705
- type: AddonType;
547
+ type ViewTypeSetting = {
548
+ viewType: 'page' | 'modal';
549
+ };
550
+ interface ViewsTemplateSchema {
551
+ [key: string]: ViewTemplateSchema;
706
552
  }
553
+ interface ViewTemplateSchema {
554
+ order: string[];
555
+ sections: {
556
+ [key: string]: WidgetSchemaSection;
557
+ };
558
+ settings?: ViewTypeSetting;
559
+ }
560
+ type WidgetSchemaSection = {
561
+ type: string;
562
+ name?: string;
563
+ settings: Settings;
564
+ blocks?: {
565
+ [key: string]: WidgetSchemaBlock;
566
+ };
567
+ blocksOrder?: string[];
568
+ };
569
+ type WidgetSchemaBlock = {
570
+ type: string;
571
+ settings: Settings;
572
+ };
573
+ type Settings = Record<string, string | number>;
707
574
 
708
- type CreditSummaryIncludes = 'credit_details';
709
- interface GetCreditSummaryOptions {
710
- include?: CreditSummaryIncludes[];
711
- presentment_currency_code?: string;
575
+ interface AddonSettings {
576
+ collectionHandle: string;
577
+ collectionId: string;
578
+ enabled: boolean;
712
579
  }
713
- type CreditAccountType = 'reward' | 'manual' | 'gift';
714
- interface PriceSet {
715
- amount: string;
716
- currency_code: string;
580
+ interface AddToCartCallbackSettings {
581
+ type: 'none' | 'callback' | 'redirect';
582
+ value: string;
717
583
  }
718
- interface CurrencyPriceSet {
719
- store_default_currency: PriceSet;
720
- presentment_currency: PriceSet;
584
+ interface CrossSellsSettings {
585
+ collectionId: string;
586
+ collectionHandle: string;
587
+ enabled: boolean;
588
+ defaultPurchaseType?: 'subscription' | 'onetime';
721
589
  }
722
- interface CreditAccount {
723
- /** id of the credit account */
724
- id: number;
725
- /** Customer the credit account is associated with */
726
- customer_id: number;
727
- /** Store the credit account is associated with */
728
- store_id: number;
729
- /** Current balance of the credit account */
730
- available_balance: string;
731
- /** Starting balance of the credit account */
732
- initial_balance: string;
733
- /** When the credit account was created */
734
- created_at: IsoDateString;
735
- /** Currency of the credit account */
736
- currency_code: string;
737
- /** When the credit account expires */
738
- expires_at: IsoDateString | null;
739
- /** Name of the credit account */
590
+ interface StepSettingsCommon {
591
+ description?: string;
592
+ disable?: boolean;
593
+ index: string;
740
594
  name: string;
741
- /** Redemption_code associated with credit account */
742
- redemption_code: string;
743
- /** The last time the credit account was updated */
744
- updated_at: IsoDateString;
745
- api_client_id: number;
746
- api_client_restricted: boolean;
747
- /** Type of credit account */
748
- type: CreditAccountType;
749
- /** Currency price set of the credit account */
750
- available_balance_set?: CurrencyPriceSet;
595
+ title: string;
751
596
  }
752
- interface CustomerCreditSummary {
753
- /** Unique numeric identifier for the Customer. */
754
- customer_id: number;
755
- /** The total balance of the customer’s credit accounts. */
756
- total_available_balance: string;
757
- /** The currency of the customer’s credit balance. */
758
- currency_code: string;
759
- include?: {
760
- credit_details: CreditAccount[];
761
- };
762
- /** Currency price set of the customer's total credit balance */
763
- total_available_balance_set?: CurrencyPriceSet;
764
- /** Maximum amount of credits that can be redeemed per charge */
765
- max_redemption_limit?: number | null;
766
- /** Currency price set of the customer's max redemption limit */
767
- max_redemption_limit_set?: CurrencyPriceSet;
768
- /** Total available balance by credit type */
769
- total_available_balance_by_credit_type?: {
770
- [key in CreditAccountType]: number;
597
+ type VariantSelector = {
598
+ optionsMeta: {
599
+ [key: string]: {
600
+ defaultImage: string;
601
+ content: string;
602
+ };
771
603
  };
604
+ };
605
+ type StepSettingsTypes = 'variantSelector' | 'all-collections' | 'addons' | 'summary' | 'cross-sells';
606
+ type BundlePriceRule = 'fixed' | 'dynamic';
607
+ type VariantSelectorStepSetting = StepSettingsCommon & {
608
+ data?: VariantSelector;
609
+ type: 'variantSelector';
610
+ };
611
+ type StepSettings = StepSettingsCommon & {
612
+ data?: Record<string, unknown>;
613
+ type: Exclude<StepSettingsTypes, 'variantSelector'>;
614
+ };
615
+ interface MultiStepSettings {
616
+ optionImages: string;
617
+ steps: [VariantSelectorStepSetting, ...StepSettings[]];
772
618
  }
773
- type CreditAccountsSortBy = 'id-desc' | 'id-asc' | 'expires_at-asc' | 'expires_at-desc';
774
- type CreditAccountIncludes = 'customer';
775
- interface CreditAccountListParams extends ListParams<CreditAccountsSortBy> {
776
- /** Filter credit accounts by type. */
777
- credit_type?: CreditAccountType;
778
- /** Filter credit accounts by id. */
779
- ids?: (string | number)[];
780
- /** Show credit accounts that expire after the given date. */
781
- expires_at_min?: IsoDateString;
782
- /** Show credit accounts that expire before the given date. */
783
- expires_at_max?: IsoDateString;
784
- /** Include related data options */
785
- include?: CreditAccountIncludes[];
786
- }
787
- interface CreditAccountsResponse {
788
- next_cursor: null | string;
789
- previous_cursor: null | string;
790
- credit_accounts: CreditAccount[];
619
+ type BundleTemplateType = 'multi-step' | 'one-page' | 'custom' | 'none';
620
+ interface OnePageSettings {
621
+ frequencySelector: 'toggle' | 'dropdown';
791
622
  }
792
- interface ApplyCreditOptions {
793
- recurring?: boolean;
623
+ interface BundleTemplateSettings {
624
+ multiStep?: MultiStepSettings;
625
+ onePage: OnePageSettings;
794
626
  }
795
-
796
- /**
797
- * Types for Recharge tiered discount incentives: rules that apply larger discounts
798
- * when qualifying subscription or one-time line items meet per-tier quantity or
799
- * line-price thresholds on checkout or recurring charges.
800
- *
801
- * Consumers use these shapes with the incentives tiered-discount API and on
802
- * incentive payloads scoped to a bundle product, a single product, or a collection.
803
- */
804
-
805
- /**
806
- * Which line item kinds a tiered discount may apply to.
807
- * - `subscription`: recurring subscription items
808
- * - `onetime`: one-time purchase items
809
- */
810
- type EligibleLineItemType = 'subscription' | 'onetime';
811
- /**
812
- * Which charge types a tiered discount may apply to.
813
- * - `checkout`: first purchase / checkout charge
814
- * - `recurring`: subsequent subscription charges
815
- */
816
- type EligibleChargeType = 'checkout' | 'recurring';
817
- /**
818
- * Lifecycle state of a tiered discount configuration.
819
- * - `draft`: not yet published
820
- * - `unpublished`: only active for existing customers
821
- * - `published`: active for all customers
822
- * - `inactive`: inactive for all customers
823
- */
824
- type TieredDiscountStatus = 'draft' | 'unpublished' | 'published' | 'inactive';
825
- /** @internal Common fields present on every tier row before the quantity vs line-price condition. */
826
- type TierBase = {
827
- /** Whether the discount is a percentage or fixed amount. */
828
- discount_type: 'percentage' | 'fixed_amount';
829
- /** Discount value (percentage or currency amount, depending on `discount_type`). */
830
- discount_value: number | string;
831
- /** Stable identifier for this tier within the discount configuration. */
832
- lookup_key: string;
833
- /**
834
- * Spend threshold in both store-default and presentment currencies.
835
- * Only present on spend-based tiers when `presentment_currency_code` is passed.
836
- */
837
- condition_line_price_gte_set?: CurrencyPriceSet;
627
+ type WidgetVisibility = {
628
+ signup: boolean;
629
+ portal: boolean;
838
630
  };
839
- /**
840
- * Each tier uses exactly one threshold:
841
- * either condition quantity greater than or equal to or
842
- * condition line price greater than or equal to, never both.
843
- */
844
- type Tier = TierBase & ({
845
- condition_quantity_gte: number | string;
846
- condition_line_price_gte?: never;
847
- } | {
848
- condition_line_price_gte: number | string;
849
- condition_quantity_gte?: never;
850
- });
851
- /**
852
- * A tiered discount definition scoped to a bundle product, a single product, or a
853
- * collection (via the corresponding optional fields), including eligible charge and
854
- * line item types and the ordered list of tiers.
855
- */
856
- interface TieredDiscount {
857
- /** Incentive config id. */
858
- id: number;
859
- /** Created timestamp (ISO 8601). */
860
- created_at: IsoDateString;
861
- /** Updated timestamp (ISO 8601). */
862
- updated_at: IsoDateString;
863
- /** Shopify automatic discount title used at checkout; may be null. */
864
- shopify_display_name: string | null;
865
- /** Charge types (checkout vs recurring) this discount applies to. */
866
- eligible_charge_types: EligibleChargeType[];
867
- /** Line item types (subscription vs onetime) this discount applies to. */
868
- eligible_line_item_types: EligibleLineItemType[];
869
- /**
870
- * Bundle scope: external bundle product id on the ecommerce platform.
871
- * Present when the discount targets one bundle product.
872
- */
873
- external_bundle_product_id?: {
874
- ecommerce: string | null;
875
- };
876
- /**
877
- * Single-product scope: external product id on the ecommerce platform.
878
- * Present when the discount targets one product.
879
- */
880
- external_product_id?: {
881
- ecommerce: string | null;
882
- };
883
- /**
884
- * Collection scope: Recharge collection id when the discount applies to a collection.
885
- * Present when the discount targets a collection.
886
- */
887
- collection_id?: string | null;
888
- /** Stable identifier for this tiered discount configuration. */
889
- lookup_key: string;
890
- /** Internal name for the Tiered Discount. */
891
- name: string;
892
- /** Publication and lifecycle state. */
893
- status: TieredDiscountStatus;
894
- /** Ordered tiers as returned by the API (each entry wraps one tier object). */
895
- tiers: {
896
- tier: Tier;
897
- }[];
631
+ interface BundleProductGlobalStyles {
632
+ global_aspect_ratio: string;
633
+ global_background: string;
634
+ global_body_font: string;
635
+ global_brand: string;
636
+ global_brand_secondary: string;
637
+ global_buttons_color: string;
638
+ global_cards_background: string;
639
+ global_cards_border: string;
640
+ global_corners: string;
641
+ global_page_width: string;
642
+ global_text_color: string;
898
643
  }
899
- /** Payload (e.g. bundle-data or incentives API) that can embed tiered discount definitions. */
900
- interface Incentives {
901
- /** Tiered discount configurations for the current context. */
902
- tiered_discounts: TieredDiscount[];
644
+ interface BundleProductLayoutSettings {
645
+ addons: AddonSettings;
646
+ addToCartCallback: AddToCartCallbackSettings;
647
+ collapsibleSections: boolean;
648
+ crossSells: CrossSellsSettings;
649
+ defaultFrequency: string;
650
+ defaultVariantId: string;
651
+ description: string;
652
+ filters: string[];
653
+ learnMoreModal: boolean;
654
+ published: boolean;
655
+ showStickyStatusBar: boolean;
656
+ showVariants: boolean;
657
+ template: BundleTemplateType;
658
+ templateSettings: BundleTemplateSettings;
659
+ title: string;
660
+ visibility: WidgetVisibility;
661
+ templates?: Record<string, number> | ViewsTemplateSchema | null;
662
+ globalStyles?: BundleProductGlobalStyles | null;
903
663
  }
904
- /**
905
- * A line item in the request body for evaluating tiered discount offers.
906
- *
907
- * Omit `quantity` / `total_price` (default `0` / `"0.00"`) to send a
908
- * "product of interest" marker: the entry participates in target /
909
- * collection-membership matching but contributes nothing to spend or
910
- * quantity totals.
911
- */
912
- interface TieredDiscountOfferLineItem {
913
- external_product_id: string;
914
- /** Defaults to `0` when omitted (product-of-interest marker). */
915
- quantity?: number;
916
- /** 2dp string. Defaults to `"0.00"` when omitted. */
917
- total_price?: string;
918
- purchase_type: 'subscription' | 'onetime';
664
+ interface BundleVariantOptionSourceBase {
665
+ id: number;
666
+ quantity_max: number | null;
667
+ quantity_min: number | null;
919
668
  }
920
- /** Request body for `POST /incentives/tiered_discounts/offers`. */
921
- interface TieredDiscountOffersRequest {
922
- tiered_discount_context: EligibleChargeType;
923
- charge_id?: number;
924
- line_items?: TieredDiscountOfferLineItem[];
925
- presentment_currency?: string;
669
+ /** Option source shape returned by the product endpoints (`productSearch`, product CDN). */
670
+ interface BundleVariantOptionSource extends BundleVariantOptionSourceBase {
671
+ collection_id: string;
926
672
  }
927
- /** The target entity (product or collection) a tiered discount offer applies to. */
928
- interface TieredDiscountOfferTarget {
929
- type: 'product' | 'collection';
930
- external_product_id?: string | null;
931
- collection_id?: string | null;
932
- collection_title?: string | null;
673
+ /** Option source shape returned when a BundleProduct is included on a subscription (e.g. `getCustomer` with `include.subscriptions`). */
674
+ interface BundleVariantOptionSourceSubscription extends BundleVariantOptionSourceBase {
675
+ option_source_id: string;
676
+ source_platform: string;
677
+ position: number;
678
+ created_at: IsoDateString;
679
+ updated_at: IsoDateString;
933
680
  }
934
- /** A single tier within a tiered discount offer response. */
935
- interface TieredDiscountOfferTier {
936
- lookup_key: string;
937
- is_current: boolean;
938
- discount_type: 'percentage' | 'fixed_amount';
939
- discount_value: string;
940
- threshold_type: 'quantity' | 'price';
941
- threshold_value: string;
942
- threshold_value_needed: string;
681
+ interface BundleVariantSelectionDefault {
682
+ id: number;
683
+ quantity: number;
684
+ external_variant_id: string;
943
685
  }
944
- /** A single tiered discount offer candidate returned by the offers endpoint. */
945
- interface TieredDiscountOffer {
946
- tiered_discount_id: number;
947
- tiered_discount_name: string | null;
948
- target: TieredDiscountOfferTarget;
949
- applies_to_external_product_ids: string[];
950
- tiers: TieredDiscountOfferTier[];
686
+ interface BundleVariantRange {
687
+ id: number;
688
+ quantity_max: number | null;
689
+ quantity_min: number;
690
+ updated_at: IsoDateString;
691
+ created_at: IsoDateString;
951
692
  }
952
- /** Response from `POST /incentives/tiered_discounts/offers`. */
953
- interface TieredDiscountOffersResponse {
954
- charge_id: number | null;
955
- currency: string;
956
- presentment_currency: string;
957
- offers: TieredDiscountOffer[];
693
+ interface BundleVariant<T extends BundleVariantOptionSourceBase = BundleVariantOptionSource> {
694
+ enabled: boolean;
695
+ external_variant_id: string;
696
+ id: number;
697
+ items_count: number;
698
+ option_sources: T[];
699
+ position: number;
700
+ selection_defaults: BundleVariantSelectionDefault[];
701
+ title: string;
702
+ ranges: BundleVariantRange[];
703
+ updated_at: IsoDateString;
704
+ created_at: IsoDateString;
958
705
  }
959
- /** Paginated list response for tiered discounts. */
960
- interface TieredDiscountsResponse {
961
- /** Cursor for the next page, or `null` if none. */
962
- next_cursor: string | null;
963
- /** Cursor for the previous page, or `null` if none. */
964
- previous_cursor: string | null;
965
- /** Tiered discounts in this page. */
966
- tiered_discounts: TieredDiscount[];
706
+ interface BundleProduct<T extends BundleVariantOptionSourceBase = BundleVariantOptionSource> {
707
+ created_at: IsoDateString;
708
+ custom_prices: boolean;
709
+ customization_window_disabled_message: string | null;
710
+ customization_window: number | null;
711
+ default_bundle_variant_id: number;
712
+ description: string | null;
713
+ external_product_id: string;
714
+ id: number;
715
+ is_customizable: boolean;
716
+ layout_settings: BundleProductLayoutSettings;
717
+ layout_settings_version: '2021-11';
718
+ max_quantity_per_variant: number | null;
719
+ price_rule: BundlePriceRule | null;
720
+ reset_box_contents: boolean;
721
+ title: string;
722
+ updated_at: IsoDateString;
723
+ variants: BundleVariant<T>[];
724
+ settings: {
725
+ display_variants_as_separate_products_in_list: boolean;
726
+ dynamic_filter_products_by_discount: boolean;
727
+ show_product_and_variant_name_in_products_list: boolean;
728
+ };
729
+ incentives: Incentives | null;
967
730
  }
968
- /** Query parameters when listing tiered discounts. */
969
- interface TieredDiscountsParams {
970
- /** Restrict to discounts in this status. */
971
- status?: TieredDiscountStatus;
972
- /** Filter by external (ecommerce) product id. */
731
+
732
+ type AddonType = 'child' | 'parent';
733
+ interface Addon {
734
+ child_subscription_id: number;
735
+ parent_subscription_id: number;
736
+ type: AddonType;
737
+ }
738
+
739
+ /** @internal */
740
+ type MembershipStatus = 'active' | 'inactive';
741
+ /** @internal */
742
+ interface Membership {
743
+ id: number;
744
+ address_id: number;
745
+ customer_id: number;
746
+ membership_program_id: number;
747
+ purchase_item_id: number;
748
+ cancellation_reason: string | null;
749
+ cancellation_reason_comments: string | null;
750
+ cancelled_at: IsoDateString | null;
751
+ charge_interval_frequency: string;
752
+ charge_interval_unit: string;
753
+ created_at: IsoDateString;
754
+ expires_at: IsoDateString;
755
+ external_product_id: number;
756
+ external_variant_id: number;
757
+ has_queued_charges: boolean;
758
+ next_charge_scheduled_at: IsoDateString;
759
+ presentment_currency: string;
760
+ price: number;
761
+ product_title: string;
762
+ purchase_item_status: string;
763
+ purchase_item_type: 'membership_subscription';
764
+ quantity: number;
765
+ status: MembershipStatus;
766
+ type: 'membership_subscription';
767
+ updated_at: IsoDateString;
768
+ variant_title: string;
769
+ }
770
+ /** @internal */
771
+ interface MembershipResponse {
772
+ membership: Membership;
773
+ }
774
+ /** @internal */
775
+ interface MembershipListResponse {
776
+ next_cursor: null | string;
777
+ previous_cursor: null | string;
778
+ memberships: Membership[];
779
+ }
780
+ /** @internal */
781
+ type MembershipsSortBy = 'id-asc' | 'id-desc';
782
+ /** @internal */
783
+ type membershipIncludes = 'customer' | 'subscriptions';
784
+ /** @internal */
785
+ type MembershipIncludes = `${membershipIncludes}` | `${membershipIncludes},${membershipIncludes}`;
786
+ /** @internal */
787
+ interface MembershipListParams extends ListParams<MembershipsSortBy> {
788
+ include?: MembershipIncludes;
789
+ /** Return the memberships linked to the given membership_program_ids. */
790
+ membership_program_ids?: (string | number)[];
791
+ /** Return the memberships with specified status. */
792
+ status?: MembershipStatus;
793
+ /** Returns memberships created after the given time. */
794
+ created_at_min?: IsoDateString;
795
+ /** Returns memberships created before the given time. */
796
+ created_at_max?: IsoDateString;
797
+ /** Returns memberships expiring after the given time. */
798
+ expires_at_min?: IsoDateString;
799
+ /** Returns memberships expiring before the given time. */
800
+ expires_at_max?: IsoDateString;
801
+ /** If true the response will include the cancelled Memberships as well as the others. */
802
+ include_cancelled?: boolean;
803
+ /** If true the response will include the deleted Memberships as well as the others. */
804
+ include_deleted?: boolean;
805
+ }
806
+ /** @internal */
807
+ interface ActivateMembershipRequest {
808
+ expires_at: string | null;
809
+ }
810
+ /** @internal */
811
+ interface CancelMembershipRequest {
812
+ cancel_immediately: boolean;
813
+ cancellation_reason: string;
814
+ cancellation_reason_comments: string;
815
+ expires_at: IsoDateString;
816
+ }
817
+ /** @internal */
818
+ type intervalUnit = 'day' | 'month' | 'year';
819
+ /** @internal */
820
+ interface ChangeMembershipRequest {
821
+ /** Updates the membership program to the membership specified one. If membership_program_id is not specified, a external_product_id should be specified. */
822
+ membership_program_id?: number;
823
+ /** Updates the membership product to the specified one. If external_product_id is not specified, a membership_program_id should be specified. */
973
824
  external_product_id?: string;
974
- /** Filter by external bundle product id. */
975
- external_bundle_product_id?: string;
976
- /** Filter by Recharge collection id. */
977
- collection_id?: string;
978
- /** Pagination cursor from a prior response. */
979
- cursor?: string;
980
- /** Maximum number of records to return. */
981
- limit?: number;
982
- /**
983
- * ISO 4217 currency code for the customer's presentment currency.
984
- * When provided and different from the store currency, spend-based tiers
985
- * include a `condition_line_price_gte_set` with converted amounts.
986
- */
987
- presentment_currency_code?: string;
825
+ /** Updates the the variant id to the specified one. */
826
+ external_variant_id?: string;
827
+ /** Updates the interval frequency to the specified one. A charge_interval_frequency must be included when providing an interval frequency. */
828
+ charge_interval_frequency?: number;
829
+ /** Updates the interval frequency unit to the specified one. A charge_interval_frequency must be included when providing an interval unit. */
830
+ charge_interval_unit?: intervalUnit;
831
+ /** Updates the price to the specified one. If not provided the subscription will be updated with the price of the new external_product_id*/
832
+ price?: number;
833
+ /** Updates the membership quantity. This is only meant to be used with memberships whose quantity is greater than 1. */
834
+ quantity?: number;
988
835
  }
989
836
 
990
- type ViewTypeSetting = {
991
- viewType: 'page' | 'modal';
992
- };
993
- interface ViewsTemplateSchema {
994
- [key: string]: ViewTemplateSchema;
837
+ type MetafieldOwnerResource = 'customer' | 'subscription' | 'order' | 'charge';
838
+ interface Metafield {
839
+ /** Unique numeric identifier for the metafield. */
840
+ id: number;
841
+ /** The date and time when the metafield was created. */
842
+ created_at: IsoDateString;
843
+ /** Description of the metafield. */
844
+ description: string;
845
+ /** The name of the metafield. */
846
+ key: string;
847
+ /** A category or container that differentiates your metadata from other metafields. */
848
+ namespace: string;
849
+ /** Unique numeric identifier of the owner_resource. */
850
+ owner_id: number;
851
+ /** Objects which support Metafields */
852
+ owner_resource: MetafieldOwnerResource;
853
+ /** The date and time when the metafield was last updated. */
854
+ updated_at: IsoDateString;
855
+ /** The content of the metafield. */
856
+ value: string;
857
+ /** The type of the value parameter. */
858
+ value_type: 'string' | 'integer' | 'json_string';
995
859
  }
996
- interface ViewTemplateSchema {
997
- order: string[];
998
- sections: {
999
- [key: string]: WidgetSchemaSection;
1000
- };
1001
- settings?: ViewTypeSetting;
860
+ type MetafieldRequiredCreateProps = 'key' | 'namespace' | 'owner_id' | 'owner_resource' | 'value' | 'value_type';
861
+ type MetafieldOptionalCreateProps = 'description';
862
+ interface CreateMetafieldRequest extends SubType<Metafield, MetafieldRequiredCreateProps, MetafieldOptionalCreateProps> {
863
+ /** Instructs to add the Onetime to the next charge scheduled under this Address. */
864
+ add_to_next_charge?: boolean;
1002
865
  }
1003
- type WidgetSchemaSection = {
1004
- type: string;
1005
- name?: string;
1006
- settings: Settings;
1007
- blocks?: {
1008
- [key: string]: WidgetSchemaBlock;
866
+ interface UpdateMetafieldRequest extends Partial<Pick<Metafield, 'description' | 'owner_id' | 'owner_resource' | 'value' | 'value_type'>> {
867
+ }
868
+
869
+ interface ShippingLine {
870
+ /** The code associated with the shipping_line of a Charge. */
871
+ code: string;
872
+ /** The price of the shipping_line. */
873
+ price: string;
874
+ /** The date and time when the shipping_line was retrieved. */
875
+ retrieved_at: IsoDateString | null;
876
+ /** The source of the shipping_line. */
877
+ source: string;
878
+ /** The status the shipping_line. */
879
+ status?: 'active' | 'pending' | 'queued';
880
+ /** An array of tax lines associated with the shipping_line. */
881
+ tax_lines: TaxLine[];
882
+ /** A boolean indicating if the shipping_line is taxable. */
883
+ taxable: boolean;
884
+ /** The title of the shipping_line. */
885
+ title: string;
886
+ }
887
+ type OrderStatus = 'success' | 'error' | 'queued' | 'cancelled' | 'pending_charge_status';
888
+ type OrderType = 'checkout' | 'recurring';
889
+ interface Order {
890
+ /** The unique numeric identifier for the order. */
891
+ id: number;
892
+ /** The id of the associated Address within Recharge. */
893
+ address_id: number;
894
+ /** The billing address at the time the order was created. See Addresses for detailed address information. */
895
+ billing_address: AssociatedAddress;
896
+ /** An object containing parameters of the Charge. */
897
+ charge: {
898
+ /** The id of the charge associated with this order. */
899
+ id: number;
900
+ /** An object containing external transaction ids associated with this charge, as they appear in external platforms. */
901
+ external_transaction_id: ExternalTransactionId;
902
+ /** The name of the payment processor used for this charge. */
903
+ payment_processor_name: string;
904
+ /** The status of the charge. */
905
+ status: ChargeStatus | null;
1009
906
  };
1010
- blocksOrder?: string[];
1011
- };
1012
- type WidgetSchemaBlock = {
1013
- type: string;
1014
- settings: Settings;
1015
- };
1016
- type Settings = Record<string, string | number>;
907
+ /** Details of the access method used by the purchase. */
908
+ client_details: {
909
+ /** The IP address of the buyer as detected in Checkout. */
910
+ browser_ip: string | null;
911
+ /** The user agent detected during Checkout. */
912
+ user_agent: string | null;
913
+ };
914
+ /** The date when the order was created. */
915
+ created_at: IsoDateString;
916
+ /** The currency of the payment used to create the order. */
917
+ currency: string;
918
+ /** Object that contains information about the Customer. */
919
+ customer: {
920
+ /** The ID of the associated customer record. */
921
+ id: number;
922
+ /** The user email. */
923
+ email: string;
924
+ /** An object containing customer information associated with this charge. */
925
+ external_customer_id: ExternalId;
926
+ /** The hash of the Customer associated with the Charge. */
927
+ hash: string;
928
+ };
929
+ /** An array of Discounts associated with the Order. */
930
+ discounts: Discount[];
931
+ /** The cart token as it appears in an external system. */
932
+ external_cart_token: string | null;
933
+ /** An object containing external order ids. */
934
+ external_order_id?: ExternalId;
935
+ /** An object containing the external order numbers. */
936
+ external_order_number: ExternalId;
937
+ /** A boolean representing if this Order is generated from a prepaid purchase. */
938
+ is_prepaid?: boolean;
939
+ /** A list of line_item objects. */
940
+ line_items: LineItem[];
941
+ /** Notes associated with the Order. */
942
+ note: string | null;
943
+ /** An array of name value pairs of note attributes on the Order. */
944
+ order_attributes: Property[];
945
+ /** The date time that the associated charge was processed at. */
946
+ processed_at: IsoDateString | null;
947
+ /** The date time of when the associated charge is/was scheduled to process. */
948
+ scheduled_at: IsoDateString;
949
+ /** The shipping address where the order will be shipped. See Addresses for detailed Address information. */
950
+ shipping_address: AssociatedAddress;
951
+ /** An array of shipping lines associated with the order. */
952
+ shipping_lines: ShippingLine[];
953
+ /** The status of creating the Order. */
954
+ status: OrderStatus;
955
+ /** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
956
+ subtotal_price: string;
957
+ /** A comma separated list of tags on the Order. */
958
+ tags: string | null;
959
+ /** An array of tax lines that apply to the Order. */
960
+ tax_lines: TaxLine[];
961
+ /** A boolean indicator of the taxability of the Order. */
962
+ taxable: boolean;
963
+ /** The total discounted dollar value of the Order. */
964
+ total_discounts: string;
965
+ /** The total price of all line items of the Order. */
966
+ total_line_items_price: string;
967
+ /** The total amount due of the Order. */
968
+ total_price: string;
969
+ /** The total dollar amount of refunds associated with the Order. */
970
+ total_refunds: string;
971
+ /** The total tax due associated with the Order. */
972
+ total_tax: string;
973
+ /** The total weight of the order in grams. */
974
+ total_weight_grams: number;
975
+ /** An indicator of the order’s type. */
976
+ type: OrderType;
977
+ /** The date time at which the order was most recently updated. */
978
+ updated_at: IsoDateString;
979
+ /** Error information about the order if status is 'error' */
980
+ error: string | null;
981
+ /** Additional information as requested */
982
+ include?: {
983
+ address?: Address;
984
+ customer?: Customer;
985
+ metafields?: Metafield[];
986
+ subscriptions?: Subscription[];
987
+ };
988
+ }
989
+ type OrderIncludes = 'address' | 'customer' | 'metafields' | 'subscriptions';
990
+ interface GetOrderOptions {
991
+ include?: OrderIncludes[];
992
+ }
993
+ interface OrdersResponse {
994
+ next_cursor: null | string;
995
+ previous_cursor: null | string;
996
+ orders: Order[];
997
+ }
998
+ type OrderSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'processed_at-asc' | 'processed_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
999
+ interface OrderListParams extends ListParams<OrderSortBy> {
1000
+ /** Filter orders by address. */
1001
+ address_id?: string | number;
1002
+ /** Filter orders by charge. */
1003
+ charge_id?: string | number;
1004
+ /** Show orders created after the given date. */
1005
+ created_at_min?: IsoDateString;
1006
+ /** Show orders created before the given date. */
1007
+ created_at_max?: IsoDateString;
1008
+ /** Filter orders by external_order_id. */
1009
+ external_order_id?: string | number;
1010
+ /** Filter orders by id. */
1011
+ ids?: (string | number)[];
1012
+ /** Show orders scheduled before the given date. */
1013
+ scheduled_at_max?: IsoDateString;
1014
+ /** Show orders scheduled after the given date. */
1015
+ scheduled_at_min?: IsoDateString;
1016
+ /** Filter orders with/without external_order_id. */
1017
+ has_external_order?: boolean;
1018
+ /** Filter orders by status. */
1019
+ status?: OrderStatus;
1020
+ /** Filter orders by type. */
1021
+ type?: OrderType;
1022
+ /** Filter orders by subscription or onetime. */
1023
+ purchase_item_id?: string | number;
1024
+ /** Show orders updated before the given date. */
1025
+ updated_at_max?: IsoDateString;
1026
+ /** Show orders updated after the given date. */
1027
+ updated_at_min?: IsoDateString;
1028
+ /** Include related data options */
1029
+ include?: OrderIncludes[];
1030
+ }
1017
1031
 
1018
- interface AddonSettings {
1019
- collectionHandle: string;
1020
- collectionId: string;
1021
- enabled: boolean;
1032
+ interface PaymentDetails {
1033
+ /** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
1034
+ brand?: string;
1035
+ /** Payment_method expiry month. valid for CREDIT_CARD only. */
1036
+ exp_month?: number;
1037
+ /** Payment_method expiry year. valid for CREDIT_CARD only. */
1038
+ exp_year?: number;
1039
+ /** last 4-digits of the identifier. valid for CREDIT_CARD only. */
1040
+ last4?: string;
1041
+ /** email linked to paypal. valid for PAYPAL only. */
1042
+ paypal_email?: string;
1043
+ /** paypal user identifier. valid for PAYPAL only. */
1044
+ paypal_payer_id?: string;
1045
+ /** If a digital wallet. */
1046
+ wallet_type?: string;
1047
+ /** Type of funding for the Payment Method. */
1048
+ funding_type?: string;
1022
1049
  }
1023
- interface AddToCartCallbackSettings {
1024
- type: 'none' | 'callback' | 'redirect';
1025
- value: string;
1050
+ type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT' | 'IDEAL' | 'SHOP_PAY' | 'PAYPAL_EXPRESS' | 'SOFORT' | 'GIROPAY' | 'STORED_VALUE' | 'AMAZON_PAY' | 'INVOICE' | 'AFTERPAY_CLEARPAY' | 'KLARNA';
1051
+ type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie' | 'adyen' | 'shopify_app_subscription_billing' | 'frictionless';
1052
+ type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
1053
+ interface PaymentMethod {
1054
+ /** The unique payment method id for a customer. */
1055
+ id: number;
1056
+ /** An object with the customer’s address information. */
1057
+ billing_address: AssociatedAddress;
1058
+ /** The Recharge customer_id */
1059
+ customer_id: number;
1060
+ /** The time the payment method was created. */
1061
+ created_at: IsoDateString;
1062
+ /** If this is the default payment method for the customer */
1063
+ default: boolean;
1064
+ /** Details about the specific payment method */
1065
+ payment_details: PaymentDetails;
1066
+ /**
1067
+ * The type of payment this is.
1068
+ * If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
1069
+ */
1070
+ payment_type: PaymentType;
1071
+ /** The customer token at the processor. */
1072
+ processor_customer_token: string;
1073
+ /**
1074
+ * This will impact validation on billing_details.
1075
+ * Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
1076
+ */
1077
+ processor_name: ProcessorName;
1078
+ /** The payment token at the processor. */
1079
+ processor_payment_method_token: string;
1080
+ /** State of the Payment Method. */
1081
+ status: PaymentMethodStatus;
1082
+ /**
1083
+ * The status reason for the payment method.
1084
+ * Often used when invalid to provide background details in invalidity.
1085
+ */
1086
+ status_reason: string;
1087
+ /** The time the payment method was last updated. */
1088
+ updated_at: IsoDateString;
1089
+ /** The time the payment method was deleted. This is only included if `include_deleted` is true. */
1090
+ deleted_at?: IsoDateString;
1091
+ /** Additional information as requested */
1092
+ include?: {
1093
+ addresses?: Address[];
1094
+ customer?: Customer;
1095
+ };
1026
1096
  }
1027
- interface CrossSellsSettings {
1028
- collectionId: string;
1029
- collectionHandle: string;
1030
- enabled: boolean;
1031
- defaultPurchaseType?: 'subscription' | 'onetime';
1097
+ interface PaymentMethodsResponse {
1098
+ next_cursor: null | string;
1099
+ previous_cursor: null | string;
1100
+ payment_methods: PaymentMethod[];
1101
+ }
1102
+ type PaymentMethodRequiredCreateProps = 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token';
1103
+ type PaymentMethodOptionalCreateProps = 'default' | 'billing_address';
1104
+ interface CreatePaymentMethodRequest extends SubType<PaymentMethod, PaymentMethodRequiredCreateProps, PaymentMethodOptionalCreateProps> {
1105
+ /** Array of address ids the new payment methods should be associated to */
1106
+ address_ids?: number[];
1107
+ /** like “mandate_1O7lt8FHTwP5c651R…” */
1108
+ external_mandate_id?: string;
1109
+ /** The payment method intent id */
1110
+ payment_method_intent_id?: string;
1111
+ /** The external payment method id */
1112
+ external_payment_method_id?: string;
1113
+ /** Whether to apply the payment method to all existing subscription addresses, will override address_ids if true */
1114
+ apply_to_all_subscription_addresses?: boolean;
1032
1115
  }
1033
- interface StepSettingsCommon {
1034
- description?: string;
1035
- disable?: boolean;
1036
- index: string;
1037
- name: string;
1038
- title: string;
1116
+ interface UpdatePaymentMethodRequest extends Partial<Pick<PaymentMethod, 'billing_address' | 'default'>> {
1117
+ /** Whether to apply the payment method to all existing subscription addresses */
1118
+ apply_to_all_subscription_addresses?: boolean;
1039
1119
  }
1040
- type VariantSelector = {
1041
- optionsMeta: {
1042
- [key: string]: {
1043
- defaultImage: string;
1044
- content: string;
1045
- };
1046
- };
1047
- };
1048
- type StepSettingsTypes = 'variantSelector' | 'all-collections' | 'addons' | 'summary' | 'cross-sells';
1049
- type BundlePriceRule = 'fixed' | 'dynamic';
1050
- type VariantSelectorStepSetting = StepSettingsCommon & {
1051
- data?: VariantSelector;
1052
- type: 'variantSelector';
1053
- };
1054
- type StepSettings = StepSettingsCommon & {
1055
- data?: Record<string, unknown>;
1056
- type: Exclude<StepSettingsTypes, 'variantSelector'>;
1057
- };
1058
- interface MultiStepSettings {
1059
- optionImages: string;
1060
- steps: [VariantSelectorStepSetting, ...StepSettings[]];
1120
+ type PaymentMethodIncludes = 'addresses' | 'customer';
1121
+ interface GetPaymentMethodOptions {
1122
+ include?: PaymentMethodIncludes[];
1061
1123
  }
1062
- type BundleTemplateType = 'multi-step' | 'one-page' | 'custom' | 'none';
1063
- interface OnePageSettings {
1064
- frequencySelector: 'toggle' | 'dropdown';
1124
+ /** no sorting options for payment_methods, always by id-desc */
1125
+ type PaymentMethodSortBy = null;
1126
+ interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
1127
+ /** Return the payment_methods linked to the given processor_name. */
1128
+ processor_name?: ProcessorName;
1129
+ /** Return the payment_methods linked to the given address_id. */
1130
+ address_id?: string | number;
1131
+ /** Return the payment_methods linked to the given processor_payment_method_token. */
1132
+ processor_payment_method_token?: string;
1133
+ /** Include related data options */
1134
+ include?: PaymentMethodIncludes[];
1135
+ /** Include deleted payment methods */
1136
+ include_deleted?: boolean;
1065
1137
  }
1066
- interface BundleTemplateSettings {
1067
- multiStep?: MultiStepSettings;
1068
- onePage: OnePageSettings;
1138
+ interface BaseCardDetails {
1139
+ /** Expiration month (1-12 or '01'-'12') */
1140
+ month: string | number;
1141
+ /** Expiration year (YYYY or YY format) */
1142
+ year: string | number;
1069
1143
  }
1070
- type WidgetVisibility = {
1071
- signup: boolean;
1072
- portal: boolean;
1073
- };
1074
- interface BundleProductGlobalStyles {
1075
- global_aspect_ratio: string;
1076
- global_background: string;
1077
- global_body_font: string;
1078
- global_brand: string;
1079
- global_brand_secondary: string;
1080
- global_buttons_color: string;
1081
- global_cards_background: string;
1082
- global_cards_border: string;
1083
- global_corners: string;
1084
- global_page_width: string;
1085
- global_text_color: string;
1144
+ interface CardDetailsFirstNameLastName extends BaseCardDetails {
1145
+ /** First name on the card */
1146
+ first_name: string;
1147
+ /** Last name on the card */
1148
+ last_name: string;
1086
1149
  }
1087
- interface BundleProductLayoutSettings {
1088
- addons: AddonSettings;
1089
- addToCartCallback: AddToCartCallbackSettings;
1090
- collapsibleSections: boolean;
1091
- crossSells: CrossSellsSettings;
1092
- defaultFrequency: string;
1093
- defaultVariantId: string;
1094
- description: string;
1095
- filters: string[];
1096
- learnMoreModal: boolean;
1097
- published: boolean;
1098
- showStickyStatusBar: boolean;
1099
- showVariants: boolean;
1100
- template: BundleTemplateType;
1101
- templateSettings: BundleTemplateSettings;
1102
- title: string;
1103
- visibility: WidgetVisibility;
1104
- templates?: Record<string, number> | ViewsTemplateSchema | null;
1105
- globalStyles?: BundleProductGlobalStyles | null;
1150
+ interface CardDetailsFullName extends BaseCardDetails {
1151
+ /** Full name on the card */
1152
+ full_name: string;
1106
1153
  }
1107
- interface BundleVariantOptionSourceBase {
1108
- id: number;
1109
- quantity_max: number | null;
1110
- quantity_min: number | null;
1154
+ interface PaymentMethodFormOptions {
1155
+ /** Card holder details */
1156
+ card_details: CardDetailsFirstNameLastName | CardDetailsFullName;
1157
+ /** Billing address for the payment method */
1158
+ billing_address: AssociatedAddress;
1159
+ /** Whether to set this payment method as the default */
1160
+ default_payment_method?: boolean;
1161
+ /** Recharge address IDs to associate with this payment method */
1162
+ address_ids?: number[];
1163
+ /** Whether to apply the payment method to all existing subscription addresses, will override address_ids if true */
1164
+ apply_to_all_subscription_addresses?: boolean;
1111
1165
  }
1112
- /** Option source shape returned by the product endpoints (`productSearch`, product CDN). */
1113
- interface BundleVariantOptionSource extends BundleVariantOptionSourceBase {
1114
- collection_id: string;
1166
+ interface PaymentFormConfig {
1167
+ /** DOM element ID where the card number field will be mounted */
1168
+ numberElementId: string;
1169
+ /** DOM element ID where the CVV field will be mounted */
1170
+ cvvElementId: string;
1171
+ /** Optional css styles for the hosted fields (number and cvv) */
1172
+ styles?: string;
1173
+ /** Field type for the card number field, defaults to 'number' */
1174
+ numberFieldType?: spreedly.SpreedlyFieldType;
1175
+ /** Field type for the CVV field, defaults to 'number' */
1176
+ cvvFieldType?: spreedly.SpreedlyFieldType;
1177
+ /** Label for the card number field, defaults to 'Card Number' */
1178
+ numberLabel?: string;
1179
+ /** Label for the CVV field, defaults to 'CVV' */
1180
+ cvvLabel?: string;
1181
+ /** Placeholder text for card number field, default is empty string */
1182
+ numberPlaceholder?: string;
1183
+ /** Placeholder text for CVV field, default is empty string */
1184
+ cvvPlaceholder?: string;
1185
+ /**
1186
+ * Format for card number and CVV display
1187
+ * 'plainFormat' - default (no formatting)
1188
+ * 'prettyFormat' - adds spaces between groups of 4 digits, requires numberFieldType to be 'text' or 'tel'
1189
+ * 'maskedFormat' - masked via '*' no spaces, forces numberFieldType to 'text'
1190
+ */
1191
+ numberFormat?: 'plainFormat' | 'prettyFormat' | 'maskedFormat';
1115
1192
  }
1116
- /** Option source shape returned when a BundleProduct is included on a subscription (e.g. `getCustomer` with `include.subscriptions`). */
1117
- interface BundleVariantOptionSourceSubscription extends BundleVariantOptionSourceBase {
1118
- option_source_id: string;
1119
- source_platform: string;
1120
- position: number;
1121
- created_at: IsoDateString;
1122
- updated_at: IsoDateString;
1193
+ interface PaymentFieldEventCallback {
1194
+ (fieldName: spreedly.SpreedlyField, eventType: spreedly.SpreedlyFieldEventType, activeElement: spreedly.SpreedlyField, inputProperties: spreedly.SpreedlyFieldEventInputProperties): void;
1123
1195
  }
1124
- interface BundleVariantSelectionDefault {
1125
- id: number;
1126
- quantity: number;
1127
- external_variant_id: string;
1196
+ interface PaymentMethodTokenCallback {
1197
+ (token: string, paymentMethod: spreedly.SpreedlyPaymentMethod): void;
1128
1198
  }
1129
- interface BundleVariantRange {
1130
- id: number;
1131
- quantity_max: number | null;
1132
- quantity_min: number;
1133
- updated_at: IsoDateString;
1134
- created_at: IsoDateString;
1199
+ interface PaymentErrorCallback {
1200
+ (errors: spreedly.SpreedlyError[]): void;
1135
1201
  }
1136
- interface BundleVariant<T extends BundleVariantOptionSourceBase = BundleVariantOptionSource> {
1137
- enabled: boolean;
1138
- external_variant_id: string;
1139
- id: number;
1140
- items_count: number;
1141
- option_sources: T[];
1142
- position: number;
1143
- selection_defaults: BundleVariantSelectionDefault[];
1144
- title: string;
1145
- ranges: BundleVariantRange[];
1146
- updated_at: IsoDateString;
1147
- created_at: IsoDateString;
1202
+ interface PaymentFormEventHandlers {
1203
+ /** Called when the form is ready for input */
1204
+ onReady?: () => void;
1205
+ /** Called when a field event occurs */
1206
+ onFieldEvent?: PaymentFieldEventCallback;
1207
+ /** Called when a payment method token is received */
1208
+ onPaymentMethod?: PaymentMethodTokenCallback;
1209
+ /** Called when validation errors occur */
1210
+ onErrors?: PaymentErrorCallback;
1148
1211
  }
1149
- interface BundleProduct<T extends BundleVariantOptionSourceBase = BundleVariantOptionSource> {
1150
- created_at: IsoDateString;
1151
- custom_prices: boolean;
1152
- customization_window_disabled_message: string | null;
1153
- customization_window: number | null;
1154
- default_bundle_variant_id: number;
1155
- description: string | null;
1156
- external_product_id: string;
1157
- id: number;
1158
- is_customizable: boolean;
1159
- layout_settings: BundleProductLayoutSettings;
1160
- layout_settings_version: '2021-11';
1161
- max_quantity_per_variant: number | null;
1162
- price_rule: BundlePriceRule | null;
1163
- reset_box_contents: boolean;
1164
- title: string;
1165
- updated_at: IsoDateString;
1166
- variants: BundleVariant<T>[];
1167
- settings: {
1168
- display_variants_as_separate_products_in_list: boolean;
1169
- dynamic_filter_products_by_discount: boolean;
1170
- show_product_and_variant_name_in_products_list: boolean;
1171
- };
1172
- incentives: Incentives | null;
1212
+ interface PaymentFormController {
1213
+ /**
1214
+ * Initialize the payment form with the payment script
1215
+ * @param config - Configuration for the form
1216
+ * @param handlers - Event handlers for form events
1217
+ */
1218
+ mount(config: PaymentFormConfig, handlers?: PaymentFormEventHandlers): void;
1219
+ /**
1220
+ * Tokenize the current card data
1221
+ * This triggers the payment script to create a payment method token
1222
+ * @param cardDetails - Card holder name and expiration
1223
+ */
1224
+ tokenize(cardDetails: CardDetailsFirstNameLastName | CardDetailsFullName): void;
1225
+ /**
1226
+ * Submit the tokenized payment method to Recharge, will not tokenize the card data again if tokenize has already been called
1227
+ * @param options - Payment method options including billing address
1228
+ * @returns Result of the submission
1229
+ */
1230
+ submit(options: PaymentMethodFormOptions): Promise<PaymentMethod>;
1231
+ /**
1232
+ * Reset the form fields
1233
+ */
1234
+ reset(): void;
1235
+ /**
1236
+ * Clean up and remove event handlers
1237
+ */
1238
+ unmount(): void;
1239
+ /**
1240
+ * Add event handlers to the form
1241
+ * @param handlers - The event handlers to add
1242
+ */
1243
+ addEventHandlers(handlers: PaymentFormEventHandlers): void;
1244
+ /**
1245
+ * Remove all event handlers currently registered via mount
1246
+ */
1247
+ removeHandlers(): void;
1248
+ /**
1249
+ * Set the field type for a field
1250
+ * @param name - The name of the field
1251
+ * @param type - The type of the field
1252
+ */
1253
+ setFieldType(name: spreedly.SpreedlyField, type: spreedly.SpreedlyFieldType): void;
1254
+ /**
1255
+ * Set the label for a field
1256
+ * @param name - The name of the field
1257
+ * @param label - The label for the field
1258
+ */
1259
+ setLabel(name: spreedly.SpreedlyField, label: string): void;
1260
+ /**
1261
+ * Set the number format for the form
1262
+ * @param format - The number format
1263
+ */
1264
+ setNumberFormat(format: 'plainFormat' | 'prettyFormat' | 'maskedFormat'): void;
1265
+ /**
1266
+ * Set the placeholder for a field
1267
+ * @param name - The name of the field
1268
+ * @param placeholder - The placeholder for the field
1269
+ */
1270
+ setPlaceholder(name: spreedly.SpreedlyField, placeholder: string): void;
1271
+ /**
1272
+ * Set the style for a field
1273
+ * @param name - The name of the field
1274
+ * @param style - The css string to apply to the field
1275
+ */
1276
+ setStyle(name: spreedly.SpreedlyField, style: string): void;
1173
1277
  }
1174
1278
 
1175
- interface BundleSelectionAppProxy {
1176
- collectionId: string;
1177
- externalProductId: string;
1178
- externalVariantId: string;
1179
- quantity: number;
1180
- sellingPlan?: number;
1181
- shippingIntervalFrequency?: number;
1182
- shippingIntervalUnitType?: IntervalUnit;
1183
- discountedVariantId?: number;
1184
- }
1185
- interface BundleAppProxy {
1186
- externalVariantId: string;
1187
- externalProductId: string;
1188
- selections: BundleSelectionAppProxy[];
1279
+ type CustomerNotification = 'SHOPIFY_UPDATE_PAYMENT_INFO' | 'SHOPIFY_MIGRATE_PAYMENT_INFO';
1280
+ type CustomerNotificationType = 'email' | 'sms';
1281
+ type CustomerNotificationTemplate = 'shopify_update_payment_information' | 'shopify_migrate_payment_information';
1282
+ type CustomerNotificationOptions<T extends CustomerNotification> = T extends CustomerNotification ? ShopifyUpdatePaymentInfoOptions : never;
1283
+ interface ShopifyUpdatePaymentInfoOptions {
1284
+ address_id?: string | number;
1285
+ payment_method_id?: string | number;
1286
+ include_deleted?: boolean;
1189
1287
  }
1190
- interface DynamicBundlePropertiesAppProxy {
1191
- _rc_bundle: string;
1192
- _rc_bundle_variant: string;
1193
- _rc_bundle_parent: string;
1194
- _rc_bundle_collection_id: string;
1195
- shipping_interval_frequency?: number;
1196
- shipping_interval_unit_type?: IntervalUnit;
1288
+ interface ReferralUrl {
1289
+ slug: string;
1290
+ url: string;
1197
1291
  }
1198
- interface DynamicBundleItemAppProxy {
1199
- id: string;
1200
- properties: DynamicBundlePropertiesAppProxy;
1201
- quantity: number;
1202
- selling_plan?: number;
1292
+ interface ReferralInfo {
1293
+ referral_url: ReferralUrl;
1203
1294
  }
1204
- interface BundleSelectionItem {
1205
- /** The unique numeric identifier for the item selection. */
1295
+ interface Announcement {
1206
1296
  id: number;
1207
- /** The collection id as it appears in the external e-commerce platform. */
1208
- collection_id: string;
1209
- /** The identifier of the external e-commerce platform. */
1210
- collection_source: 'shopify';
1211
- /** The date and time when this item was selected. */
1297
+ customer_id: number;
1298
+ flow_id: number;
1212
1299
  created_at: IsoDateString;
1213
- /** 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. */
1214
- external_product_id: string;
1215
- /** 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. */
1216
- external_variant_id: string;
1217
- /** The quantity of this product. */
1218
- quantity: number;
1219
- /** The price of this product. */
1220
- price: string;
1221
- /** The date and time at which the item selection was most recently updated. */
1222
1300
  updated_at: IsoDateString;
1301
+ view_schema: Record<string, unknown>;
1223
1302
  }
1224
- interface BundleSelection {
1225
- /** The unique numeric identifier for the BundleSelection. */
1303
+ /**
1304
+ * Gift purchase data from customer includes.
1305
+ * Returned when using `include: ['gift_purchases']` with `getCustomer()`.
1306
+ */
1307
+ interface CustomerIncludeGiftPurchase {
1226
1308
  id: number;
1227
- /** The ID of the BundleVariant associated with the BundleSelection. */
1228
- bundle_variant_id: number;
1229
- /** The ID of the PurchaseItem associated with the BundleSelection. */
1230
- purchase_item_id: number;
1231
- /** The date and time when the contents were selected. */
1309
+ amount: number;
1232
1310
  created_at: IsoDateString;
1233
- /** 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. */
1234
- external_product_id: string;
1235
- /** 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. */
1236
- external_variant_id: string;
1237
- is_fallback: boolean;
1238
- charge_id: number | null;
1239
- order_id: number | null;
1240
- items: BundleSelectionItem[];
1241
- /** The date and time at which the BundleSelection was most recently updated. */
1242
- updated_at: IsoDateString;
1243
- }
1244
- type BundleSelectionItemRequiredCreateProps = 'collection_id' | 'collection_source' | 'external_product_id' | 'external_variant_id' | 'quantity';
1245
- interface CreateBundleSelectionRequest {
1246
- purchase_item_id: number;
1247
- plan_id?: number;
1248
- items: Pick<BundleSelectionItem, BundleSelectionItemRequiredCreateProps>[];
1249
- }
1250
- interface UpdateBundleSelectionRequest extends CreateBundleSelectionRequest {
1251
- }
1252
- interface BundleSelectionsResponse {
1253
- next_cursor: null | string;
1254
- previous_cursor: null | string;
1255
- bundle_selections: BundleSelection[];
1256
- }
1257
- type BundleSelectionsSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
1258
- interface BundleSelectionListParams extends ListParams<BundleSelectionsSortBy> {
1259
- /** Filter BundleSelections by Subscription or Onetime ID. */
1260
- purchase_item_ids?: (string | number)[];
1261
- /** Filter BundleSelections by BundleVariants. */
1262
- bundle_variant_ids?: (string | number)[];
1263
- }
1264
- interface UpdateBundlePurchaseItem extends UpdateSubscriptionRequest {
1265
- external_product_id: {
1266
- ecommerce: string;
1267
- };
1268
- external_variant_id: {
1311
+ deleted_at: IsoDateString | null;
1312
+ external_redeemable_product_ids: Array<{
1269
1313
  ecommerce: string;
1270
- };
1271
- plan_id?: number;
1272
- items: Pick<BundleSelectionItem, BundleSelectionItemRequiredCreateProps>[];
1273
- }
1274
- type BundlePurchaseItem = Subscription & {
1275
- items: BundleSelectionItem[];
1276
- };
1277
- interface BundlePurchaseItemParams {
1278
- commit?: boolean;
1279
- }
1280
- /** @internal */
1281
- interface BaseProductVariant {
1282
- id: number;
1283
- title: string;
1284
- price: number;
1285
- compare_at_price: number | null;
1286
- options: string[];
1287
- available: boolean;
1314
+ }>;
1315
+ gift_credit_account_id: number;
1316
+ gift_currency: string;
1317
+ gift_external_product_id: string;
1318
+ gift_external_variant_id: string;
1319
+ gift_note: string;
1320
+ notification_scheduled_at: IsoDateString;
1321
+ notification_sent_at: IsoDateString;
1322
+ recipient_customer_id: number;
1323
+ redeemable_collection_id: number | null;
1324
+ redeemable_external_product_id: string;
1325
+ redeemed_at: IsoDateString | null;
1326
+ redemption_link: string;
1327
+ sender_customer_id: number;
1328
+ sender_external_order_id: string;
1329
+ sender_name: string;
1330
+ store_id: number;
1331
+ updated_at: IsoDateString;
1332
+ /** Optional fields from internal gift purchases schema */
1333
+ template?: Record<string, unknown> | null;
1334
+ validation_errors?: string[] | null;
1288
1335
  }
1289
- interface BundleDataCollectionProductVariant extends BaseProductVariant {
1290
- handle: string;
1291
- sku: string;
1292
- requires_shipping: boolean;
1293
- taxable: boolean;
1294
- featured_image: string | null;
1295
- public_title: string | null;
1296
- requires_selling_plan: boolean;
1297
- selling_plan_allocations: {
1298
- selling_plan_id: number;
1299
- selling_plan_group_id: string;
1300
- price: number;
1301
- compare_at_price: number | null;
1302
- }[];
1303
- option1: string;
1304
- option2: string | null;
1305
- option3: string | null;
1336
+ type CustomerIncludes = 'addresses' | 'announcements' | 'gift_purchases' | 'memberships' | 'metafields' | 'payment_methods' | 'punch_card_progress' | 'referral_info' | 'subscriptions';
1337
+ interface GetCustomerOptions {
1338
+ include?: CustomerIncludes[];
1306
1339
  }
1307
- /** @internal */
1308
- interface BaseProduct {
1340
+ interface Customer {
1341
+ /** Unique numeric identifier for the Customer. */
1309
1342
  id: number;
1310
- title: string;
1311
- description: string | null;
1312
- available: boolean;
1313
- featured_image: string | null;
1314
- images: string[];
1315
- requires_selling_plan: boolean;
1316
- selling_plan_groups: SellingPlanGroup$1[];
1343
+ /** An object containing analytics data associated with the customer. */
1344
+ analytics_data: AnalyticsData;
1345
+ /** A boolean that indicates whether Recharge credits will be applied to the next checkout charge */
1346
+ apply_credit_to_next_checkout_charge: boolean;
1347
+ /** A boolean that indicates whether Recharge credits will be applied to the next recurring charge */
1348
+ apply_credit_to_next_recurring_charge: boolean;
1349
+ /** A string that indicates which channel `apply_credit_to_next_recurring_charge` was set */
1350
+ apply_credit_to_next_recurring_charge_channel?: string;
1351
+ /** Backup payment methods enabled */
1352
+ backup_payment_methods_enabled: boolean | null;
1353
+ /** Whether the customer can add a payment method */
1354
+ can_add_payment_method: boolean;
1355
+ /** The date and time when the customer was created. */
1356
+ created_at: IsoDateString;
1357
+ /** The email address of the customer. */
1358
+ email: string;
1359
+ /** An object containing external ids for the customer record. */
1360
+ external_customer_id: ExternalId;
1361
+ /** Date when first charge was processed for the customer. */
1362
+ first_charge_processed_at: IsoDateString;
1363
+ /** The customer’s first name. */
1364
+ first_name: string;
1365
+ /** A boolean that indicates if the customer has a payment method that is in dunning (failed charge). */
1366
+ has_payment_method_in_dunning: boolean;
1367
+ /** Is the payment method valid or not. */
1368
+ has_valid_payment_method: boolean;
1369
+ /** The unique string identifier used in a customers portal link. */
1370
+ hash: string;
1371
+ /** The customer’s last name. */
1372
+ last_name: string;
1373
+ /** Disable payment method fallback on failure */
1374
+ payment_method_fallback_on_failure_disabled: boolean;
1375
+ /** The customer's phone number */
1376
+ phone: string | null;
1377
+ /** The customer's lifetime value total amount, converted to the store's default currency. */
1378
+ recharge_lifetime_value_total_amount_store_default_currency: string;
1379
+ /** The number of consecutive subscription-related charges processed for this customer, while they retain at least one active subscription. When all subscriptions for this customer are cancelled or expired, this value will reset to zero. */
1380
+ subscription_related_charge_streak: number;
1381
+ /** The number of active subscriptions on addresses associated with the customer. */
1382
+ subscriptions_active_count: number;
1383
+ /** The total number of subscriptions created on addresses associated with the customer. */
1384
+ subscriptions_total_count: number;
1385
+ /** Whether the customer is tax exempt or not */
1386
+ tax_exempt: boolean;
1387
+ /** The total number of charges that have been successfully processed for this customer. */
1388
+ total_processed_charge_count: number;
1389
+ /** The date and time when the customer was last updated. */
1390
+ updated_at: IsoDateString;
1391
+ /** Additional information as requested */
1392
+ include?: {
1393
+ addresses?: Address[];
1394
+ announcements?: Announcement[];
1395
+ gift_purchases?: CustomerIncludeGiftPurchase[];
1396
+ memberships?: Membership[];
1397
+ metafields?: Metafield[];
1398
+ payment_methods?: PaymentMethod[];
1399
+ punch_card_progress?: PunchCardProgress;
1400
+ subscriptions?: Subscription[];
1401
+ referral_info?: ReferralInfo;
1402
+ };
1317
1403
  }
1318
- interface BundleDataCollectionProduct extends BaseProduct {
1319
- handle: string;
1320
- tags: string[];
1321
- options: string[];
1322
- variants: BundleDataCollectionProductVariant[];
1323
- compare_at_price_max: number;
1324
- compare_at_price_min: number;
1325
- price_max: number;
1326
- price_min: number;
1404
+ interface PunchCardProgressData {
1405
+ punch_card_order_count: number;
1406
+ punch_card_total_order_value: number;
1407
+ punch_item_states: string[];
1327
1408
  }
1328
- interface AddonProduct$1 extends BaseProduct {
1329
- price: number;
1330
- compare_at_price: number | null;
1331
- options: {
1332
- name: string;
1333
- position: number;
1334
- values: string[];
1335
- }[];
1336
- variants: ({
1337
- image: string;
1338
- selling_plan_allocations: {
1339
- selling_plan_group_id: string;
1340
- selling_plan: SellingPlan$1;
1341
- price: number;
1342
- compare_at_price: number | null;
1343
- }[];
1344
- } & BaseProductVariant)[];
1409
+ type PunchCardProgress = Record<number, PunchCardProgressData>;
1410
+ interface UpdateCustomerRequest extends Partial<Pick<Customer, 'email' | 'first_name' | 'last_name' | 'external_customer_id' | 'apply_credit_to_next_recurring_charge' | 'apply_credit_to_next_recurring_charge_channel' | 'phone' | 'backup_payment_methods_enabled' | 'payment_method_fallback_on_failure_disabled'>> {
1345
1411
  }
1346
- interface BundleDataCollection$1 {
1347
- id: number;
1348
- handle: string;
1349
- title: string;
1350
- products: BundleDataCollectionProduct[];
1412
+ interface CustomerDeliveryScheduleParams {
1413
+ delivery_count_future?: number;
1414
+ future_internal?: number;
1415
+ date_max?: IsoDateString;
1351
1416
  }
1352
- interface SellingPlan$1 {
1353
- id: number;
1354
- name: string;
1355
- options: {
1356
- name: string;
1357
- position: number;
1358
- value: string;
1359
- }[];
1360
- recurring_deliveries: boolean;
1361
- price_adjustments: {
1362
- value_type: 'percentage' | 'fixed_amount' | 'price';
1363
- value: number;
1364
- }[];
1417
+ interface DeliveryLineItem extends 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'> {
1418
+ /** Value is set to true if it is not a onetime or a prepaid item */
1419
+ is_skippable: boolean;
1420
+ /** Value is set to true if the order is skipped. */
1421
+ is_skipped: boolean;
1422
+ /** The type of the plan. May return null value in certain cases. */
1423
+ plan_type: PlanType;
1424
+ /** Value is set to true if it is a prepaid item */
1425
+ is_prepaid: boolean;
1426
+ /** The name of the product in a store’s catalog. */
1427
+ product_title: string;
1428
+ /** Unique numeric identifier for the subscription linked to this line_item in the order. */
1429
+ subscription_id: number;
1430
+ /** The total price of the line item, before discounts. */
1431
+ original_price: string;
1432
+ /** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
1433
+ subtotal_price: string;
1365
1434
  }
1366
- interface SellingPlanGroup$1 {
1367
- id: string;
1368
- name: string;
1369
- options: {
1370
- name: string;
1371
- values: string[];
1372
- }[];
1373
- selling_plans: SellingPlan$1[];
1435
+ interface DeliveryPaymentMethod extends Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'payment_details' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> {
1436
+ payment_details: PaymentDetails | null;
1437
+ payment_type: PaymentType;
1438
+ billing_address: AssociatedAddress;
1374
1439
  }
1375
- type FilterMatchMode = 'all' | 'any';
1376
- type FilterSource = 'tag' | string;
1377
- type FilterInputType = 'checkbox' | string;
1378
- interface BundleFilterGroup {
1379
- key?: string;
1380
- name: string;
1381
- source: FilterSource;
1382
- type: FilterInputType;
1383
- match: FilterMatchMode | string;
1384
- options: string[];
1440
+ interface DeliveryOrder {
1441
+ address_id: number;
1442
+ charge_id: number | null;
1443
+ currency: string;
1444
+ has_uncommitted_changes: boolean;
1445
+ id: number | null;
1446
+ line_items: DeliveryLineItem[];
1447
+ order_subtotal: string;
1448
+ payment_method: DeliveryPaymentMethod;
1449
+ shipping_address: AssociatedAddress;
1450
+ shipping_lines: ShippingLine[];
1451
+ total_discounts: string | null;
1452
+ total_duties: string | null;
1453
+ total_price: string;
1454
+ total_tax: string | null;
1385
1455
  }
1386
- interface BundleData {
1387
- id: number;
1388
- handle: string;
1389
- title: string;
1390
- description: string | null;
1391
- collections: Record<string, BundleDataCollection$1>;
1392
- options: {
1393
- name: string;
1394
- position: number;
1395
- values: string[];
1396
- }[];
1397
- available: boolean;
1398
- requires_selling_plan: boolean;
1399
- selling_plan_groups: SellingPlanGroup$1[];
1400
- bundle_settings: {
1401
- settings: {
1402
- display_variants_as_separate_products_in_list: boolean;
1403
- dynamic_filter_products_by_discount: boolean;
1404
- show_product_and_variant_name_in_products_list: boolean;
1405
- };
1406
- max_quantity_per_variant: BundleProduct['max_quantity_per_variant'];
1407
- is_customizable: BundleProduct['is_customizable'];
1408
- default_bundle_variant_id: BundleProduct['default_bundle_variant_id'];
1409
- price_rule: BundleProduct['price_rule'];
1410
- customization_window: BundleProduct['customization_window'];
1411
- customization_window_disabled_message: BundleProduct['customization_window_disabled_message'];
1412
- layout_settings: Pick<BundleProduct['layout_settings'], 'addons' | 'crossSells' | 'defaultFrequency' | 'collapsibleSections' | 'showVariants' | 'learnMoreModal' | 'addToCartCallback' | 'templates' | 'globalStyles'> & Partial<Pick<BundleProduct['layout_settings'], 'defaultVariantId'>>;
1413
- variants: {
1414
- ranges: BundleProduct['variants'][number]['ranges'];
1415
- enabled: BundleProduct['variants'][number]['enabled'];
1416
- items_count: BundleProduct['variants'][number]['items_count'];
1417
- external_variant_id: BundleProduct['variants'][number]['external_variant_id'];
1418
- selection_defaults: ({
1419
- sku: string;
1420
- handle: string;
1421
- product: {
1422
- id: number;
1423
- title: string;
1424
- description: string;
1425
- images: string[];
1426
- };
1427
- variant: {
1428
- id: number;
1429
- title: string;
1430
- featured_image: string | null;
1431
- sku: string;
1432
- };
1433
- } & BundleProduct['variants'][number]['selection_defaults'][number])[];
1434
- option_sources: BundleVariantOptionSourceSubscription[];
1435
- }[];
1436
- };
1437
- incentives: Incentives;
1438
- variants: {
1456
+ interface Delivery {
1457
+ date: IsoDateString;
1458
+ orders: DeliveryOrder[];
1459
+ }
1460
+ interface CustomerDeliveryScheduleResponse {
1461
+ customer: {
1439
1462
  id: number;
1440
- title: string;
1441
- price: number;
1442
- compare_at_price: number | null;
1443
- image: string | null;
1444
- available: boolean;
1445
- options: string[];
1446
- requires_selling_plan: boolean;
1447
- selling_plan_allocations: {
1448
- price: number;
1449
- compare_at_price: number | null;
1450
- selling_plan: SellingPlan$1;
1451
- }[];
1452
- }[];
1453
- addons: {
1454
- products: AddonProduct$1[];
1455
- };
1456
- cross_sells: {
1457
- products: BundleDataCollectionProduct[];
1463
+ email: string;
1464
+ first_name: string;
1465
+ last_name: string;
1458
1466
  };
1459
- filters: BundleFilterGroup[];
1467
+ deliveries: Delivery[];
1468
+ }
1469
+ interface CustomerPortalAccessOptions {
1470
+ page_destination?: 'subscriptions' | 'delivery_schedule' | 'orders' | 'shipping' | 'payment_methods' | 'overview';
1471
+ locale?: string;
1472
+ region_country?: string;
1473
+ }
1474
+ interface CustomerPortalAccessResponse {
1475
+ /** base URL for customer portal */
1476
+ base_url: string;
1477
+ /** customer hash */
1478
+ customer_hash: string;
1479
+ /** Time when token expires */
1480
+ expires_at: IsoDateString;
1481
+ /** Full customer portal URL with token */
1482
+ portal_url: string;
1483
+ /** Token for use with customer portal */
1484
+ temp_token: string;
1460
1485
  }
1461
1486
 
1462
1487
  interface CustomerEntitlement {
@@ -1808,211 +1833,291 @@ interface SubscriptionPricingPreview {
1808
1833
  errors: Record<string, string> | null;
1809
1834
  }
1810
1835
 
1811
- type CustomerNotification = 'SHOPIFY_UPDATE_PAYMENT_INFO' | 'SHOPIFY_MIGRATE_PAYMENT_INFO';
1812
- type CustomerNotificationType = 'email' | 'sms';
1813
- type CustomerNotificationTemplate = 'shopify_update_payment_information' | 'shopify_migrate_payment_information';
1814
- type CustomerNotificationOptions<T extends CustomerNotification> = T extends CustomerNotification ? ShopifyUpdatePaymentInfoOptions : never;
1815
- interface ShopifyUpdatePaymentInfoOptions {
1816
- address_id?: string | number;
1817
- payment_method_id?: string | number;
1818
- include_deleted?: boolean;
1836
+ interface BundleSelectionAppProxy {
1837
+ collectionId: string;
1838
+ externalProductId: string;
1839
+ externalVariantId: string;
1840
+ quantity: number;
1841
+ sellingPlan?: number;
1842
+ shippingIntervalFrequency?: number;
1843
+ shippingIntervalUnitType?: IntervalUnit;
1844
+ discountedVariantId?: number;
1819
1845
  }
1820
- interface ReferralUrl {
1821
- slug: string;
1822
- url: string;
1846
+ interface BundleAppProxy {
1847
+ externalVariantId: string;
1848
+ externalProductId: string;
1849
+ selections: BundleSelectionAppProxy[];
1823
1850
  }
1824
- interface ReferralInfo {
1825
- referral_url: ReferralUrl;
1851
+ interface DynamicBundlePropertiesAppProxy {
1852
+ _rc_bundle: string;
1853
+ _rc_bundle_variant: string;
1854
+ _rc_bundle_parent: string;
1855
+ _rc_bundle_collection_id: string;
1856
+ shipping_interval_frequency?: number;
1857
+ shipping_interval_unit_type?: IntervalUnit;
1826
1858
  }
1827
- interface Announcement {
1859
+ interface DynamicBundleItemAppProxy {
1860
+ id: string;
1861
+ properties: DynamicBundlePropertiesAppProxy;
1862
+ quantity: number;
1863
+ selling_plan?: number;
1864
+ }
1865
+ interface BundleSelectionItem {
1866
+ /** The unique numeric identifier for the item selection. */
1828
1867
  id: number;
1829
- customer_id: number;
1830
- flow_id: number;
1868
+ /** The collection id as it appears in the external e-commerce platform. */
1869
+ collection_id: string;
1870
+ /** The identifier of the external e-commerce platform. */
1871
+ collection_source: 'shopify';
1872
+ /** The date and time when this item was selected. */
1831
1873
  created_at: IsoDateString;
1874
+ /** 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. */
1875
+ external_product_id: string;
1876
+ /** 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. */
1877
+ external_variant_id: string;
1878
+ /** The quantity of this product. */
1879
+ quantity: number;
1880
+ /** The price of this product. */
1881
+ price: string;
1882
+ /** The date and time at which the item selection was most recently updated. */
1832
1883
  updated_at: IsoDateString;
1833
- view_schema: Record<string, unknown>;
1834
1884
  }
1835
- /**
1836
- * Gift purchase data from customer includes.
1837
- * Returned when using `include: ['gift_purchases']` with `getCustomer()`.
1838
- */
1839
- interface CustomerIncludeGiftPurchase {
1885
+ interface BundleSelection {
1886
+ /** The unique numeric identifier for the BundleSelection. */
1840
1887
  id: number;
1841
- amount: number;
1888
+ /** The ID of the BundleVariant associated with the BundleSelection. */
1889
+ bundle_variant_id: number;
1890
+ /** The ID of the PurchaseItem associated with the BundleSelection. */
1891
+ purchase_item_id: number;
1892
+ /** The date and time when the contents were selected. */
1842
1893
  created_at: IsoDateString;
1843
- deleted_at: IsoDateString | null;
1844
- external_redeemable_product_ids: Array<{
1845
- ecommerce: string;
1846
- }>;
1847
- gift_credit_account_id: number;
1848
- gift_currency: string;
1849
- gift_external_product_id: string;
1850
- gift_external_variant_id: string;
1851
- gift_note: string;
1852
- notification_scheduled_at: IsoDateString;
1853
- notification_sent_at: IsoDateString;
1854
- recipient_customer_id: number;
1855
- redeemable_collection_id: number | null;
1856
- redeemable_external_product_id: string;
1857
- redeemed_at: IsoDateString | null;
1858
- redemption_link: string;
1859
- sender_customer_id: number;
1860
- sender_external_order_id: string;
1861
- sender_name: string;
1862
- store_id: number;
1894
+ /** 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. */
1895
+ external_product_id: string;
1896
+ /** 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. */
1897
+ external_variant_id: string;
1898
+ is_fallback: boolean;
1899
+ charge_id: number | null;
1900
+ order_id: number | null;
1901
+ items: BundleSelectionItem[];
1902
+ /** The date and time at which the BundleSelection was most recently updated. */
1863
1903
  updated_at: IsoDateString;
1864
- /** Optional fields from internal gift purchases schema */
1865
- template?: Record<string, unknown> | null;
1866
- validation_errors?: string[] | null;
1867
1904
  }
1868
- type CustomerIncludes = 'addresses' | 'announcements' | 'gift_purchases' | 'metafields' | 'payment_methods' | 'punch_card_progress' | 'referral_info' | 'subscriptions';
1869
- interface GetCustomerOptions {
1870
- include?: CustomerIncludes[];
1905
+ type BundleSelectionItemRequiredCreateProps = 'collection_id' | 'collection_source' | 'external_product_id' | 'external_variant_id' | 'quantity';
1906
+ interface CreateBundleSelectionRequest {
1907
+ purchase_item_id: number;
1908
+ plan_id?: number;
1909
+ items: Pick<BundleSelectionItem, BundleSelectionItemRequiredCreateProps>[];
1871
1910
  }
1872
- interface Customer {
1873
- /** Unique numeric identifier for the Customer. */
1874
- id: number;
1875
- /** An object containing analytics data associated with the customer. */
1876
- analytics_data: AnalyticsData;
1877
- /** A boolean that indicates whether Recharge credits will be applied to the next checkout charge */
1878
- apply_credit_to_next_checkout_charge: boolean;
1879
- /** A boolean that indicates whether Recharge credits will be applied to the next recurring charge */
1880
- apply_credit_to_next_recurring_charge: boolean;
1881
- /** A string that indicates which channel `apply_credit_to_next_recurring_charge` was set */
1882
- apply_credit_to_next_recurring_charge_channel?: string;
1883
- /** Backup payment methods enabled */
1884
- backup_payment_methods_enabled: boolean | null;
1885
- /** Whether the customer can add a payment method */
1886
- can_add_payment_method: boolean;
1887
- /** The date and time when the customer was created. */
1888
- created_at: IsoDateString;
1889
- /** The email address of the customer. */
1890
- email: string;
1891
- /** An object containing external ids for the customer record. */
1892
- external_customer_id: ExternalId;
1893
- /** Date when first charge was processed for the customer. */
1894
- first_charge_processed_at: IsoDateString;
1895
- /** The customer’s first name. */
1896
- first_name: string;
1897
- /** A boolean that indicates if the customer has a payment method that is in dunning (failed charge). */
1898
- has_payment_method_in_dunning: boolean;
1899
- /** Is the payment method valid or not. */
1900
- has_valid_payment_method: boolean;
1901
- /** The unique string identifier used in a customers portal link. */
1902
- hash: string;
1903
- /** The customer’s last name. */
1904
- last_name: string;
1905
- /** Disable payment method fallback on failure */
1906
- payment_method_fallback_on_failure_disabled: boolean;
1907
- /** The customer's phone number */
1908
- phone: string | null;
1909
- /** The customer's lifetime value total amount, converted to the store's default currency. */
1910
- recharge_lifetime_value_total_amount_store_default_currency: string;
1911
- /** The number of consecutive subscription-related charges processed for this customer, while they retain at least one active subscription. When all subscriptions for this customer are cancelled or expired, this value will reset to zero. */
1912
- subscription_related_charge_streak: number;
1913
- /** The number of active subscriptions on addresses associated with the customer. */
1914
- subscriptions_active_count: number;
1915
- /** The total number of subscriptions created on addresses associated with the customer. */
1916
- subscriptions_total_count: number;
1917
- /** Whether the customer is tax exempt or not */
1918
- tax_exempt: boolean;
1919
- /** The total number of charges that have been successfully processed for this customer. */
1920
- total_processed_charge_count: number;
1921
- /** The date and time when the customer was last updated. */
1922
- updated_at: IsoDateString;
1923
- /** Additional information as requested */
1924
- include?: {
1925
- addresses?: Address[];
1926
- announcements?: Announcement[];
1927
- gift_purchases?: CustomerIncludeGiftPurchase[];
1928
- metafields?: Metafield[];
1929
- payment_methods?: PaymentMethod[];
1930
- punch_card_progress?: PunchCardProgress;
1931
- subscriptions?: Subscription[];
1932
- referral_info?: ReferralInfo;
1911
+ interface UpdateBundleSelectionRequest extends CreateBundleSelectionRequest {
1912
+ }
1913
+ interface BundleSelectionsResponse {
1914
+ next_cursor: null | string;
1915
+ previous_cursor: null | string;
1916
+ bundle_selections: BundleSelection[];
1917
+ }
1918
+ type BundleSelectionsSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
1919
+ interface BundleSelectionListParams extends ListParams<BundleSelectionsSortBy> {
1920
+ /** Filter BundleSelections by Subscription or Onetime ID. */
1921
+ purchase_item_ids?: (string | number)[];
1922
+ /** Filter BundleSelections by BundleVariants. */
1923
+ bundle_variant_ids?: (string | number)[];
1924
+ }
1925
+ interface UpdateBundlePurchaseItem extends UpdateSubscriptionRequest {
1926
+ external_product_id: {
1927
+ ecommerce: string;
1928
+ };
1929
+ external_variant_id: {
1930
+ ecommerce: string;
1933
1931
  };
1932
+ plan_id?: number;
1933
+ items: Pick<BundleSelectionItem, BundleSelectionItemRequiredCreateProps>[];
1934
1934
  }
1935
- interface PunchCardProgressData {
1936
- punch_card_order_count: number;
1937
- punch_card_total_order_value: number;
1938
- punch_item_states: string[];
1935
+ type BundlePurchaseItem = Subscription & {
1936
+ items: BundleSelectionItem[];
1937
+ };
1938
+ interface BundlePurchaseItemParams {
1939
+ commit?: boolean;
1939
1940
  }
1940
- type PunchCardProgress = Record<number, PunchCardProgressData>;
1941
- interface UpdateCustomerRequest extends Partial<Pick<Customer, 'email' | 'first_name' | 'last_name' | 'external_customer_id' | 'apply_credit_to_next_recurring_charge' | 'apply_credit_to_next_recurring_charge_channel' | 'phone' | 'backup_payment_methods_enabled' | 'payment_method_fallback_on_failure_disabled'>> {
1941
+ /** @internal */
1942
+ interface BaseProductVariant {
1943
+ id: number;
1944
+ title: string;
1945
+ price: number;
1946
+ compare_at_price: number | null;
1947
+ options: string[];
1948
+ available: boolean;
1942
1949
  }
1943
- interface CustomerDeliveryScheduleParams {
1944
- delivery_count_future?: number;
1945
- future_internal?: number;
1946
- date_max?: IsoDateString;
1950
+ interface BundleDataCollectionProductVariant extends BaseProductVariant {
1951
+ handle: string;
1952
+ sku: string;
1953
+ requires_shipping: boolean;
1954
+ taxable: boolean;
1955
+ featured_image: string | null;
1956
+ public_title: string | null;
1957
+ requires_selling_plan: boolean;
1958
+ selling_plan_allocations: {
1959
+ selling_plan_id: number;
1960
+ selling_plan_group_id: string;
1961
+ price: number;
1962
+ compare_at_price: number | null;
1963
+ }[];
1964
+ option1: string;
1965
+ option2: string | null;
1966
+ option3: string | null;
1947
1967
  }
1948
- interface DeliveryLineItem extends 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'> {
1949
- /** Value is set to true if it is not a onetime or a prepaid item */
1950
- is_skippable: boolean;
1951
- /** Value is set to true if the order is skipped. */
1952
- is_skipped: boolean;
1953
- /** The type of the plan. May return null value in certain cases. */
1954
- plan_type: PlanType;
1955
- /** Value is set to true if it is a prepaid item */
1956
- is_prepaid: boolean;
1957
- /** The name of the product in a store’s catalog. */
1958
- product_title: string;
1959
- /** Unique numeric identifier for the subscription linked to this line_item in the order. */
1960
- subscription_id: number;
1961
- /** The total price of the line item, before discounts. */
1962
- original_price: string;
1963
- /** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
1964
- subtotal_price: string;
1968
+ /** @internal */
1969
+ interface BaseProduct {
1970
+ id: number;
1971
+ title: string;
1972
+ description: string | null;
1973
+ available: boolean;
1974
+ featured_image: string | null;
1975
+ images: string[];
1976
+ requires_selling_plan: boolean;
1977
+ selling_plan_groups: SellingPlanGroup$1[];
1965
1978
  }
1966
- interface DeliveryPaymentMethod extends Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'payment_details' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> {
1967
- payment_details: PaymentDetails | null;
1968
- payment_type: PaymentType;
1969
- billing_address: AssociatedAddress;
1979
+ interface BundleDataCollectionProduct extends BaseProduct {
1980
+ handle: string;
1981
+ tags: string[];
1982
+ options: string[];
1983
+ variants: BundleDataCollectionProductVariant[];
1984
+ compare_at_price_max: number;
1985
+ compare_at_price_min: number;
1986
+ price_max: number;
1987
+ price_min: number;
1988
+ }
1989
+ interface AddonProduct$1 extends BaseProduct {
1990
+ price: number;
1991
+ compare_at_price: number | null;
1992
+ options: {
1993
+ name: string;
1994
+ position: number;
1995
+ values: string[];
1996
+ }[];
1997
+ variants: ({
1998
+ image: string;
1999
+ selling_plan_allocations: {
2000
+ selling_plan_group_id: string;
2001
+ selling_plan: SellingPlan$1;
2002
+ price: number;
2003
+ compare_at_price: number | null;
2004
+ }[];
2005
+ } & BaseProductVariant)[];
2006
+ }
2007
+ interface BundleDataCollection$1 {
2008
+ id: number;
2009
+ handle: string;
2010
+ title: string;
2011
+ products: BundleDataCollectionProduct[];
2012
+ }
2013
+ interface SellingPlan$1 {
2014
+ id: number;
2015
+ name: string;
2016
+ options: {
2017
+ name: string;
2018
+ position: number;
2019
+ value: string;
2020
+ }[];
2021
+ recurring_deliveries: boolean;
2022
+ price_adjustments: {
2023
+ value_type: 'percentage' | 'fixed_amount' | 'price';
2024
+ value: number;
2025
+ }[];
1970
2026
  }
1971
- interface DeliveryOrder {
1972
- address_id: number;
1973
- charge_id: number | null;
1974
- currency: string;
1975
- has_uncommitted_changes: boolean;
1976
- id: number | null;
1977
- line_items: DeliveryLineItem[];
1978
- order_subtotal: string;
1979
- payment_method: DeliveryPaymentMethod;
1980
- shipping_address: AssociatedAddress;
1981
- shipping_lines: ShippingLine[];
1982
- total_discounts: string | null;
1983
- total_duties: string | null;
1984
- total_price: string;
1985
- total_tax: string | null;
2027
+ interface SellingPlanGroup$1 {
2028
+ id: string;
2029
+ name: string;
2030
+ options: {
2031
+ name: string;
2032
+ values: string[];
2033
+ }[];
2034
+ selling_plans: SellingPlan$1[];
1986
2035
  }
1987
- interface Delivery {
1988
- date: IsoDateString;
1989
- orders: DeliveryOrder[];
2036
+ type FilterMatchMode = 'all' | 'any';
2037
+ type FilterSource = 'tag' | string;
2038
+ type FilterInputType = 'checkbox' | string;
2039
+ interface BundleFilterGroup {
2040
+ key?: string;
2041
+ name: string;
2042
+ source: FilterSource;
2043
+ type: FilterInputType;
2044
+ match: FilterMatchMode | string;
2045
+ options: string[];
1990
2046
  }
1991
- interface CustomerDeliveryScheduleResponse {
1992
- customer: {
2047
+ interface BundleData {
2048
+ id: number;
2049
+ handle: string;
2050
+ title: string;
2051
+ description: string | null;
2052
+ collections: Record<string, BundleDataCollection$1>;
2053
+ options: {
2054
+ name: string;
2055
+ position: number;
2056
+ values: string[];
2057
+ }[];
2058
+ available: boolean;
2059
+ requires_selling_plan: boolean;
2060
+ selling_plan_groups: SellingPlanGroup$1[];
2061
+ bundle_settings: {
2062
+ settings: {
2063
+ display_variants_as_separate_products_in_list: boolean;
2064
+ dynamic_filter_products_by_discount: boolean;
2065
+ show_product_and_variant_name_in_products_list: boolean;
2066
+ };
2067
+ max_quantity_per_variant: BundleProduct['max_quantity_per_variant'];
2068
+ is_customizable: BundleProduct['is_customizable'];
2069
+ default_bundle_variant_id: BundleProduct['default_bundle_variant_id'];
2070
+ price_rule: BundleProduct['price_rule'];
2071
+ customization_window: BundleProduct['customization_window'];
2072
+ customization_window_disabled_message: BundleProduct['customization_window_disabled_message'];
2073
+ layout_settings: Pick<BundleProduct['layout_settings'], 'addons' | 'crossSells' | 'defaultFrequency' | 'collapsibleSections' | 'showVariants' | 'learnMoreModal' | 'addToCartCallback' | 'templates' | 'globalStyles'> & Partial<Pick<BundleProduct['layout_settings'], 'defaultVariantId'>>;
2074
+ variants: {
2075
+ ranges: BundleProduct['variants'][number]['ranges'];
2076
+ enabled: BundleProduct['variants'][number]['enabled'];
2077
+ items_count: BundleProduct['variants'][number]['items_count'];
2078
+ external_variant_id: BundleProduct['variants'][number]['external_variant_id'];
2079
+ selection_defaults: ({
2080
+ sku: string;
2081
+ handle: string;
2082
+ product: {
2083
+ id: number;
2084
+ title: string;
2085
+ description: string;
2086
+ images: string[];
2087
+ };
2088
+ variant: {
2089
+ id: number;
2090
+ title: string;
2091
+ featured_image: string | null;
2092
+ sku: string;
2093
+ };
2094
+ } & BundleProduct['variants'][number]['selection_defaults'][number])[];
2095
+ option_sources: BundleVariantOptionSourceSubscription[];
2096
+ }[];
2097
+ };
2098
+ incentives: Incentives;
2099
+ variants: {
1993
2100
  id: number;
1994
- email: string;
1995
- first_name: string;
1996
- last_name: string;
2101
+ title: string;
2102
+ price: number;
2103
+ compare_at_price: number | null;
2104
+ image: string | null;
2105
+ available: boolean;
2106
+ options: string[];
2107
+ requires_selling_plan: boolean;
2108
+ selling_plan_allocations: {
2109
+ price: number;
2110
+ compare_at_price: number | null;
2111
+ selling_plan: SellingPlan$1;
2112
+ }[];
2113
+ }[];
2114
+ addons: {
2115
+ products: AddonProduct$1[];
1997
2116
  };
1998
- deliveries: Delivery[];
1999
- }
2000
- interface CustomerPortalAccessOptions {
2001
- page_destination?: 'subscriptions' | 'delivery_schedule' | 'orders' | 'shipping' | 'payment_methods' | 'overview';
2002
- locale?: string;
2003
- region_country?: string;
2004
- }
2005
- interface CustomerPortalAccessResponse {
2006
- /** base URL for customer portal */
2007
- base_url: string;
2008
- /** customer hash */
2009
- customer_hash: string;
2010
- /** Time when token expires */
2011
- expires_at: IsoDateString;
2012
- /** Full customer portal URL with token */
2013
- portal_url: string;
2014
- /** Token for use with customer portal */
2015
- temp_token: string;
2117
+ cross_sells: {
2118
+ products: BundleDataCollectionProduct[];
2119
+ };
2120
+ filters: BundleFilterGroup[];
2016
2121
  }
2017
2122
 
2018
2123
  type ChargeStatus = 'success' | 'error' | 'queued' | 'skipped' | 'refunded' | 'partially_refunded' | 'pending_manual_payment' | 'pending';
@@ -2109,10 +2214,14 @@ interface Charge {
2109
2214
  updated_at: IsoDateString;
2110
2215
  /** Additional information as requested */
2111
2216
  include?: {
2217
+ address?: Address;
2218
+ bundle_selections?: BundleSelection[];
2112
2219
  customer?: Customer;
2113
2220
  metafields?: Metafield[];
2114
2221
  payment_methods?: PaymentMethod[];
2115
2222
  subscriptions?: Subscription[];
2223
+ /** Null when the projection could not be built, which is not the same as a projection of zero. */
2224
+ credit_projection?: CreditProjection | null;
2116
2225
  };
2117
2226
  /** Error reason as sentence text (typically returned direct from the payment processor). e.g. "error": "Customer needs to update credit card" */
2118
2227
  error?: string | null;
@@ -2125,61 +2234,178 @@ interface Charge {
2125
2234
  /** The date when the next attempt will be placed. */
2126
2235
  retry_date?: IsoDateString | null;
2127
2236
  }
2128
- interface ChargeResponse {
2129
- charge: Charge;
2237
+ type ExcludableCreditAccountType = 'manual' | 'reward' | 'referral';
2238
+ /** Credit a credit type could not spend on the Charge because the store excluded some of its products. */
2239
+ interface BlockedByExclusion {
2240
+ /** How much more this credit type would have applied had the store excluded no products. */
2241
+ amount: string;
2242
+ /** External (platform) product IDs on the Charge that this credit type cannot spend on. */
2243
+ excluded_product_ids: string[];
2244
+ }
2245
+ /** What a queued Charge would redeem in credits if it processed now, in the Charge's presentment currency. */
2246
+ interface CreditProjection {
2247
+ /** The code of the currency of the projected amounts, such as USD. */
2248
+ currency_code: string;
2249
+ /** Gift credit the Charge will redeem. */
2250
+ gift_to_apply: string;
2251
+ /** Non-gift credit the Charge will redeem. */
2252
+ non_gift_to_apply: string;
2253
+ /** Total credit the Charge will redeem if nothing changes. */
2254
+ total_to_apply: string;
2255
+ /** Like `total_to_apply`, but as if the customer applied credit to their next recurring charge. */
2256
+ total_to_apply_if_opted_in: string;
2257
+ /** Whether the max redemption limit would hold back non-gift credit if the customer opted in. Goes with `total_to_apply_if_opted_in`. */
2258
+ capped_by_redemption_limit: boolean;
2259
+ /** How much each credit type lost to the store's product exclusions. */
2260
+ blocked_by_exclusion: Record<ExcludableCreditAccountType, BlockedByExclusion>;
2261
+ }
2262
+ interface ChargeResponse {
2263
+ charge: Charge;
2264
+ }
2265
+ interface ChargeListResponse {
2266
+ next_cursor: null | string;
2267
+ previous_cursor: null | string;
2268
+ charges: Charge[];
2269
+ }
2270
+ type ChargeIncludes = 'address' | 'bundle_selections' | 'customer' | 'metafields' | 'payment_methods' | 'charge_activities' | 'subscriptions';
2271
+ /** `credit_projection` is only served when reading a single Charge. */
2272
+ type GetChargeIncludes = ChargeIncludes | 'credit_projection';
2273
+ interface GetChargeOptions {
2274
+ include?: GetChargeIncludes[];
2275
+ }
2276
+ type ChargeSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
2277
+ interface ChargeListParams extends ListParams<ChargeSortBy> {
2278
+ /** Filter Charges by Address. */
2279
+ address_id?: string | number;
2280
+ /** List Charges that contain the given discount_id. */
2281
+ discount_id?: string | number;
2282
+ /** List Charges that contain the given discount_code. */
2283
+ discount_code?: string;
2284
+ /** Filter Charges by the associated order ID in the external e-commerce platform. */
2285
+ external_order_id?: string | number;
2286
+ /** Filter Charges by list of IDs. */
2287
+ ids?: (string | number)[];
2288
+ /** Filter Charges by a Subscription or Onetime ID. */
2289
+ purchase_item_id?: string | number;
2290
+ /** Filter Charges by list of Subscription or Onetime IDs. */
2291
+ purchase_item_ids?: (string | number)[];
2292
+ /** Filter Charges by specific scheduled charge date. */
2293
+ scheduled_at?: IsoDateString;
2294
+ /** Show Charges scheduled to be processed before the given date. */
2295
+ scheduled_at_max?: IsoDateString;
2296
+ /** Show Charges scheduled to be processed after the given date. */
2297
+ scheduled_at_min?: IsoDateString;
2298
+ /** Filter charges by status. */
2299
+ status?: ChargeStatus[];
2300
+ /** Show charges updated before the given date. */
2301
+ updated_at_max?: IsoDateString;
2302
+ /** Show charges updated after the given date. */
2303
+ updated_at_min?: IsoDateString;
2304
+ /** Show charges processed after, and including, the given date. */
2305
+ processed_at_max?: IsoDateString;
2306
+ /** Show charges processed before, and including, the given date. */
2307
+ processed_at_min?: IsoDateString;
2308
+ /** Show Charges created after the given date. */
2309
+ created_at_min?: IsoDateString;
2310
+ /** Show Charges created before the given date. */
2311
+ created_at_max?: IsoDateString;
2312
+ /** Include related data options */
2313
+ include?: ChargeIncludes[];
2314
+ }
2315
+ /** @internal */
2316
+ interface SkipChargeParams {
2317
+ /** @internal */
2318
+ update_membership_expires_at?: boolean;
2319
+ }
2320
+
2321
+ interface Onetime {
2322
+ /** Unique numeric identifier for the Onetime purchase. */
2323
+ id: number;
2324
+ /** Unique numeric identifier for the address the Onetime Purchase is associated with (cannot be used with next_charge_scheduled_at) */
2325
+ address_id: number;
2326
+ /** The time the Onetime item was first created. */
2327
+ created_at: IsoDateString;
2328
+ /** Unique numeric identifier for the customer the Onetime purchase is tied to. */
2329
+ customer_id: number;
2330
+ /** An object containing the product id as it appears in external platforms. */
2331
+ external_product_id: ExternalId;
2332
+ /** An object containing the variant id as it appears in external platforms. */
2333
+ external_variant_id: ExternalId;
2334
+ /** Flag indicating if the the onetime is cancelled. */
2335
+ is_cancelled: boolean;
2336
+ /**
2337
+ * Date of the Onetime purchase execution.
2338
+ * Cannot be used with add_to_next_charge
2339
+ */
2340
+ next_charge_scheduled_at: IsoDateString;
2341
+ /** The price of the item before discounts, taxes, or shipping have been applied. */
2342
+ price: string;
2343
+ /** The name of the product in a shop’s catalog. */
2344
+ product_title: string;
2345
+ /** An array containing key value pairs for any supplementary data. */
2346
+ properties: Property[];
2347
+ /** The number of items in the Onetime purchase. */
2348
+ quantity: number;
2349
+ /** A unique identifier of the item in the fulfillment. */
2350
+ sku: string | null;
2351
+ /** Flag that is automatically updated to true when SKU is passed on POST or PUT. */
2352
+ sku_override: boolean;
2353
+ /** The time the Onetime purchase was last updated. */
2354
+ updated_at: IsoDateString;
2355
+ /** The name of the variant in a shop’s catalog. */
2356
+ variant_title: string;
2357
+ /** Presentment currency */
2358
+ presentment_currency: string | null;
2359
+ /** Additional information as requested */
2360
+ include?: {
2361
+ address?: Address;
2362
+ customer?: Customer;
2363
+ metafields?: Metafield[];
2364
+ bundle_selections?: BundleSelection | null;
2365
+ bundle_product?: BundleProduct<BundleVariantOptionSourceSubscription> | null;
2366
+ };
2367
+ }
2368
+ type OnetimeIncludes = 'address' | 'customer' | 'metafields' | 'bundle_product' | 'bundle_selections' | 'charge_activities';
2369
+ type OnetimeRequiredCreateProps = 'address_id' | 'external_variant_id' | 'quantity';
2370
+ type OnetimeOptionalCreateProps = 'external_product_id' | 'next_charge_scheduled_at' | 'product_title' | 'properties' | 'sku';
2371
+ interface CreateOnetimeRequest extends SubType<Onetime, OnetimeRequiredCreateProps, OnetimeOptionalCreateProps> {
2372
+ /** Instructs to add the Onetime to the next charge scheduled under this Address. */
2373
+ add_to_next_charge?: boolean;
2374
+ /**
2375
+ * When creating a onetime using a gift, pass the `credit_account_id` that is associated with that gift.
2376
+ * This will create the onetime using the credit account associated with the gift.
2377
+ */
2378
+ gift_id?: number;
2379
+ }
2380
+ interface UpdateOnetimeRequest extends Partial<Pick<Onetime, 'next_charge_scheduled_at' | 'properties' | 'quantity' | 'external_variant_id' | 'sku' | 'address_id'>> {
2130
2381
  }
2131
- interface ChargeListResponse {
2382
+ interface OnetimesResponse {
2132
2383
  next_cursor: null | string;
2133
2384
  previous_cursor: null | string;
2134
- charges: Charge[];
2135
- }
2136
- type ChargeIncludes = 'customer' | 'metafields' | 'payment_methods' | 'charge_activities' | 'subscriptions';
2137
- interface GetChargeOptions {
2138
- include?: ChargeIncludes[];
2385
+ onetimes: Onetime[];
2139
2386
  }
2140
- type ChargeSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
2141
- interface ChargeListParams extends ListParams<ChargeSortBy> {
2142
- /** Filter Charges by Address. */
2387
+ type OnetimesSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
2388
+ interface OnetimeListParams extends ListParams<OnetimesSortBy> {
2389
+ /** Return the onetimes linked to the given address_id. */
2143
2390
  address_id?: string | number;
2144
- /** List Charges that contain the given discount_id. */
2145
- discount_id?: string | number;
2146
- /** List Charges that contain the given discount_code. */
2147
- discount_code?: string;
2148
- /** Filter Charges by the associated order ID in the external e-commerce platform. */
2149
- external_order_id?: string | number;
2150
- /** Filter Charges by list of IDs. */
2391
+ /** Return the onetimes linked to the given address_ids. */
2392
+ address_ids?: (string | number)[];
2393
+ /** Return the onetimes created before the given date. */
2394
+ created_at_max?: IsoDateString;
2395
+ /** Return the onetimes created after the given date. */
2396
+ created_at_min?: IsoDateString;
2397
+ /** Return the onetimes linked to the given external_variant_id */
2398
+ external_variant_id?: string | number;
2399
+ /** List of onetime_ids to filter */
2151
2400
  ids?: (string | number)[];
2152
- /** Filter Charges by a Subscription or Onetime ID. */
2153
- purchase_item_id?: string | number;
2154
- /** Filter Charges by list of Subscription or Onetime IDs. */
2155
- purchase_item_ids?: (string | number)[];
2156
- /** Filter Charges by specific scheduled charge date. */
2157
- scheduled_at?: IsoDateString;
2158
- /** Show Charges scheduled to be processed before the given date. */
2159
- scheduled_at_max?: IsoDateString;
2160
- /** Show Charges scheduled to be processed after the given date. */
2161
- scheduled_at_min?: IsoDateString;
2162
- /** Filter charges by status. */
2163
- status?: ChargeStatus[];
2164
- /** Show charges updated before the given date. */
2401
+ /** If true the response will include the cancelled Onetimes as well as the others. */
2402
+ include_cancelled?: boolean;
2403
+ /** Return the onetimes updated before the given date. */
2165
2404
  updated_at_max?: IsoDateString;
2166
- /** Show charges updated after the given date. */
2405
+ /** Return the onetimes updated after the given date. */
2167
2406
  updated_at_min?: IsoDateString;
2168
- /** Show charges processed after, and including, the given date. */
2169
- processed_at_max?: IsoDateString;
2170
- /** Show charges processed before, and including, the given date. */
2171
- processed_at_min?: IsoDateString;
2172
- /** Show Charges created after the given date. */
2173
- created_at_min?: IsoDateString;
2174
- /** Show Charges created before the given date. */
2175
- created_at_max?: IsoDateString;
2176
2407
  /** Include related data options */
2177
- include?: ChargeIncludes[];
2178
- }
2179
- /** @internal */
2180
- interface SkipChargeParams {
2181
- /** @internal */
2182
- update_membership_expires_at?: boolean;
2408
+ include?: OnetimeIncludes[];
2183
2409
  }
2184
2410
 
2185
2411
  interface CreateAddressRequest {
@@ -2326,6 +2552,8 @@ interface Address {
2326
2552
  customer?: Customer;
2327
2553
  payment_methods?: PaymentMethod[];
2328
2554
  subscriptions?: Subscription[];
2555
+ discount?: Discount;
2556
+ onetimes?: Onetime[];
2329
2557
  };
2330
2558
  }
2331
2559
  interface SkipFutureChargeAddressResponse {
@@ -2339,7 +2567,7 @@ interface AddressListResponse {
2339
2567
  previous_cursor: null | string;
2340
2568
  addresses: Address[];
2341
2569
  }
2342
- type AddressIncludes = 'customer' | 'payment_methods' | 'subscriptions' | 'charge_activities';
2570
+ type AddressIncludes = 'customer' | 'payment_methods' | 'subscriptions' | 'discount' | 'onetimes' | 'charge_activities';
2343
2571
  interface GetAddressOptions {
2344
2572
  include?: AddressIncludes[];
2345
2573
  }
@@ -3502,104 +3730,6 @@ interface GiftPurchasesParams {
3502
3730
  sender_customer_id?: number;
3503
3731
  }
3504
3732
 
3505
- /** @internal */
3506
- type MembershipStatus = 'active' | 'inactive';
3507
- /** @internal */
3508
- interface Membership {
3509
- id: number;
3510
- address_id: number;
3511
- customer_id: number;
3512
- membership_program_id: number;
3513
- purchase_item_id: number;
3514
- cancellation_reason: string | null;
3515
- cancellation_reason_comments: string | null;
3516
- cancelled_at: IsoDateString | null;
3517
- charge_interval_frequency: string;
3518
- charge_interval_unit: string;
3519
- created_at: IsoDateString;
3520
- expires_at: IsoDateString;
3521
- external_product_id: number;
3522
- external_variant_id: number;
3523
- has_queued_charges: boolean;
3524
- next_charge_scheduled_at: IsoDateString;
3525
- presentment_currency: string;
3526
- price: number;
3527
- product_title: string;
3528
- purchase_item_status: string;
3529
- purchase_item_type: 'membership_subscription';
3530
- quantity: number;
3531
- status: MembershipStatus;
3532
- type: 'membership_subscription';
3533
- updated_at: IsoDateString;
3534
- variant_title: string;
3535
- }
3536
- /** @internal */
3537
- interface MembershipResponse {
3538
- membership: Membership;
3539
- }
3540
- /** @internal */
3541
- interface MembershipListResponse {
3542
- next_cursor: null | string;
3543
- previous_cursor: null | string;
3544
- memberships: Membership[];
3545
- }
3546
- /** @internal */
3547
- type MembershipsSortBy = 'id-asc' | 'id-desc';
3548
- /** @internal */
3549
- type membershipIncludes = 'customer' | 'subscriptions';
3550
- /** @internal */
3551
- type MembershipIncludes = `${membershipIncludes}` | `${membershipIncludes},${membershipIncludes}`;
3552
- /** @internal */
3553
- interface MembershipListParams extends ListParams<MembershipsSortBy> {
3554
- include?: MembershipIncludes;
3555
- /** Return the memberships linked to the given membership_program_ids. */
3556
- membership_program_ids?: (string | number)[];
3557
- /** Return the memberships with specified status. */
3558
- status?: MembershipStatus;
3559
- /** Returns memberships created after the given time. */
3560
- created_at_min?: IsoDateString;
3561
- /** Returns memberships created before the given time. */
3562
- created_at_max?: IsoDateString;
3563
- /** Returns memberships expiring after the given time. */
3564
- expires_at_min?: IsoDateString;
3565
- /** Returns memberships expiring before the given time. */
3566
- expires_at_max?: IsoDateString;
3567
- /** If true the response will include the cancelled Memberships as well as the others. */
3568
- include_cancelled?: boolean;
3569
- /** If true the response will include the deleted Memberships as well as the others. */
3570
- include_deleted?: boolean;
3571
- }
3572
- /** @internal */
3573
- interface ActivateMembershipRequest {
3574
- expires_at: string | null;
3575
- }
3576
- /** @internal */
3577
- interface CancelMembershipRequest {
3578
- cancel_immediately: boolean;
3579
- cancellation_reason: string;
3580
- cancellation_reason_comments: string;
3581
- expires_at: IsoDateString;
3582
- }
3583
- /** @internal */
3584
- type intervalUnit = 'day' | 'month' | 'year';
3585
- /** @internal */
3586
- interface ChangeMembershipRequest {
3587
- /** Updates the membership program to the membership specified one. If membership_program_id is not specified, a external_product_id should be specified. */
3588
- membership_program_id?: number;
3589
- /** Updates the membership product to the specified one. If external_product_id is not specified, a membership_program_id should be specified. */
3590
- external_product_id?: string;
3591
- /** Updates the the variant id to the specified one. */
3592
- external_variant_id?: string;
3593
- /** Updates the interval frequency to the specified one. A charge_interval_frequency must be included when providing an interval frequency. */
3594
- charge_interval_frequency?: number;
3595
- /** Updates the interval frequency unit to the specified one. A charge_interval_frequency must be included when providing an interval unit. */
3596
- charge_interval_unit?: intervalUnit;
3597
- /** Updates the price to the specified one. If not provided the subscription will be updated with the price of the new external_product_id*/
3598
- price?: number;
3599
- /** Updates the membership quantity. This is only meant to be used with memberships whose quantity is greater than 1. */
3600
- quantity?: number;
3601
- }
3602
-
3603
3733
  /** @internal */
3604
3734
  interface MembershipBenefit {
3605
3735
  id: number;
@@ -3671,96 +3801,6 @@ interface MembershipProgramListParams extends ListParams<MembershipProgramSortBy
3671
3801
  include?: MembershipProgramIncludes[];
3672
3802
  }
3673
3803
 
3674
- interface Onetime {
3675
- /** Unique numeric identifier for the Onetime purchase. */
3676
- id: number;
3677
- /** Unique numeric identifier for the address the Onetime Purchase is associated with (cannot be used with next_charge_scheduled_at) */
3678
- address_id: number;
3679
- /** The time the Onetime item was first created. */
3680
- created_at: IsoDateString;
3681
- /** Unique numeric identifier for the customer the Onetime purchase is tied to. */
3682
- customer_id: number;
3683
- /** An object containing the product id as it appears in external platforms. */
3684
- external_product_id: ExternalId;
3685
- /** An object containing the variant id as it appears in external platforms. */
3686
- external_variant_id: ExternalId;
3687
- /** Flag indicating if the the onetime is cancelled. */
3688
- is_cancelled: boolean;
3689
- /**
3690
- * Date of the Onetime purchase execution.
3691
- * Cannot be used with add_to_next_charge
3692
- */
3693
- next_charge_scheduled_at: IsoDateString;
3694
- /** The price of the item before discounts, taxes, or shipping have been applied. */
3695
- price: string;
3696
- /** The name of the product in a shop’s catalog. */
3697
- product_title: string;
3698
- /** An array containing key value pairs for any supplementary data. */
3699
- properties: Property[];
3700
- /** The number of items in the Onetime purchase. */
3701
- quantity: number;
3702
- /** A unique identifier of the item in the fulfillment. */
3703
- sku: string | null;
3704
- /** Flag that is automatically updated to true when SKU is passed on POST or PUT. */
3705
- sku_override: boolean;
3706
- /** The time the Onetime purchase was last updated. */
3707
- updated_at: IsoDateString;
3708
- /** The name of the variant in a shop’s catalog. */
3709
- variant_title: string;
3710
- /** Presentment currency */
3711
- presentment_currency: string | null;
3712
- /** Additional information as requested */
3713
- include?: {
3714
- address?: Address;
3715
- customer?: Customer;
3716
- metafields?: Metafield[];
3717
- bundle_selections?: BundleSelection | null;
3718
- bundle_product?: BundleProduct<BundleVariantOptionSourceSubscription> | null;
3719
- };
3720
- }
3721
- type OnetimeIncludes = 'address' | 'customer' | 'metafields' | 'bundle_product' | 'bundle_selections' | 'charge_activities';
3722
- type OnetimeRequiredCreateProps = 'address_id' | 'external_variant_id' | 'quantity';
3723
- type OnetimeOptionalCreateProps = 'external_product_id' | 'next_charge_scheduled_at' | 'product_title' | 'properties' | 'sku';
3724
- interface CreateOnetimeRequest extends SubType<Onetime, OnetimeRequiredCreateProps, OnetimeOptionalCreateProps> {
3725
- /** Instructs to add the Onetime to the next charge scheduled under this Address. */
3726
- add_to_next_charge?: boolean;
3727
- /**
3728
- * When creating a onetime using a gift, pass the `credit_account_id` that is associated with that gift.
3729
- * This will create the onetime using the credit account associated with the gift.
3730
- */
3731
- gift_id?: number;
3732
- }
3733
- interface UpdateOnetimeRequest extends Partial<Pick<Onetime, 'next_charge_scheduled_at' | 'properties' | 'quantity' | 'external_variant_id' | 'sku' | 'address_id'>> {
3734
- }
3735
- interface OnetimesResponse {
3736
- next_cursor: null | string;
3737
- previous_cursor: null | string;
3738
- onetimes: Onetime[];
3739
- }
3740
- type OnetimesSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
3741
- interface OnetimeListParams extends ListParams<OnetimesSortBy> {
3742
- /** Return the onetimes linked to the given address_id. */
3743
- address_id?: string | number;
3744
- /** Return the onetimes linked to the given address_ids. */
3745
- address_ids?: (string | number)[];
3746
- /** Return the onetimes created before the given date. */
3747
- created_at_max?: IsoDateString;
3748
- /** Return the onetimes created after the given date. */
3749
- created_at_min?: IsoDateString;
3750
- /** Return the onetimes linked to the given external_variant_id */
3751
- external_variant_id?: string | number;
3752
- /** List of onetime_ids to filter */
3753
- ids?: (string | number)[];
3754
- /** If true the response will include the cancelled Onetimes as well as the others. */
3755
- include_cancelled?: boolean;
3756
- /** Return the onetimes updated before the given date. */
3757
- updated_at_max?: IsoDateString;
3758
- /** Return the onetimes updated after the given date. */
3759
- updated_at_min?: IsoDateString;
3760
- /** Include related data options */
3761
- include?: OnetimeIncludes[];
3762
- }
3763
-
3764
3804
  interface Session {
3765
3805
  /** API token */
3766
3806
  apiToken: string;
@@ -4015,6 +4055,8 @@ interface CustomerPortalSettings {
4015
4055
  select_onetime: number;
4016
4056
  /** Whether the customer can select the quantity when gifting or not. */
4017
4057
  select_quantity: number;
4058
+ /** Whether the order price is shown on a redeemed gift subscription's orders or not. */
4059
+ show_price: boolean;
4018
4060
  };
4019
4061
  /** Whether gifting is enabled or not. */
4020
4062
  gifting_enabled: boolean;
@@ -4338,7 +4380,7 @@ declare function createOnetime(session: Session, createRequest: CreateOnetimeReq
4338
4380
  declare function updateOnetime(session: Session, id: string | number, updateRequest: UpdateOnetimeRequest): Promise<Onetime>;
4339
4381
  declare function deleteOnetime(session: Session, id: string | number): Promise<void>;
4340
4382
 
4341
- declare function getOrder(session: Session, id: string | number): Promise<Order>;
4383
+ declare function getOrder(session: Session, id: string | number, options?: GetOrderOptions): Promise<Order>;
4342
4384
  declare function listOrders(session: Session, query?: OrderListParams): Promise<OrdersResponse>;
4343
4385
  declare function delayOrder(session: Session, id: number | string): Promise<Order>;
4344
4386
 
@@ -4468,4 +4510,4 @@ declare const api: {
4468
4510
  declare function initRecharge(opt?: InitOptions): void;
4469
4511
 
4470
4512
  export { activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, claimOfferCustomerSurvey, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, delayOrder, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, deleteSubscriptions, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getBundleSelectionId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCollection, getCreditSummary, getCustomer, getCustomerPortalAccess, getCustomerSurveyOffers, getCustomerSurveyReasons, getDeliverySchedule, getDynamicBundleItems, getFailedPaymentMethodRecoveryLandingPageURL, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getStoreSettings, getSubscription, getSubscriptionPricingPreview, getTieredDiscount, getTieredDiscountOffers, initFrictionlessPaymentV1, initRecharge, listAddresses, listBundleSelections, listCharges, listCollectionProducts, listCollections, listCreditAccounts, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptionAddons, listSubscriptions, listTieredDiscounts, loadBundleData, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, rescheduleCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, setApplyCreditsToNextCharge, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, triggerCustomerPortalFlow, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateBundleSelection, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
4471
- export type { ActivateMembershipRequest, AddToCartCallbackSettings, Addon, AddonProduct, AddonSettings, AddonType, AddonsSection, Address, AddressIncludes, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, Announcement, ApplyCreditOptions, AssociatedAddress, BaseCardDetails, BaseProduct, BaseProductVariant, BaseVariant, BasicSubscriptionParams, BooleanLike, BooleanNumbers, BooleanString, BooleanStringNumbers, BulkSubscriptionParams, BundleAppProxy, BundleData, BundleDataBaseProduct, BundleDataCollection, BundleDataSellingPlan, BundleDataSellingPlanGroup, BundleDataVariant, BundleFilterGroup, BundlePriceRule, BundleProduct, BundleProductGlobalStyles, BundleProductLayoutSettings, BundlePurchaseItem, BundlePurchaseItemParams, BundleSelection, BundleSelectionAppProxy, BundleSelectionItem, BundleSelectionItemRequiredCreateProps, BundleSelectionListParams, BundleSelectionsResponse, BundleSelectionsSortBy, BundleSettings, BundleTemplateSettings, BundleTemplateType, BundleTranslations, BundleVariant, BundleVariantOptionSource, BundleVariantOptionSourceBase, BundleVariantOptionSourceSubscription, BundleVariantRange, BundleVariantSelectionDefault, CDNBaseWidgetSettings, CDNBundleSettings, CDNBundleVariant, CDNBundleVariantOptionSource, CDNPlan, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductQuery_2020_12, CDNProductQuery_2022_06, CDNProductRaw, CDNProductResource, CDNProductResponseType, CDNProductType, CDNProductVariant_2022_06, CDNProduct_2022_06, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVersion, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, CardDetailsFirstNameLastName, CardDetailsFullName, ChangeMembershipRequest, ChannelSettings, Charge, ChargeIncludes, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, Collection, CollectionBinding, CollectionListParams, CollectionTypes, CollectionsResponse, CollectionsSortBy, ColorString, CreateAddressRequest, CreateBundleSelectionRequest, CreateMetafieldRequest, CreateOnetimeRequest, CreatePaymentMethodRequest, CreateRecipientAddress, CreateSubscriptionRequest, CreateSubscriptionsParams, CreateSubscriptionsRequest, CreditAccount, CreditAccountIncludes, CreditAccountListParams, CreditAccountType, CreditAccountsResponse, CreditAccountsSortBy, CreditSummaryIncludes, CrossSellsSection, CrossSellsSettings, CurrencyPriceSet, Customer, CustomerCreditSummary, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, CustomerIncludeGiftPurchase, CustomerIncludes, CustomerNotification, CustomerNotificationOptions, CustomerNotificationTemplate, CustomerNotificationType, CustomerPortalAccessOptions, CustomerPortalAccessResponse, CustomerPortalFlowAction, CustomerPortalSettings, CustomerSurveyOfferParams, CustomerSurveyOfferResponse, CustomerSurveyOffersResponse, CustomerSurveyReason, CustomerSurveyReasonsResponse, DefaultProduct, DefaultSelection, DefaultVariant, DelayOption, DeleteSubscriptionsParams, DeleteSubscriptionsRequest, Delivery, DeliveryLineItem, DeliveryOrder, DeliveryPaymentMethod, Discount, DiscountApplicationMethod, DiscountType, DynamicBundleItemAppProxy, DynamicBundlePropertiesAppProxy, DynamicPricingPreviewDetails, EligibleChargeType, EligibleLineItemType, ExternalAttributeSchema, ExternalId, ExternalProductStatus, ExternalTransactionId, FilterInputType, FilterMatchMode, FilterSource, FirstOption, GetAddressOptions, GetChargeOptions, GetCreditSummaryOptions, GetCustomerOptions, GetMembershipProgramOptions, GetPaymentMethodOptions, GetRequestOptions, GetSubscriptionOptions, GiftPurchase, GiftPurchasesParams, GiftPurchasesResponse, HTMLString, Incentives, InitOptions, InternalSession, IntervalUnit, InventoryPolicy, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipBenefit, MembershipIncludes, MembershipListParams, MembershipListResponse, MembershipProgram, MembershipProgramIncludes, MembershipProgramListParams, MembershipProgramListResponse, MembershipProgramResponse, MembershipProgramSortBy, MembershipProgramStatus, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Metafield, MetafieldOptionalCreateProps, MetafieldOwnerResource, MetafieldRequiredCreateProps, Method, Modifier, MultiStepSettings, OfferAttributes, OnePageSettings, Onetime, OnetimeIncludes, OnetimeListParams, OnetimeOptionalCreateProps, OnetimeRequiredCreateProps, OnetimeSubscription, OnetimesResponse, OnetimesSortBy, OnlineStoreOptions, Options, Order, OrderIncludes, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, PasswordlessCodeResponse, PasswordlessOptions, PasswordlessValidateResponse, PaymentDetails, PaymentErrorCallback, PaymentFieldEventCallback, PaymentFormConfig, PaymentFormController, PaymentFormEventHandlers, PaymentMethod, PaymentMethodFormOptions, PaymentMethodIncludes, PaymentMethodListParams, PaymentMethodOptionalCreateProps, PaymentMethodRequiredCreateProps, PaymentMethodSortBy, PaymentMethodStatus, PaymentMethodTokenCallback, PaymentMethodsResponse, PaymentType, Plan, PlanAddonSettings, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceRange, PriceRule, PriceSet, PricingProgressionResetTrigger, ProcessorName, Product, ProductImage, ProductInclude, ProductListResponse, ProductOption, ProductSearchParams_2020_12, ProductSearchParams_2022_06, ProductSearchResponse_2020_12, ProductSearchResponse_2022_06, ProductSearchType, ProductSource, ProductValueOption, ProductVariant_2020_12, ProductVariant_2022_06, Product_2020_12, Product_2022_06, Property, PublicBundleData, PublishStatus, PunchCardProgress, PunchCardProgressData, QuantityRange, RecurringSubscription, ReferralInfo, ReferralUrl, Request, RequestHeaders, RequestOptions, SellingPlan, SellingPlanAllocation, SellingPlanGroup, Session, ShippingCountriesOptions, ShippingCountriesResponse, ShippingCountry, ShippingLine, ShippingProvince, ShopifyStorefrontOptions, ShopifyUpdatePaymentInfoOptions, SkipChargeParams, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, SortBy, SortField, SortKeys, StepSettings, StepSettingsCommon, StepSettingsTypes, StoreSettings, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionBase, SubscriptionCancelled, SubscriptionIncludes, SubscriptionListAddonsParams, SubscriptionListParams, SubscriptionOption, SubscriptionOptionalCreateProps, SubscriptionPreferences, SubscriptionPricingPreview, SubscriptionPricingPreviewRequest, SubscriptionRequiredCreateProps, SubscriptionSortBy, SubscriptionStatus, Subscription_2021_01, SubscriptionsResponse, TaxLine, Tier, TieredDiscount, TieredDiscountOffer, TieredDiscountOfferLineItem, TieredDiscountOfferTarget, TieredDiscountOfferTier, TieredDiscountOffersRequest, TieredDiscountOffersResponse, TieredDiscountStatus, TieredDiscountsParams, TieredDiscountsResponse, Translations, TriggerCustomerPortalFlowOptions, TriggerCustomerPortalFlowResponse, UpdateAddressParams, UpdateAddressRequest, UpdateBundlePurchaseItem, UpdateBundleSelectionRequest, UpdateCustomerRequest, UpdateMetafieldRequest, UpdateOnetimeRequest, UpdatePaymentMethodRequest, UpdateSubscriptionChargeDateParams, UpdateSubscriptionParams, UpdateSubscriptionRequest, UpdateSubscriptionsParams, UpdateSubscriptionsRequest, Variant, VariantSelector, VariantSelectorStepSetting, WidgetIconColor, WidgetTemplateType, WidgetVisibility, intervalUnit, membershipIncludes };
4513
+ export type { ActivateMembershipRequest, AddToCartCallbackSettings, Addon, AddonProduct, AddonSettings, AddonType, AddonsSection, Address, AddressIncludes, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, Announcement, ApplyCreditOptions, AssociatedAddress, BaseCardDetails, BaseProduct, BaseProductVariant, BaseVariant, BasicSubscriptionParams, BlockedByExclusion, BooleanLike, BooleanNumbers, BooleanString, BooleanStringNumbers, BulkSubscriptionParams, BundleAppProxy, BundleData, BundleDataBaseProduct, BundleDataCollection, BundleDataSellingPlan, BundleDataSellingPlanGroup, BundleDataVariant, BundleFilterGroup, BundlePriceRule, BundleProduct, BundleProductGlobalStyles, BundleProductLayoutSettings, BundlePurchaseItem, BundlePurchaseItemParams, BundleSelection, BundleSelectionAppProxy, BundleSelectionItem, BundleSelectionItemRequiredCreateProps, BundleSelectionListParams, BundleSelectionsResponse, BundleSelectionsSortBy, BundleSettings, BundleTemplateSettings, BundleTemplateType, BundleTranslations, BundleVariant, BundleVariantOptionSource, BundleVariantOptionSourceBase, BundleVariantOptionSourceSubscription, BundleVariantRange, BundleVariantSelectionDefault, CDNBaseWidgetSettings, CDNBundleSettings, CDNBundleVariant, CDNBundleVariantOptionSource, CDNPlan, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductQuery_2020_12, CDNProductQuery_2022_06, CDNProductRaw, CDNProductResource, CDNProductResponseType, CDNProductType, CDNProductVariant_2022_06, CDNProduct_2022_06, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVersion, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, CardDetailsFirstNameLastName, CardDetailsFullName, ChangeMembershipRequest, ChannelSettings, Charge, ChargeIncludes, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, Collection, CollectionBinding, CollectionListParams, CollectionTypes, CollectionsResponse, CollectionsSortBy, ColorString, CreateAddressRequest, CreateBundleSelectionRequest, CreateMetafieldRequest, CreateOnetimeRequest, CreatePaymentMethodRequest, CreateRecipientAddress, CreateSubscriptionRequest, CreateSubscriptionsParams, CreateSubscriptionsRequest, CreditAccount, CreditAccountIncludes, CreditAccountListParams, CreditAccountType, CreditAccountsResponse, CreditAccountsSortBy, CreditProjection, CreditSummaryIncludes, CrossSellsSection, CrossSellsSettings, CurrencyPriceSet, Customer, CustomerCreditSummary, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, CustomerIncludeGiftPurchase, CustomerIncludes, CustomerNotification, CustomerNotificationOptions, CustomerNotificationTemplate, CustomerNotificationType, CustomerPortalAccessOptions, CustomerPortalAccessResponse, CustomerPortalFlowAction, CustomerPortalSettings, CustomerSurveyOfferParams, CustomerSurveyOfferResponse, CustomerSurveyOffersResponse, CustomerSurveyReason, CustomerSurveyReasonsResponse, DefaultProduct, DefaultSelection, DefaultVariant, DelayOption, DeleteSubscriptionsParams, DeleteSubscriptionsRequest, Delivery, DeliveryLineItem, DeliveryOrder, DeliveryPaymentMethod, Discount, DiscountApplicationMethod, DiscountType, DynamicBundleItemAppProxy, DynamicBundlePropertiesAppProxy, DynamicPricingPreviewDetails, EligibleChargeType, EligibleLineItemType, ExcludableCreditAccountType, ExternalAttributeSchema, ExternalId, ExternalProductStatus, ExternalTransactionId, FilterInputType, FilterMatchMode, FilterSource, FirstOption, GetAddressOptions, GetChargeIncludes, GetChargeOptions, GetCreditSummaryOptions, GetCustomerOptions, GetMembershipProgramOptions, GetOrderOptions, GetPaymentMethodOptions, GetRequestOptions, GetSubscriptionOptions, GiftPurchase, GiftPurchasesParams, GiftPurchasesResponse, HTMLString, Incentives, InitOptions, InternalSession, IntervalUnit, InventoryPolicy, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipBenefit, MembershipIncludes, MembershipListParams, MembershipListResponse, MembershipProgram, MembershipProgramIncludes, MembershipProgramListParams, MembershipProgramListResponse, MembershipProgramResponse, MembershipProgramSortBy, MembershipProgramStatus, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Metafield, MetafieldOptionalCreateProps, MetafieldOwnerResource, MetafieldRequiredCreateProps, Method, Modifier, MultiStepSettings, OfferAttributes, OnePageSettings, Onetime, OnetimeIncludes, OnetimeListParams, OnetimeOptionalCreateProps, OnetimeRequiredCreateProps, OnetimeSubscription, OnetimesResponse, OnetimesSortBy, OnlineStoreOptions, Options, Order, OrderIncludes, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, PasswordlessCodeResponse, PasswordlessOptions, PasswordlessValidateResponse, PaymentDetails, PaymentErrorCallback, PaymentFieldEventCallback, PaymentFormConfig, PaymentFormController, PaymentFormEventHandlers, PaymentMethod, PaymentMethodFormOptions, PaymentMethodIncludes, PaymentMethodListParams, PaymentMethodOptionalCreateProps, PaymentMethodRequiredCreateProps, PaymentMethodSortBy, PaymentMethodStatus, PaymentMethodTokenCallback, PaymentMethodsResponse, PaymentType, Plan, PlanAddonSettings, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceRange, PriceRule, PriceSet, PricingProgressionResetTrigger, ProcessorName, Product, ProductImage, ProductInclude, ProductListResponse, ProductOption, ProductSearchParams_2020_12, ProductSearchParams_2022_06, ProductSearchResponse_2020_12, ProductSearchResponse_2022_06, ProductSearchType, ProductSource, ProductValueOption, ProductVariant_2020_12, ProductVariant_2022_06, Product_2020_12, Product_2022_06, Property, PublicBundleData, PublishStatus, PunchCardProgress, PunchCardProgressData, QuantityRange, RecurringSubscription, ReferralInfo, ReferralUrl, Request, RequestHeaders, RequestOptions, SellingPlan, SellingPlanAllocation, SellingPlanGroup, Session, ShippingCountriesOptions, ShippingCountriesResponse, ShippingCountry, ShippingLine, ShippingProvince, ShopifyStorefrontOptions, ShopifyUpdatePaymentInfoOptions, SkipChargeParams, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, SortBy, SortField, SortKeys, StepSettings, StepSettingsCommon, StepSettingsTypes, StoreSettings, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionBase, SubscriptionCancelled, SubscriptionIncludes, SubscriptionListAddonsParams, SubscriptionListParams, SubscriptionOption, SubscriptionOptionalCreateProps, SubscriptionPreferences, SubscriptionPricingPreview, SubscriptionPricingPreviewRequest, SubscriptionRequiredCreateProps, SubscriptionSortBy, SubscriptionStatus, Subscription_2021_01, SubscriptionsResponse, TaxLine, Tier, TieredDiscount, TieredDiscountOffer, TieredDiscountOfferLineItem, TieredDiscountOfferTarget, TieredDiscountOfferTier, TieredDiscountOffersRequest, TieredDiscountOffersResponse, TieredDiscountStatus, TieredDiscountsParams, TieredDiscountsResponse, Translations, TriggerCustomerPortalFlowOptions, TriggerCustomerPortalFlowResponse, UpdateAddressParams, UpdateAddressRequest, UpdateBundlePurchaseItem, UpdateBundleSelectionRequest, UpdateCustomerRequest, UpdateMetafieldRequest, UpdateOnetimeRequest, UpdatePaymentMethodRequest, UpdateSubscriptionChargeDateParams, UpdateSubscriptionParams, UpdateSubscriptionRequest, UpdateSubscriptionsParams, UpdateSubscriptionsRequest, Variant, VariantSelector, VariantSelectorStepSetting, WidgetIconColor, WidgetTemplateType, WidgetVisibility, intervalUnit, membershipIncludes };