Class SubscriptionItem

All Implemented Interfaces:
HasId, MetadataStore<SubscriptionItem>, StripeActiveObject, StripeObjectInterface

public class SubscriptionItem extends ApiResource implements HasId, MetadataStore<SubscriptionItem>
Subscription items allow you to create customer subscriptions with more than one plan, making it easy to represent complex billing relationships.
  • Constructor Details

    • SubscriptionItem

      public SubscriptionItem()
  • Method Details

    • getDiscounts

      public List<String> getDiscounts()
      Get IDs of expandable discounts object list.
    • setDiscounts

      public void setDiscounts(List<String> ids)
    • getDiscountObjects

      public List<Discount> getDiscountObjects()
      Get expanded discounts.
    • setDiscountObjects

      public void setDiscountObjects(List<Discount> objs)
    • create

      public static SubscriptionItem create(Map<String,Object> params) throws StripeException
      Adds a new item to an existing subscription. No existing items will be changed or replaced.
      Throws:
      StripeException
    • create

      public static SubscriptionItem create(Map<String,Object> params, RequestOptions options) throws StripeException
      Adds a new item to an existing subscription. No existing items will be changed or replaced.
      Throws:
      StripeException
    • create

      public static SubscriptionItem create(SubscriptionItemCreateParams params) throws StripeException
      Adds a new item to an existing subscription. No existing items will be changed or replaced.
      Throws:
      StripeException
    • create

      public static SubscriptionItem create(SubscriptionItemCreateParams params, RequestOptions options) throws StripeException
      Adds a new item to an existing subscription. No existing items will be changed or replaced.
      Throws:
      StripeException
    • delete

      public SubscriptionItem delete() throws StripeException
      Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
      Throws:
      StripeException
    • delete

      public SubscriptionItem delete(RequestOptions options) throws StripeException
      Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
      Throws:
      StripeException
    • delete

      public SubscriptionItem delete(Map<String,Object> params) throws StripeException
      Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
      Throws:
      StripeException
    • delete

      public SubscriptionItem delete(Map<String,Object> params, RequestOptions options) throws StripeException
      Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
      Throws:
      StripeException
    • delete

      Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
      Throws:
      StripeException
    • delete

      Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
      Throws:
      StripeException
    • list

      public static SubscriptionItemCollection list(Map<String,Object> params) throws StripeException
      Returns a list of your subscription items for a given subscription.
      Throws:
      StripeException
    • list

      public static SubscriptionItemCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of your subscription items for a given subscription.
      Throws:
      StripeException
    • list

      Returns a list of your subscription items for a given subscription.
      Throws:
      StripeException
    • list

      Returns a list of your subscription items for a given subscription.
      Throws:
      StripeException
    • retrieve

      public static SubscriptionItem retrieve(String item) throws StripeException
      Retrieves the subscription item with the given ID.
      Throws:
      StripeException
    • retrieve

      public static SubscriptionItem retrieve(String item, RequestOptions options) throws StripeException
      Retrieves the subscription item with the given ID.
      Throws:
      StripeException
    • retrieve

      public static SubscriptionItem retrieve(String item, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the subscription item with the given ID.
      Throws:
      StripeException
    • retrieve

      public static SubscriptionItem retrieve(String item, SubscriptionItemRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves the subscription item with the given ID.
      Throws:
      StripeException
    • update

      public SubscriptionItem update(Map<String,Object> params) throws StripeException
      Updates the plan or quantity of an item on a current subscription.
      Specified by:
      update in interface MetadataStore<SubscriptionItem>
      Throws:
      StripeException
    • update

      public SubscriptionItem update(Map<String,Object> params, RequestOptions options) throws StripeException
      Updates the plan or quantity of an item on a current subscription.
      Specified by:
      update in interface MetadataStore<SubscriptionItem>
      Throws:
      StripeException
    • update

      Updates the plan or quantity of an item on a current subscription.
      Throws:
      StripeException
    • update

      Updates the plan or quantity of an item on a current subscription.
      Throws:
      StripeException
    • usageRecordSummaries

      public UsageRecordSummaryCollection usageRecordSummaries() throws StripeException
      For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).

      The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.

      Throws:
      StripeException
    • usageRecordSummaries

      public UsageRecordSummaryCollection usageRecordSummaries(Map<String,Object> params) throws StripeException
      For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).

      The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.

      Throws:
      StripeException
    • usageRecordSummaries

      public UsageRecordSummaryCollection usageRecordSummaries(Map<String,Object> params, RequestOptions options) throws StripeException
      For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).

      The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.

      Throws:
      StripeException
    • usageRecordSummaries

      For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).

      The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.

      Throws:
      StripeException
    • usageRecordSummaries

      For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September).

      The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.

      Throws:
      StripeException
    • setResponseGetter

      public void setResponseGetter(StripeResponseGetter responseGetter)
      Description copied from interface: StripeActiveObject
      Method is used by the containing object or StripeResponseGetter implementations to set the StripeResponseGetter instance used to make further requests.
      Specified by:
      setResponseGetter in interface StripeActiveObject
      Overrides:
      setResponseGetter in class ApiResource
      Parameters:
      responseGetter - the StripeResponseGetter instance to use for making further requests.
    • getBillingThresholds

      public SubscriptionItem.BillingThresholds getBillingThresholds()
      Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period.
    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getDeleted

      public Boolean getDeleted()
      Always true for a deleted object.
    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to subscription_item.

    • getPlan

      public Plan getPlan()
      You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.

      Plans define the base price, currency, and billing cycle for recurring purchases of products. Products help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.

      For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.

      Related guides: Set up a subscription and more about products and prices.

    • getPrice

      public Price getPrice()
      Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.

      For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.

      Related guides: Set up a subscription, create an invoice, and more about products and prices.

    • getQuantity

      public Long getQuantity()
      The quantity of the plan to which the customer should be subscribed.
    • getSubscription

      public String getSubscription()
      The subscription this subscription_item belongs to.
    • getTaxRates

      public List<TaxRate> getTaxRates()
      The tax rates which apply to this subscription_item. When set, the default_tax_rates on the subscription do not apply to this subscription_item.
    • setBillingThresholds

      public void setBillingThresholds(SubscriptionItem.BillingThresholds billingThresholds)
      Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period.
    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setDeleted

      public void setDeleted(Boolean deleted)
      Always true for a deleted object.
    • setId

      public void setId(String id)
      Unique identifier for the object.
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to subscription_item.

    • setPlan

      public void setPlan(Plan plan)
      You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.

      Plans define the base price, currency, and billing cycle for recurring purchases of products. Products help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.

      For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.

      Related guides: Set up a subscription and more about products and prices.

    • setPrice

      public void setPrice(Price price)
      Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.

      For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.

      Related guides: Set up a subscription, create an invoice, and more about products and prices.

    • setQuantity

      public void setQuantity(Long quantity)
      The quantity of the plan to which the customer should be subscribed.
    • setSubscription

      public void setSubscription(String subscription)
      The subscription this subscription_item belongs to.
    • setTaxRates

      public void setTaxRates(List<TaxRate> taxRates)
      The tax rates which apply to this subscription_item. When set, the default_tax_rates on the subscription do not apply to this subscription_item.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the object.
      Specified by:
      getId in interface HasId
    • getMetadata

      public Map<String,String> getMetadata()
      Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
      Specified by:
      getMetadata in interface MetadataStore<SubscriptionItem>