SubblySubbly
Log inGet started
  • Get started
  • Developer resources
Subbly.js SDK reference
Docs
Information
    CookiesAmounts and datesCurrencyExpand parametersErrors
Setup
    Start the SDKSet the currencySet the languageVersionConfiguration
Addresses
    List the addressesAdd an addressDelete an address
Authentication
    Authentication stateCheck the authenticationLog in with a passwordRegister a customerCheck if an email is registeredSend a one-time passwordLog in with a one-time passwordLog in with single sign-onLog outGet the access token
Bundles
    List the bundlesLoad a bundleLoad the bundle itemsLoad the bundle groupsQuote a bundle
Cart
    Create a cartLoad a cartUpdate the cartAdd an itemUpdate an itemRemove an itemGet the start datesGet the gifting datesGet the shipping methodsGet the pick-up pointsAttach the customer
Checkout
    Purchase the cart
Countries
    List the countries
Customers
    Get the customer profileUpdate the customerGet the referral link
Funnels
    Get a pre-purchase offerAccept a pre-purchase offerSkip a pre-purchase offerReset the pre-purchase offersGet a mid-purchase offerAccept a mid-purchase offerSkip a mid-purchase offerGet a post-purchase offerAccept a post-purchase offerSkip a post-purchase offer
Leads
    Capture a lead
Metafields
    List the metafields
Payment intents
    Get a payment intentConfirm a payment intent
Pick-up info
    List the pick-up infosAdd a pick-up infoDelete a pick-up info
Products
    List the productsLoad a productLoad a variantLoad a plan
Shop
    Load the shop
Stock notifications
    Get a back-in-stock alert
Subscriptions
    List the subscriptionsLoad a subscriptionUpdate a subscriptionUpdate the survey preferencesUpdate the bundleLoad a subscription itemUpdate a subscription itemUpdate an item bundleUpdate the item survey preferences
Surveys
    Load a survey
Wallet
    List the payment methodsStart a payment setupAdd a payment methodStart a 3-D Secure setup

Funnels

Offers before, during, and after the purchase: get the next one, accept it, or skip it.

A funnel has three phases: pre-purchase, mid-purchase and post-purchase. In each phase you fetch the next step, then accept it or skip it, and fetch again until step is null. For the full flow, with one example per phase, see Run a funnel.

subbly.funnels.prePurchaseFetch(cartId, params?)

Gets the next pre-purchase offer for the cart. step comes back null once the customer has seen every offer.

Method parameters

cartIdRequiredstring

ID of the cart, usually subbly.cart.id.

paramsoptionalFunnelsResourceParams

Extra data to include.

ReturnsPromise<FunnelFetchResponse>

The next offer, or an empty one.

Show the next offer
const { step } = await subbly.funnels.prePurchaseFetch(subbly.cart.id, { expand: ['parent'] }) if (step) render(step)

subbly.funnels.prePurchaseAccept(cartId, funnelStepId, payload, params?)

Accepts a pre-purchase offer and adds its products to the cart.

The cart it returns is a plain object, not the subbly.cart model, so subbly.cart still holds the old contents. Reload it with subbly.cart.load().

Method parameters

cartIdRequiredstring

ID of the cart.

funnelStepIdRequirednumber

ID of the step the customer accepted, from step.id.

payloadRequiredFunnelAcceptPayload

The products the customer took.

paramsoptionalCartResourceParams

Extra data to include on the cart that comes back.

ReturnsPromise<SubblyCart>

The cart after the offer went in.

Accept an offer
await subbly.funnels.prePurchaseAccept(subbly.cart.id, step.id, { offers: [{ productId: step.offer.products[0].id }] }) await subbly.cart.load()

subbly.funnels.prePurchaseReject(cartId, funnelStepId)

Skips a pre-purchase offer. Subbly records the refusal, so the next fetch moves on to the following step.

Method parameters

cartIdRequiredstring

ID of the cart.

funnelStepIdRequirednumber

ID of the step the customer skipped.

ReturnsPromise<void>

Nothing. The response body is empty.

Skip an offer
await subbly.funnels.prePurchaseReject(subbly.cart.id, step.id) const { step: next } = await subbly.funnels.prePurchaseFetch(subbly.cart.id)

subbly.funnels.prePurchaseRefresh(cartId)

Clears which pre-purchase offers the customer accepted or skipped, so the sequence starts from the first step again. Only the pre-purchase phase has this.

Method parameters

cartIdRequiredstring

ID of the cart.

ReturnsPromise<unknown>

Nothing you need to read. Treat the response as empty.

Start the offers again
await subbly.funnels.prePurchaseRefresh(subbly.cart.id)

subbly.funnels.midPurchaseFetch(cartId, params?)

Gets the next mid-purchase offer for the cart. Show these while the customer works through checkout.

Method parameters

cartIdRequiredstring

ID of the cart.

paramsoptionalFunnelsResourceParams

Extra data to include.

ReturnsPromise<FunnelFetchResponse>

The next offer, or an empty one.

Show the next offer
const { step } = await subbly.funnels.midPurchaseFetch(subbly.cart.id)

subbly.funnels.midPurchaseAccept(cartId, funnelStepId, payload, params?)

Accepts a mid-purchase offer and adds its products to the cart. As with the pre-purchase accept, reload subbly.cart afterwards.

Method parameters

cartIdRequiredstring

ID of the cart.

funnelStepIdRequirednumber

ID of the step the customer accepted.

payloadRequiredFunnelAcceptPayload

The products the customer took.

paramsoptionalCartResourceParams

Extra data to include on the cart that comes back.

expandoptionalstring[]

Cart relations to include.

ReturnsPromise<SubblyCart>

The cart after the offer went in.

Accept an offer
await subbly.funnels.midPurchaseAccept(subbly.cart.id, step.id, { offers: [{ productId: step.offer.products[0].id }] }) await subbly.cart.load()

subbly.funnels.midPurchaseReject(cartId, funnelStepId)

Skips a mid-purchase offer so the next fetch moves on.

Method parameters

cartIdRequiredstring

ID of the cart.

funnelStepIdRequirednumber

ID of the step the customer skipped.

ReturnsPromise<void>

Nothing. The response body is empty.

Skip an offer
await subbly.funnels.midPurchaseReject(subbly.cart.id, step.id)

subbly.funnels.postPurchaseFetch(cartId, params?)

Gets the next post-purchase offer for the cart. These run only after subbly.checkout.purchase succeeds, on the thank-you page.

Method parameters

cartIdRequiredstring

ID of the cart that was paid.

paramsoptionalFunnelsResourceParams

Extra data to include.

ReturnsPromise<FunnelFetchResponse>

The next offer, or an empty one.

Show the next offer after checkout
await subbly.checkout.purchase(subbly.cart.id) const { step } = await subbly.funnels.postPurchaseFetch(subbly.cart.id)

subbly.funnels.postPurchaseAccept(cartId, funnelStepId, payload, params?)

Accepts a post-purchase offer and charges it as a new purchase on the card the customer already used. Unlike the other two accepts, this one returns the invoice, subscription and orders it created. Needs an authenticated customer.

Method parameters

cartIdRequiredstring

ID of the cart that was paid.

funnelStepIdRequirednumber

ID of the step the customer accepted.

payloadRequiredFunnelPostAcceptPayload

The products taken, and anything the purchase still needs.

paramsoptionalCartResourceParams

Extra data to include in the response.

ReturnsPromise<FunnelPostAcceptResponse>

What the extra purchase created.

Accept a post-purchase offer
const { invoice, orders } = await subbly.funnels.postPurchaseAccept( subbly.cart.id, step.id, { offers: [{ productId: step.offer.products[0].id }] } )

subbly.funnels.postPurchaseReject(cartId, funnelStepId)

Skips a post-purchase offer so the next fetch moves on.

Method parameters

cartIdRequiredstring

ID of the cart that was paid.

funnelStepIdRequirednumber

ID of the step the customer skipped.

ReturnsPromise<void>

Nothing. The response body is empty.

Skip an offer
await subbly.funnels.postPurchaseReject(subbly.cart.id, step.id)
Last modified on September 15, 2026
expandoptionalstring[]

Relations to include. parent loads the parent product of each offered variant or plan.

stepFunnelStep | null

The offer to show. null means there is nothing left to offer.

idnumber

ID of the step. Send it back as funnelStepId when you accept or skip it.

titlestring

Headline of the offer.

descriptionstring | null

Body text of the offer.

typeFunnelType

Where the step belongs: funnel_pre_purchase, funnel_mid_purchase, funnel_post_purchase or funnel_post_purchase_complete.

initialboolean

Whether this is the first step of the funnel.

addonboolean

Whether the products join the cart as add-ons to a subscription.

addonDurationnumber | null

How long an add-on lasts: 1 once, 0 forever.

externalUrlstring | null

A page of your own to send the customer to instead of drawing the offer.

offerFunnelOffer

What the step sells.

type'single' | 'multiple' | 'one_click'

How many products the customer may take: one of them, several, or the whole offer in one click.

amountOffnumber | null

Discount off the price, in the minor unit of the currency.

percentOffnumber | null

Discount off the price, as a percentage.

productsProduct[]

The variants and plans on offer. Send the id of the one the customer picked as productId.

skipAnsweredSurveyboolean

Whether to reuse the survey answers already on the cart rather than ask again.

Javascript
offersRequiredFunnelOfferPayload[]

One entry per product taken.

productIdRequirednumber

The variant or plan the customer picked, from step.offer.products[].id.

optionsoptionalSubscriptionSurveyOption[]

Survey answers, when the offered plan has a survey. Each entry is { questionId, answers }. An answer is { content } for a text or email question, { id } for a select, multiple, offer or plan question, and { id, quantity } for a quantity question.

expandoptionalstring[]

Cart relations to include, such as items.product and items.product.parent.

idstring

UUID of the cart. Pass it to subbly.checkout.purchase and to the funnel methods.

shopIdnumber

ID of the shop the cart belongs to.

statusstring

initialized, abandoned, expired, completed or restored. A completed cart cannot be changed.

attachedboolean

true once a signed-in customer owns the cart. subbly.cart.attachCustomer sets it.

createdAtstring

When the cart was created.

updatedAtstring

When the cart last changed.

currencyCodestring

Currency of the cart, such as USD. Change it with subbly.cart.update({ currencyCode }).

baseCurrencyCodestring

Base currency of the shop.

subTotalnumber

Sum of the lines before discount and tax.

discountTotalnumber

Total taken off by coupons, offers, referrals and gift cards.

taxTotalnumber

Total tax.

taxRatenumber

Cart-level tax rate. Single lines may use their own rate.

customsFeenumber

Customs charge on this order.

futureCustomsFeenumber

Customs charge on each later renewal.

adjustmentnumber

A manual correction. It may be negative.

totalnumber

Grand total, across what is charged now and what is charged later. Read summaryItems[].chargeNow to split the two.

balanceChangeobject

How much store credit the cart uses.

itemsCartItem[]

The lines the customer added. They hold no money fields; the prices live in summaryItems.

summaryItemsCartSummaryItem[]

The priced lines. Every item produces one or more of these, and shipping adds one of its own. Match them back with itemId.

discountsobject[]

The cart-level discounts.

customerIdnumber | null

ID of the customer who owns the cart. Set only after subbly.cart.attachCustomer.

customerobject | null

Guest details written straight onto the cart. null once a customer is attached. This is not a SubblyCustomer: id, userId and createdAt are always null.

couponCodestring | null

The coupon code on the cart.

couponCoupon | null

The coupon itself. The API sends it only when you ask for the coupon expand.

giftCardCodestring | null

The gift card code on the cart.

giftCardGiftCard | null

The gift card itself. The API sends it only when you ask for the gift_card expand.

referralIdnumber | null

ID of the referral that led to this cart.

giftInfoobject

Gift settings. Always an object; every member is null when the cart is not a gift.

startsAtstring | null

When the subscription starts. Pick a date from subbly.cart.getStartDates().

shippingAddressIdnumber | null

ID of the saved address or pick-up info used for delivery.

shippingAddressCustomerAddress | CustomerPickupInfo | null

The delivery address. The API sends it only when you ask for the shipping_address expand. A pick-up info arrives instead when the cart ships to a pick-up point; its fields are on the Pick-up info page.

billingAddressIdnumber | null

ID of the saved billing address.

billingAddressCustomerAddress | null

The billing address. The API sends it only when you ask for the billing_address expand. Same fields as shippingAddress.

shippingMethodIdnumber | null

ID of the delivery option chosen.

shippingMethodShippingMethod | null

The delivery option itself. The API sends it only when you ask for the shipping_method expand. Read type to tell a carrier delivery, a local delivery and a pick-up point apart.

shippingCarrierIdnumber | null

ID of the carrier chosen.

shippingCarrierobject | null

The carrier chosen, with id, name and serviceCodes. The API sends it only when you ask for the shipping_carrier expand.

shippingCarrierServicestring | null

The carrier service chosen, from serviceCodes.

paymentMethodIdnumber | null

ID of the payment method to charge. Only a signed-in customer has one.

paymentMethodPaymentMethod | null

The payment method itself. The API sends it only when you ask for the payment_method expand, and only for a signed-in customer.

metadataMetafield[] | null

Metafield values on the cart. The API sends them only when you ask for the metadata expand. The shape is on the Metafields page.

onboardingTemplateIdnumber | null

ID of the onboarding template applied to the cart.

Javascript
Javascript
Javascript
expandoptionalstring[]

Relations to include. parent loads the parent product of each offered variant or plan.

stepFunnelStep | null

The offer to show. null means there is nothing left to offer.

idnumber

ID of the step. Send it back as funnelStepId when you accept or skip it.

titlestring

Headline of the offer.

descriptionstring | null

Body text of the offer.

typeFunnelType

Where the step belongs: funnel_pre_purchase, funnel_mid_purchase, funnel_post_purchase or funnel_post_purchase_complete.

initialboolean

Whether this is the first step of the funnel.

addonboolean

Whether the products join the cart as add-ons to a subscription.

addonDurationnumber | null

How long an add-on lasts: 1 once, 0 forever.

externalUrlstring | null

A page of your own to send the customer to instead of drawing the offer.

offerFunnelOffer

What the step sells.

type'single' | 'multiple' | 'one_click'

How many products the customer may take: one of them, several, or the whole offer in one click.

amountOffnumber | null

Discount off the price, in the minor unit of the currency.

percentOffnumber | null

Discount off the price, as a percentage.

productsProduct[]

The variants and plans on offer. Send the id of the one the customer picked as productId.

skipAnsweredSurveyboolean

Whether to reuse the survey answers already on the cart rather than ask again.

Javascript
offersRequiredFunnelOfferPayload[]

One entry per product taken.

productIdRequirednumber

The variant or plan the customer picked.

optionsoptionalSubscriptionSurveyOption[]

Survey answers, when the offered plan has a survey. Each entry is { questionId, answers }.

idstring

UUID of the cart. Pass it to subbly.checkout.purchase and to the funnel methods.

shopIdnumber

ID of the shop the cart belongs to.

statusstring

initialized, abandoned, expired, completed or restored. A completed cart cannot be changed.

attachedboolean

true once a signed-in customer owns the cart. subbly.cart.attachCustomer sets it.

createdAtstring

When the cart was created.

updatedAtstring

When the cart last changed.

currencyCodestring

Currency of the cart, such as USD. Change it with subbly.cart.update({ currencyCode }).

baseCurrencyCodestring

Base currency of the shop.

subTotalnumber

Sum of the lines before discount and tax.

discountTotalnumber

Total taken off by coupons, offers, referrals and gift cards.

taxTotalnumber

Total tax.

taxRatenumber

Cart-level tax rate. Single lines may use their own rate.

customsFeenumber

Customs charge on this order.

futureCustomsFeenumber

Customs charge on each later renewal.

adjustmentnumber

A manual correction. It may be negative.

totalnumber

Grand total, across what is charged now and what is charged later. Read summaryItems[].chargeNow to split the two.

balanceChangeobject

How much store credit the cart uses.

itemsCartItem[]

The lines the customer added. They hold no money fields; the prices live in summaryItems.

summaryItemsCartSummaryItem[]

The priced lines. Every item produces one or more of these, and shipping adds one of its own. Match them back with itemId.

discountsobject[]

The cart-level discounts.

customerIdnumber | null

ID of the customer who owns the cart. Set only after subbly.cart.attachCustomer.

customerobject | null

Guest details written straight onto the cart. null once a customer is attached. This is not a SubblyCustomer: id, userId and createdAt are always null.

couponCodestring | null

The coupon code on the cart.

couponCoupon | null

The coupon itself. The API sends it only when you ask for the coupon expand.

giftCardCodestring | null

The gift card code on the cart.

giftCardGiftCard | null

The gift card itself. The API sends it only when you ask for the gift_card expand.

referralIdnumber | null

ID of the referral that led to this cart.

giftInfoobject

Gift settings. Always an object; every member is null when the cart is not a gift.

startsAtstring | null

When the subscription starts. Pick a date from subbly.cart.getStartDates().

shippingAddressIdnumber | null

ID of the saved address or pick-up info used for delivery.

shippingAddressCustomerAddress | CustomerPickupInfo | null

The delivery address. The API sends it only when you ask for the shipping_address expand. A pick-up info arrives instead when the cart ships to a pick-up point; its fields are on the Pick-up info page.

billingAddressIdnumber | null

ID of the saved billing address.

billingAddressCustomerAddress | null

The billing address. The API sends it only when you ask for the billing_address expand. Same fields as shippingAddress.

shippingMethodIdnumber | null

ID of the delivery option chosen.

shippingMethodShippingMethod | null

The delivery option itself. The API sends it only when you ask for the shipping_method expand. Read type to tell a carrier delivery, a local delivery and a pick-up point apart.

shippingCarrierIdnumber | null

ID of the carrier chosen.

shippingCarrierobject | null

The carrier chosen, with id, name and serviceCodes. The API sends it only when you ask for the shipping_carrier expand.

shippingCarrierServicestring | null

The carrier service chosen, from serviceCodes.

paymentMethodIdnumber | null

ID of the payment method to charge. Only a signed-in customer has one.

paymentMethodPaymentMethod | null

The payment method itself. The API sends it only when you ask for the payment_method expand, and only for a signed-in customer.

metadataMetafield[] | null

Metafield values on the cart. The API sends them only when you ask for the metadata expand. The shape is on the Metafields page.

onboardingTemplateIdnumber | null

ID of the onboarding template applied to the cart.

Javascript
Javascript
expandoptionalstring[]

Relations to include. parent loads the parent product of each offered variant or plan.

stepFunnelStep | null

The offer to show. null means there is nothing left to offer.

idnumber

ID of the step. Send it back as funnelStepId when you accept or skip it.

titlestring

Headline of the offer.

descriptionstring | null

Body text of the offer.

typeFunnelType

Where the step belongs: funnel_pre_purchase, funnel_mid_purchase, funnel_post_purchase or funnel_post_purchase_complete.

initialboolean

Whether this is the first step of the funnel.

addonboolean

Whether the products join the cart as add-ons to a subscription.

addonDurationnumber | null

How long an add-on lasts: 1 once, 0 forever.

externalUrlstring | null

A page of your own to send the customer to instead of drawing the offer.

offerFunnelOffer

What the step sells.

type'single' | 'multiple' | 'one_click'

How many products the customer may take: one of them, several, or the whole offer in one click.

amountOffnumber | null

Discount off the price, in the minor unit of the currency.

percentOffnumber | null

Discount off the price, as a percentage.

productsProduct[]

The variants and plans on offer. Send the id of the one the customer picked as productId.

skipAnsweredSurveyboolean

Whether to reuse the survey answers already on the cart rather than ask again.

Javascript
offersRequiredFunnelOfferPayload[]

One entry per product taken.

productIdRequirednumber

The variant or plan the customer picked.

optionsoptionalSubscriptionSurveyOption[]

Survey answers, when the offered plan has a survey.

shippingAddressIdoptionalnumber | null

Address to ship to. Send it when the checkout did not set one.

shippingMethodIdoptionalnumber | null

Delivery option to use. Send it when the checkout did not set one.

paymentIntentIdoptionalstring | null

The payment intent you confirmed, when you retry after 3-D Secure.

expandoptionalstring[]

Relations to include, such as subscription.product and order.metadata.

invoicePurchaseInvoice | null

The invoice raised for the charge. null when nothing is charged yet, as for a subscription that starts on a future date.

subscriptionSubscription | null

The subscription created. null when the cart held one-time products only. The full shape is on the Subscriptions page; the fields you need right after a purchase are below.

idnumber

ID of the subscription.

customerIdnumber

ID of the customer.

productIdnumber

ID of the plan the customer subscribed to.

quantitynumber

How many.

currencyCodestring

Currency of the subscription.

statusstring

active, trial, pre_order, gift_waiting_to_start, cancelled, switched or expired.

activeboolean

true while the subscription bills.

startsAtstring

When the subscription starts.

nextPaymentDatestring

When the next charge happens.

nextShipmentAtstring | null

When the next shipment goes out.

paymentMethodIdnumber

ID of the payment method charged.

createdAtstring

When the subscription was created.

ordersPurchaseOrder[] | null

The orders created for the shipments. null, never an empty array, when there are none.

Javascript
Javascript
amountnumber

Amount taken from the balance.

currencyCodestring

Currency of that amount.

idstring

UUID of the line. This is the cartItemId you pass to subbly.cart.updateItem and subbly.cart.removeItem.

typestring

one_time or subscription. It decides what product and options hold.

productIdnumber

ID of the product on this line: a variant ID for a one-time item, a plan ID for a subscription.

productProductVariant | ProductPlan | null

The product itself. The API sends it only when you ask for the items.product expand. A ProductVariant for a one-time line, a ProductPlan for a subscription line; both are written out on the Products page.

productNamestring

Name of the product, as it was when the line was added.

descriptionstring

Line description, such as the variant options.

quantitynumber

How many.

statusstring | null

active, unavailable or out_of_stock. Show a warning for anything but active.

addonboolean

true when the line rides along with a subscription in the cart.

addonDurationnumber | null

How long the add-on lasts: 1 for one charge, 0 for every charge.

amountOffnumber | null

Fixed discount on this line, in the minor unit of the cart currency.

percentOffnumber | null

Percentage discount on this line.

giftCardobject

Who the gift card goes to. Always an object; every member is null when the line is not a gift card.

bundleobject

What the customer picked inside a bundle. Always an object; items is empty when the line is not a bundle.

optionsobject | null

The survey answers for a subscription line. null on a one-time line.

metadataMetafield[] | null

Metafield values saved on the line. The API sends them only when you ask for the items.metadata expand. The shape is on the Metafields page.

originstring | null

Where the line came from: pre_purchase, mid_purchase, post_purchase or coupon. null when the customer added it.

createdAtstring

When the line was added.

updatedAtstring

When the line last changed.

typestring

What the line charges for: one_time, subscription, trial_first, gift_card, setup_fee, survey, shipping or addon. The older tax value is no longer sent.

itemIdstring | null

ID of the CartItem this line prices. null on a shipping line.

productIdnumber | null

ID of the product priced. null on a shipping line.

quantitynumber

How many.

pricenumber

Unit price, in the minor unit of the cart currency.

subTotalnumber

Price before discount and tax.

totalnumber

What the customer pays for this line.

discountnumber | null

Total discount on the line.

discountsobject[]

The discounts that make up discount.

taxAmountnumber

Tax on the line.

taxRatenumber

Tax rate used for the line.

taxInclusiveboolean

true when price already contains the tax.

chargeNowboolean

true when the line is charged at checkout, false when it is charged on a later renewal.

subscriptionobject | null

Billing and shipping dates. Set on subscription and trial_first lines, null on the rest.

firstPaymentAtstring | null

When the first charge happens.

nextPaymentAtstring | null

When the next charge happens.

firstShipmentAtstring | null

When the first shipment goes out.

numberOfShipmentsnumber | null

How many shipments the plan covers.

bundleobject | null

The priced bundle contents. Set on one_time, addon, gift_card, subscription and trial_first lines, null on the rest.

typestring

coupon, coupon_gift_offer, offer, referral, balance, gift_card or bundle.

descriptionstring

Text to show the customer.

totalnumber

Amount taken off.

chargeNowboolean

true when the discount applies to this charge, false when it applies to a renewal.

firstNamestring | null

Given name.

lastNamestring | null

Family name.

emailstring | null

Email address.

marketingConsentboolean | null

Whether the guest agreed to marketing email.

tosConsentAtstring | null

When the guest accepted the terms.

externalIdstring | null

Your own ID for this guest.

activeSubscriptionsCountnumber

Always 0 for a guest.

idnull

Always null.

userIdnull

Always null.

createdAtnull

Always null.

idnumber

ID of the coupon.

couponIdstring

The public code a customer types, such as WELCOME10.

namestring

Name of the coupon in Subbly Admin.

amountOffnumber | null

Fixed amount taken off, in the minor unit of the currency. null when the coupon is a percentage.

percentOffnumber | null

Percentage taken off. null when the coupon is a fixed amount.

durationstring

How long the discount lasts: once, forever or multiple.

durationInMonthsnumber | null

How many months the discount lasts. Set only when duration is multiple.

behaviorobject

What the coupon changes about checkout.

skipPaymentMethodAllowedboolean

true when the cart total drops to zero and the customer can check out with no payment method.

giftobject | null

A free gift the coupon adds. null when the coupon gives no gift.

addonDurationstring

How long the gift rides along: once or forever.

amountOffnumber | null

Fixed amount taken off the gift, in the minor unit of the currency.

percentOffnumber | null

Percentage taken off the gift.

idnumber

ID of the gift card.

codestring

The code a customer types.

amountnumber

Face value, in the minor unit of the currency.

balancenumber

What is left to spend, in the minor unit of the currency.

messagestring

Message the buyer wrote for the recipient.

statusstring

One of issued, redeemed, partially_used, used, cancelled, expired.

startsAtstring | null

When the gift subscription starts. Pick a date from subbly.cart.getGiftingDates().

numberOfOrdersnumber | null

How many shipments the gift covers.

messagestring | null

Message for the recipient.

recipientEmailstring | null

Email of the recipient.

idnumber

ID of the address.

firstNamestring

Given name of the recipient.

lastNamestring

Family name of the recipient.

companyNamestring | null

Company name, when the shop collects one.

phonestring

Phone number of the recipient.

addressOnestring

First address line.

addressTwostring | null

Second address line.

citystring

City.

regionstring

Region name.

regionIdnumber | null

ID of the region, when the country has a region list.

zipstring

Postal or ZIP code.

countrystring

Country name.

countryIdnumber

ID of the country.

countryCodestring

Two-letter ISO country code.

idnumber

ID of the method.

typestring

shipping_option, local_delivery or local_pickup.

shippingFeenumber

What the delivery costs now.

futureShippingFeenumber

What it costs on each later renewal.

customsFeenumber

Customs charge now. Sent on a shipping_option only.

futureCustomsFeenumber

Customs charge on each later renewal. Sent on a shipping_option only.

methodobject

The option behind the method: a carrier option, a local delivery or a pick-up point. subbly.cart.getShippingMethods and subbly.cart.getLocalPickups below write out all three shapes.

carrierobject | null

The carrier, with id, name and serviceCodes. Sent on a shipping_option only.

carrierIdnumber | null

ID of the carrier.

servicestring | null

The carrier service chosen.

prohibitedProductsnumber[]

IDs of products this method cannot carry.

idnumber

ID of the payment method. Pass it as paymentMethodId.

typestring

One of card, paypal, us_bank_account, bancontact, sofort, ideal, cashapp, link, sepa_debit, acss_debit. Only the matching detail object below is set.

identifierstring

Reference to the method on the payment gateway.

createdAtstring | null

When the customer saved the method.

cardobject | null

Card details. Set when type is card.

usBankAccountobject | null

US bank account details. Set when type is us_bank_account.

acssDebitobject | null

Canadian pre-authorised debit details. Set when type is acss_debit.

bancontactobject | null

Bancontact details. Set when type is bancontact. Fields: name and email, both string.

cashappobject | null

Cash App details. Set when type is cashapp. Fields: name, email, buyerId and cashTag, all string.

idealobject | null

iDEAL details. Set when type is ideal. Fields: bank, bic, name and email, all string.

linkobject | null

Link details. Set when type is link. Fields: name and email, both string.

sepaDebitobject | null

SEPA direct debit details. Set when type is sepa_debit. Fields: name, email, country, ibanLast4, bankCode and branchCode, all string. The TypeScript type spells the last two bank_code and branch_code; the API sends them camel-cased.

sofortobject | null

SOFORT details. Set when type is sofort. Fields: name, email and country, all string.

amountnumber

Amount taken from the balance.

currencyCodestring

Currency of that amount.

idstring

UUID of the line. This is the cartItemId you pass to subbly.cart.updateItem and subbly.cart.removeItem.

typestring

one_time or subscription. It decides what product and options hold.

productIdnumber

ID of the product on this line: a variant ID for a one-time item, a plan ID for a subscription.

productProductVariant | ProductPlan | null

The product itself. The API sends it only when you ask for the items.product expand. A ProductVariant for a one-time line, a ProductPlan for a subscription line; both are written out on the Products page.

productNamestring

Name of the product, as it was when the line was added.

descriptionstring

Line description, such as the variant options.

quantitynumber

How many.

statusstring | null

active, unavailable or out_of_stock. Show a warning for anything but active.

addonboolean

true when the line rides along with a subscription in the cart.

addonDurationnumber | null

How long the add-on lasts: 1 for one charge, 0 for every charge.

amountOffnumber | null

Fixed discount on this line, in the minor unit of the cart currency.

percentOffnumber | null

Percentage discount on this line.

giftCardobject

Who the gift card goes to. Always an object; every member is null when the line is not a gift card.

bundleobject

What the customer picked inside a bundle. Always an object; items is empty when the line is not a bundle.

optionsobject | null

The survey answers for a subscription line. null on a one-time line.

metadataMetafield[] | null

Metafield values saved on the line. The API sends them only when you ask for the items.metadata expand. The shape is on the Metafields page.

originstring | null

Where the line came from: pre_purchase, mid_purchase, post_purchase or coupon. null when the customer added it.

createdAtstring

When the line was added.

updatedAtstring

When the line last changed.

typestring

What the line charges for: one_time, subscription, trial_first, gift_card, setup_fee, survey, shipping or addon. The older tax value is no longer sent.

itemIdstring | null

ID of the CartItem this line prices. null on a shipping line.

productIdnumber | null

ID of the product priced. null on a shipping line.

quantitynumber

How many.

pricenumber

Unit price, in the minor unit of the cart currency.

subTotalnumber

Price before discount and tax.

totalnumber

What the customer pays for this line.

discountnumber | null

Total discount on the line.

discountsobject[]

The discounts that make up discount.

taxAmountnumber

Tax on the line.

taxRatenumber

Tax rate used for the line.

taxInclusiveboolean

true when price already contains the tax.

chargeNowboolean

true when the line is charged at checkout, false when it is charged on a later renewal.

subscriptionobject | null

Billing and shipping dates. Set on subscription and trial_first lines, null on the rest.

firstPaymentAtstring | null

When the first charge happens.

nextPaymentAtstring | null

When the next charge happens.

firstShipmentAtstring | null

When the first shipment goes out.

numberOfShipmentsnumber | null

How many shipments the plan covers.

bundleobject | null

The priced bundle contents. Set on one_time, addon, gift_card, subscription and trial_first lines, null on the rest.

typestring

coupon, coupon_gift_offer, offer, referral, balance, gift_card or bundle.

descriptionstring

Text to show the customer.

totalnumber

Amount taken off.

chargeNowboolean

true when the discount applies to this charge, false when it applies to a renewal.

firstNamestring | null

Given name.

lastNamestring | null

Family name.

emailstring | null

Email address.

marketingConsentboolean | null

Whether the guest agreed to marketing email.

tosConsentAtstring | null

When the guest accepted the terms.

externalIdstring | null

Your own ID for this guest.

activeSubscriptionsCountnumber

Always 0 for a guest.

idnull

Always null.

userIdnull

Always null.

createdAtnull

Always null.

idnumber

ID of the coupon.

couponIdstring

The public code a customer types, such as WELCOME10.

namestring

Name of the coupon in Subbly Admin.

amountOffnumber | null

Fixed amount taken off, in the minor unit of the currency. null when the coupon is a percentage.

percentOffnumber | null

Percentage taken off. null when the coupon is a fixed amount.

durationstring

How long the discount lasts: once, forever or multiple.

durationInMonthsnumber | null

How many months the discount lasts. Set only when duration is multiple.

behaviorobject

What the coupon changes about checkout.

skipPaymentMethodAllowedboolean

true when the cart total drops to zero and the customer can check out with no payment method.

giftobject | null

A free gift the coupon adds. null when the coupon gives no gift.

addonDurationstring

How long the gift rides along: once or forever.

amountOffnumber | null

Fixed amount taken off the gift, in the minor unit of the currency.

percentOffnumber | null

Percentage taken off the gift.

idnumber

ID of the gift card.

codestring

The code a customer types.

amountnumber

Face value, in the minor unit of the currency.

balancenumber

What is left to spend, in the minor unit of the currency.

messagestring

Message the buyer wrote for the recipient.

statusstring

One of issued, redeemed, partially_used, used, cancelled, expired.

startsAtstring | null

When the gift subscription starts. Pick a date from subbly.cart.getGiftingDates().

numberOfOrdersnumber | null

How many shipments the gift covers.

messagestring | null

Message for the recipient.

recipientEmailstring | null

Email of the recipient.

idnumber

ID of the address.

firstNamestring

Given name of the recipient.

lastNamestring

Family name of the recipient.

companyNamestring | null

Company name, when the shop collects one.

phonestring

Phone number of the recipient.

addressOnestring

First address line.

addressTwostring | null

Second address line.

citystring

City.

regionstring

Region name.

regionIdnumber | null

ID of the region, when the country has a region list.

zipstring

Postal or ZIP code.

countrystring

Country name.

countryIdnumber

ID of the country.

countryCodestring

Two-letter ISO country code.

idnumber

ID of the method.

typestring

shipping_option, local_delivery or local_pickup.

shippingFeenumber

What the delivery costs now.

futureShippingFeenumber

What it costs on each later renewal.

customsFeenumber

Customs charge now. Sent on a shipping_option only.

futureCustomsFeenumber

Customs charge on each later renewal. Sent on a shipping_option only.

methodobject

The option behind the method: a carrier option, a local delivery or a pick-up point. subbly.cart.getShippingMethods and subbly.cart.getLocalPickups below write out all three shapes.

carrierobject | null

The carrier, with id, name and serviceCodes. Sent on a shipping_option only.

carrierIdnumber | null

ID of the carrier.

servicestring | null

The carrier service chosen.

prohibitedProductsnumber[]

IDs of products this method cannot carry.

idnumber

ID of the payment method. Pass it as paymentMethodId.

typestring

One of card, paypal, us_bank_account, bancontact, sofort, ideal, cashapp, link, sepa_debit, acss_debit. Only the matching detail object below is set.

identifierstring

Reference to the method on the payment gateway.

createdAtstring | null

When the customer saved the method.

cardobject | null

Card details. Set when type is card.

usBankAccountobject | null

US bank account details. Set when type is us_bank_account.

acssDebitobject | null

Canadian pre-authorised debit details. Set when type is acss_debit.

bancontactobject | null

Bancontact details. Set when type is bancontact. Fields: name and email, both string.

cashappobject | null

Cash App details. Set when type is cashapp. Fields: name, email, buyerId and cashTag, all string.

idealobject | null

iDEAL details. Set when type is ideal. Fields: bank, bic, name and email, all string.

linkobject | null

Link details. Set when type is link. Fields: name and email, both string.

sepaDebitobject | null

SEPA direct debit details. Set when type is sepa_debit. Fields: name, email, country, ibanLast4, bankCode and branchCode, all string. The TypeScript type spells the last two bank_code and branch_code; the API sends them camel-cased.

sofortobject | null

SOFORT details. Set when type is sofort. Fields: name, email and country, all string.

idnumber

ID of the invoice.

customerIdnumber

ID of the customer charged.

subscriptionIdnumber | null

ID of the subscription the invoice belongs to.

descriptionstring

What the invoice is for.

statusstring

Payment state of the invoice, such as paid.

currencyCodestring

Currency of the amounts below.

subTotalnumber

Sum of the lines before discount and tax, in the minor unit of the currency.

taxAmountnumber

Total tax.

discountsAmountnumber

Total taken off.

discountsunknown[]

The discounts behind discountsAmount.

adjustmentnumber

A manual correction. It may be negative.

totalnumber

What the customer paid.

itemsInvoiceItem[]

The charged lines.

paidAtstring | null

When the invoice was paid.

periodStartstring | null

Start of the period the invoice covers.

periodEndstring | null

End of the period the invoice covers.

firstShipmentAtstring | null

When the first shipment goes out.

shippingDetailsobject

How the shipments are scheduled.

periodStartstring | null

Start of the shipping period.

shipImmediatelyboolean

true when the first shipment goes out at once.

numberOfShipmentsnumber

How many shipments the invoice covers.

shippingAddressIdnumber | null

ID of the delivery address.

billingAddressIdnumber | null

ID of the billing address.

shippingMethodIdnumber | null

ID of the delivery option used.

metadataMetafield[] | null

Metafield values on the invoice. The API sends them only when you ask for the invoice.metadata expand.

createdAtstring

When the invoice was created.

updatedAtstring

When the invoice last changed.

idnumber

ID of the order.

invoiceIdnumber

ID of the invoice the order was raised from.

customerIdnumber

ID of the customer.

subscriptionIdnumber | null

ID of the subscription the order belongs to.

statusstring

Fulfilment state, such as Awaiting Delivery.

currencyCodestring

Currency of the amounts below.

subTotalnumber

Sum of the lines before tax, in the minor unit of the currency.

taxAmountnumber

Total tax.

adjustmentnumber

A manual correction.

totalnumber

Total value of the order.

discountsunknown[]

The discounts on the order.

dueDatestring | null

When the order is due to ship.

giftunknown | null

Gift details for the order.

itemsOrderItem[]

The lines to fulfil. Same fields as an invoice line, without digital, giftCard, taxInclusive and addonId.

shippingItemsunknown[]

The shipping lines on the order.

shippingAddressIdnumber | null

ID of the delivery address.

shippingMethodIdnumber | null

ID of the delivery option used.

metadataMetafield[] | null

Metafield values on the order. The API sends them only when you ask for the order.metadata expand.

createdAtstring

When the order was created.

updatedAtstring

When the order last changed.

customerEmailstring | null

Email of the recipient.

customerNamestring | null

Name of the recipient.

messagestring | null

Message for the recipient.

itemsBundleItem[]

The picked bundle items. Each carries id, productId, product, quantity, extraPrice, position, stockCount and settings, written out on the Bundles page.

preferencesobject[]

The bundle preferences the customer chose.

attributeIdnumber

ID of the preference attribute.

valuesnumber[]

IDs of the chosen values.

surveyIdnumber

ID of the survey that was answered.

itemsCountnumber

How many products the answers resolve to.

dataobject[]

One entry per answered question.

questionIdnumber

ID of the question.

answersobject[]

The answers. Each is { content } for a text or email question, { id } for a select, multiple, offer or plan question, or { id, quantity } for a quantity question.

itemsobject[]

The products the answers resolve to. Each carries id, productId and surveyId, all number.

typestring

coupon, coupon_gift_offer, offer, referral, balance, gift_card or bundle.

descriptionstring

Text to show the customer.

totalnumber

Amount taken off.

itemsobject[]

One entry per picked bundle item.

itemIdstring

ID of the bundle item.

productIdnumber

ID of the product.

variantIdnumber

ID of the variant.

quantitynumber

How many inside one bundle.

quantityTotalnumber

How many across every bundle on the line.

pricenumber

Unit price.

subTotalnumber

Price before discount and tax.

totalnumber

What this item adds to the line.

discountnumber | null

Discount on this item.

discountsobject[]

The discounts behind discount, each with type, description and total.

taxAmountnumber

Tax on this item.

taxRatenumber

Tax rate used.

taxInclusiveboolean

true when price already contains the tax.

brandstring

Card brand, such as visa or mastercard.

lastFourstring

Last four digits. The TypeScript type calls this field last4, but the API sends lastFour; read lastFour.

expiryMonthstring

Expiry month, two digits.

expiryYearstring

Expiry year.

typestring

Funding type of the card, such as credit or debit.

accountHolderTypestring

company or individual.

accountTypestring

checking or savings.

bankNamestring

Name of the bank.

namestring

Name on the account.

emailstring

Email on the account.

last4string

Last four digits of the account number.

routingNumberstring

Routing number.

namestring

Name on the account.

emailstring

Email on the account.

bankNamestring

Name of the bank.

lastFourstring

Last four digits of the account number.

institutionNumberstring

Institution number.

transitNumberstring

Transit number.

customerEmailstring | null

Email of the recipient.

customerNamestring | null

Name of the recipient.

messagestring | null

Message for the recipient.

itemsBundleItem[]

The picked bundle items. Each carries id, productId, product, quantity, extraPrice, position, stockCount and settings, written out on the Bundles page.

preferencesobject[]

The bundle preferences the customer chose.

attributeIdnumber

ID of the preference attribute.

valuesnumber[]

IDs of the chosen values.

surveyIdnumber

ID of the survey that was answered.

itemsCountnumber

How many products the answers resolve to.

dataobject[]

One entry per answered question.

questionIdnumber

ID of the question.

answersobject[]

The answers. Each is { content } for a text or email question, { id } for a select, multiple, offer or plan question, or { id, quantity } for a quantity question.

itemsobject[]

The products the answers resolve to. Each carries id, productId and surveyId, all number.

typestring

coupon, coupon_gift_offer, offer, referral, balance, gift_card or bundle.

descriptionstring

Text to show the customer.

totalnumber

Amount taken off.

itemsobject[]

One entry per picked bundle item.

itemIdstring

ID of the bundle item.

productIdnumber

ID of the product.

variantIdnumber

ID of the variant.

quantitynumber

How many inside one bundle.

quantityTotalnumber

How many across every bundle on the line.

pricenumber

Unit price.

subTotalnumber

Price before discount and tax.

totalnumber

What this item adds to the line.

discountnumber | null

Discount on this item.

discountsobject[]

The discounts behind discount, each with type, description and total.

taxAmountnumber

Tax on this item.

taxRatenumber

Tax rate used.

taxInclusiveboolean

true when price already contains the tax.

brandstring

Card brand, such as visa or mastercard.

lastFourstring

Last four digits. The TypeScript type calls this field last4, but the API sends lastFour; read lastFour.

expiryMonthstring

Expiry month, two digits.

expiryYearstring

Expiry year.

typestring

Funding type of the card, such as credit or debit.

accountHolderTypestring

company or individual.

accountTypestring

checking or savings.

bankNamestring

Name of the bank.

namestring

Name on the account.

emailstring

Email on the account.

last4string

Last four digits of the account number.

routingNumberstring

Routing number.

namestring

Name on the account.

emailstring

Email on the account.

bankNamestring

Name of the bank.

lastFourstring

Last four digits of the account number.

institutionNumberstring

Institution number.

transitNumberstring

Transit number.

idnumber

ID of the line.

typestring

What the line charges for: one_time, subscription, trial_first, gift_card, setup_fee, survey, shipping or addon.

descriptionstring

Text to show the customer.

productIdnumber

ID of the product charged.

productProduct | null

The product itself. The API sends it only when you ask for the matching expand. Its fields are on the Products page.

quantitynumber

How many.

amountnumber

What the line came to.

discountAmountnumber

Amount taken off the line.

taxAmountnumber

Tax on the line.

taxRatenumber

Tax rate used.

taxInclusiveboolean

true when amount already contains the tax.

digitalboolean

true when nothing is shipped for this line.

giftCardobject | null

Who a gift card goes to, with customerEmail, customerName and message.

addonIdnumber | null

ID of the add-on the line came from.

subscriptionIdnumber | null

ID of the subscription the line belongs to.

subscriptionItemIdnumber | null

ID of the subscription item the line belongs to.

surveySurvey | null

The survey answered for this line. Its fields are on the Surveys page.

preferencesunknown | null

The preferences chosen for this line.

bundleobject

What was inside a bundle on this line. Always an object; items is empty when the line is not a bundle. Each item carries id, productId, product, variantId, variant, description, quantity, amount, discountAmount, taxAmount, taxRate, taxInclusive, createdAt and updatedAt.

metadataMetafield[] | null

Metafield values on the line. The API sends them only when you ask for the invoice.items.metadata expand.

createdAtstring

When the line was created.

updatedAtstring

When the line last changed.