Order API

Type

Subscription1

A full current snapshot of one subscription.

Send the complete current values for all required fields whenever the subscription changes. Cycle information is optional and supports three forms described in the custom subscription programs guide.

Kind Type
Used in UpdateSubscriptions1

Properties

  • id string required

    Stable primary subscription ID assigned by the subscription system.

  • ecomm_id string optional

    Distinct ID assigned to the same subscription by a separate ecommerce system.

    Omit this field when there is no separate ecommerce system or it does not assign a different subscription ID.

  • created_at time required

    Time when the subscription was created.

  • updated_at time required

    Time of this subscription revision. Advance it whenever the subscription changes.

    When Bubblehouse uses your subscription data to calculate milestone progress, each changed subscription snapshot must have a newer updated_at. Bubblehouse uses this timestamp to order changes to status, completed-cycle count, next billing date, and identities in lines. For lines, products, variants, and selling plans, both subscription-system and ecommerce IDs are compared; for groups, only the subscription-system ID is compared. Line order does not matter. Preserve the original timestamp when retrying the same revision; use enough precision to distinguish changes made within the same second.

    A newer timestamp allows progress to change. An older timestamp leaves the accepted progress unchanged. The same timestamp with identical progress is a safe replay; the same timestamp with different progress is rejected with conflicting subscription progress at the accepted updated_at. This prevents delayed or out-of-order snapshots from overwriting newer progress.

    Refunds and count corrections require a newer updated_at, even if no other subscription fields change. A webhook's occurred_at does not replace the subscription snapshot's updated_at.

    See update timestamps and refunds for an example and the distinction between a successful request and an accepted subscription update.

  • cancelled_at time optional

    Time when the subscription was cancelled.

  • last_billing_attempt_at time optional

    Time of the latest billing attempt.

  • next_billing_attempt_at time optional

    Expected time of the next billing attempt.

  • paused_at time optional

    Time when the subscription was paused.

  • paused_until time optional

    Time when the paused subscription is expected to resume.

  • dunning_started_at time optional

    Time when payment-recovery attempts started.

  • dunning_exited_at time optional

    Time when payment-recovery attempts ended.

  • churned_at time optional

    Time when the subscription churned.

  • customer Customer2 required

    Customer who owns the subscription.

    Provide a stable customer ID and any current customer data available to your integration.

  • lines array of SubscriptionLine1 required

    Current subscription lines. Send an empty array when the subscription has no lines.

  • currency string optional

    ISO 4217 currency code for subscription amounts.

  • status SubscriptionStatus required

    Current subscription status.

  • cycles_completed integer optional

    Known number of successfully billed cycles.

    Zero is a known value. Omit this field when cycle progress is unknown. When supplied with cycles, this count is authoritative and the detailed list may be incomplete.

  • non_ecommerce boolean optional

    Whether detailed cycles act as the purchase source instead of ecommerce orders.

    Use this only when subscription charges are not also sent through the order API. Bubblehouse can use cycle amounts for spend and point accrual when configured for this mode.

  • referral_code string optional

    Referral correlation code captured from the friend's referral link.

    Send the code generated by Bubblehouse with an active subscription to attribute the referral. Customer identity can consist of customer.id alone; email and other personal data are not required.

    This field only matches referral codes. It does not create or redeem a discount in the subscription system and does not require discount_codes, orders, or cycle details.

    The last non-empty code is retained when omitted or empty in later snapshots. A code received while the subscription is inactive can qualify when an active snapshot arrives. Unknown codes, self-referrals, and blocked referral contacts do not qualify. An existing referral is not reassigned by a later code.

    Configured referral eligibility rules and reward delays still apply. For an ID-only subscription program, configure internal referral codes and subscription-appropriate eligibility rules; configure a 30-day reward delay if required by the program.

    A cancelled snapshot voids a pending referral linked to that subscription, including when this field is omitted. A rejected referral does not revive on reactivation. Cancelling another subscription does not void the referral. Rewards already released are not reversed, and a refund alone is not represented by this field.

  • discount_codes array of string optional

    Coupon codes used by the subscription.

    Include these only when the same codes are not sent on matching orders.

  • cycles array of SubscriptionCycle1 optional

    Known completed and scheduled cycle details.

    Include upcoming scheduled cycles when available. If cycles_completed is omitted, Bubblehouse derives it from completed entries and therefore expects the completed details to be cumulative. An explicit empty array without cycles_completed means zero successful cycles.

Previous
ProductVariantLocalization1