Class Subscription
- All Implemented Interfaces:
HasId,MetadataStore<Subscription>,StripeActiveObject,StripeObjectInterface
Related guide: Creating subscriptions
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFor more details about AutomaticTax, please refer to the API Reference.static classFor more details about BillingCycleAnchorConfig, please refer to the API Reference.static classThe billing mode of the subscription.static classSets the billing schedule for the subscription.static classFor more details about BillingThresholds, please refer to the API Reference.static classFor more details about CancellationDetails, please refer to the API Reference.static classFor more details about InvoiceSettings, please refer to the API Reference.static classFor more details about LastPriceMigrationError, please refer to the API Reference.static classThe Pause Collection settings determine how we will pause collection for this subscription and for how long the subscription should be paused.static classFor more details about PaymentSettings, please refer to the API Reference.static classFor more details about PendingInvoiceItemInterval, please refer to the API Reference.static classPending Updates store the changes pending from a previous update that will be applied to the Subscription upon successful payment.static classPrebilling stores the time period and invoice for a Subscription billed in advance.static classFor more details about TransferData, please refer to the API Reference.static classConfigures how this subscription behaves during the trial period.Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod -
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON, INTERNAL_GSONFields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAttach a Billing Cadence to an existing subscription.attachCadence(SubscriptionAttachCadenceParams params, RequestOptions options) Attach a Billing Cadence to an existing subscription.attachCadence(Map<String, Object> params) Attach a Billing Cadence to an existing subscription.attachCadence(Map<String, Object> params, RequestOptions options) Attach a Billing Cadence to an existing subscription.cancel()Cancels a customer’s subscription immediately.cancel(SubscriptionCancelParams params) Cancels a customer’s subscription immediately.cancel(SubscriptionCancelParams params, RequestOptions options) Cancels a customer’s subscription immediately.Cancels a customer’s subscription immediately.cancel(Map<String, Object> params, RequestOptions options) Cancels a customer’s subscription immediately.protected booleanstatic Subscriptioncreate(SubscriptionCreateParams params) Creates a new subscription on an existing customer.static Subscriptioncreate(SubscriptionCreateParams params, RequestOptions options) Creates a new subscription on an existing customer.static SubscriptionCreates a new subscription on an existing customer.static Subscriptioncreate(Map<String, Object> params, RequestOptions options) Creates a new subscription on an existing customer.Removes the currently applied discount on a subscription.deleteDiscount(Map<String, Object> params) Removes the currently applied discount on a subscription.deleteDiscount(Map<String, Object> params, RequestOptions options) Removes the currently applied discount on a subscription.booleanGet ID of expandableapplicationobject.A non-negative decimal between 0 and 100, with at most two decimal places.Get expandedapplication.The Billing Cadence which controls the timing of recurring invoice generation for this subscription.If unset, the subscription will bill according to its own configured schedule and create its own invoices.If set, this subscription will be billed by the cadence instead, potentially sharing invoices with the other subscriptions linked to that Cadence.The reference point that aligns future billing cycle dates.The fixed values used to calculate thebilling_cycle_anchor.The billing mode of the subscription.Billing schedules for this subscription.Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.A date in the future at which the subscription will automatically get canceled.Whether this subscription will (ifstatus=active) or did (ifstatus=canceled) cancel at the end of the current billing period.If the subscription has been canceled, the date of that cancellation.Details about why this subscription was cancelled.Eithercharge_automatically, orsend_invoice.Time at which the object was created.Three-letter ISO currency code, in lowercase.Get ID of expandablecustomerobject.ID of the account who owns the subscription.Get expandedcustomer.Number of days a customer has to pay invoices generated by this subscription.Get ID of expandabledefaultPaymentMethodobject.Get expandeddefaultPaymentMethod.Get ID of expandabledefaultSourceobject.Get expandeddefaultSource.The tax rates that will apply to any subscription item that does not havetax_ratesset.The subscription's description, meant to be displayable to the customer.Get expandeddiscounts.Get IDs of expandablediscountsobject list.If the subscription has ended, the date the subscription ended.getId()Unique identifier for the object.getItems()List of subscription items, each with an attached price.Details of the most recent price migration that failed for the subscription.Get ID of expandablelatestInvoiceobject.Get expandedlatestInvoice.Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.Set of key-value pairs that you can attach to an object.Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided atpending_invoice_item_interval.String representing the object's type.Get ID of expandableonBehalfOfobject.Get expandedonBehalfOf.If specified, payment collection for this subscription will be paused.Payment settings passed on to invoices created by the subscription.Specifies an interval for how often to bill for any pending invoice items.Get ID of expandablependingSetupIntentobject.Get expandedpendingSetupIntent.If specified, pending updates that will be applied to the subscription once thelatest_invoicehas been paid.Time period and invoice for a Subscription billed in advance.Get ID of expandablescheduleobject.Get expandedschedule.Date when the subscription was first created.Possible values areincomplete,incomplete_expired,trialing,active,past_due,canceled,unpaid, orpaused.Get ID of expandabletestClockobject.Get expandedtestClock.The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.If the subscription has a trial, the end of that trial.Settings related to subscription trials.If the subscription has a trial, the beginning of that trial.inthashCode()static SubscriptionCollectionlist(SubscriptionListParams params) By default, returns a list of subscriptions that have not been canceled.static SubscriptionCollectionlist(SubscriptionListParams params, RequestOptions options) By default, returns a list of subscriptions that have not been canceled.static SubscriptionCollectionBy default, returns a list of subscriptions that have not been canceled.static SubscriptionCollectionlist(Map<String, Object> params, RequestOptions options) By default, returns a list of subscriptions that have not been canceled.migrate(SubscriptionMigrateParams params) Upgrade the billing_mode of an existing subscription.migrate(SubscriptionMigrateParams params, RequestOptions options) Upgrade the billing_mode of an existing subscription.Upgrade the billing_mode of an existing subscription.migrate(Map<String, Object> params, RequestOptions options) Upgrade the billing_mode of an existing subscription.resume()Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations.resume(RequestOptions options) Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations.resume(SubscriptionResumeParams params) Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations.resume(SubscriptionResumeParams params, RequestOptions options) Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations.Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations.resume(Map<String, Object> params, RequestOptions options) Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations.static SubscriptionRetrieves the subscription with the given ID.static Subscriptionretrieve(String subscriptionExposedId, RequestOptions options) Retrieves the subscription with the given ID.static Subscriptionretrieve(String subscriptionExposedId, SubscriptionRetrieveParams params, RequestOptions options) Retrieves the subscription with the given ID.static SubscriptionRetrieves the subscription with the given ID.static SubscriptionSearchResultsearch(SubscriptionSearchParams params) Search for subscriptions you’ve previously created using Stripe’s Search Query Language.static SubscriptionSearchResultsearch(SubscriptionSearchParams params, RequestOptions options) Search for subscriptions you’ve previously created using Stripe’s Search Query Language.static SubscriptionSearchResultSearch for subscriptions you’ve previously created using Stripe’s Search Query Language.static SubscriptionSearchResultsearch(Map<String, Object> params, RequestOptions options) Search for subscriptions you’ve previously created using Stripe’s Search Query Language.voidsetApplication(String id) voidsetApplicationFeePercent(BigDecimal applicationFeePercent) A non-negative decimal between 0 and 100, with at most two decimal places.voidsetApplicationObject(Application expandableObject) voidsetAutomaticTax(Subscription.AutomaticTax automaticTax) voidsetBillingCadence(String billingCadence) The Billing Cadence which controls the timing of recurring invoice generation for this subscription.If unset, the subscription will bill according to its own configured schedule and create its own invoices.If set, this subscription will be billed by the cadence instead, potentially sharing invoices with the other subscriptions linked to that Cadence.voidsetBillingCycleAnchor(Long billingCycleAnchor) The reference point that aligns future billing cycle dates.voidsetBillingCycleAnchorConfig(Subscription.BillingCycleAnchorConfig billingCycleAnchorConfig) The fixed values used to calculate thebilling_cycle_anchor.voidsetBillingMode(Subscription.BillingMode billingMode) The billing mode of the subscription.voidsetBillingSchedules(List<Subscription.BillingSchedule> billingSchedules) Billing schedules for this subscription.voidsetBillingThresholds(Subscription.BillingThresholds billingThresholds) Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.voidsetCancelAt(Long cancelAt) A date in the future at which the subscription will automatically get canceled.voidsetCancelAtPeriodEnd(Boolean cancelAtPeriodEnd) Whether this subscription will (ifstatus=active) or did (ifstatus=canceled) cancel at the end of the current billing period.voidsetCanceledAt(Long canceledAt) If the subscription has been canceled, the date of that cancellation.voidsetCancellationDetails(Subscription.CancellationDetails cancellationDetails) Details about why this subscription was cancelled.voidsetCollectionMethod(String collectionMethod) Eithercharge_automatically, orsend_invoice.voidsetCreated(Long created) Time at which the object was created.voidsetCurrency(String currency) Three-letter ISO currency code, in lowercase.voidsetCustomer(String id) voidsetCustomerAccount(String customerAccount) ID of the account who owns the subscription.voidsetCustomerObject(Customer expandableObject) voidsetDaysUntilDue(Long daysUntilDue) Number of days a customer has to pay invoices generated by this subscription.voidvoidsetDefaultPaymentMethodObject(PaymentMethod expandableObject) voidvoidsetDefaultSourceObject(PaymentSource expandableObject) voidsetDefaultTaxRates(List<TaxRate> defaultTaxRates) The tax rates that will apply to any subscription item that does not havetax_ratesset.voidsetDescription(String description) The subscription's description, meant to be displayable to the customer.voidsetDiscountObjects(List<Discount> objs) voidsetDiscounts(List<String> ids) voidsetEndedAt(Long endedAt) If the subscription has ended, the date the subscription ended.voidUnique identifier for the object.voidsetInvoiceSettings(Subscription.InvoiceSettings invoiceSettings) voidList of subscription items, each with an attached price.voidsetLastPriceMigrationError(Subscription.LastPriceMigrationError lastPriceMigrationError) Details of the most recent price migration that failed for the subscription.voidvoidsetLatestInvoiceObject(Invoice expandableObject) voidsetLivemode(Boolean livemode) Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidsetMetadata(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.voidsetNextPendingInvoiceItemInvoice(Long nextPendingInvoiceItemInvoice) Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided atpending_invoice_item_interval.voidString representing the object's type.voidsetOnBehalfOf(String id) voidsetOnBehalfOfObject(Account expandableObject) voidsetPauseCollection(Subscription.PauseCollection pauseCollection) If specified, payment collection for this subscription will be paused.voidsetPaymentSettings(Subscription.PaymentSettings paymentSettings) Payment settings passed on to invoices created by the subscription.voidsetPendingInvoiceItemInterval(Subscription.PendingInvoiceItemInterval pendingInvoiceItemInterval) Specifies an interval for how often to bill for any pending invoice items.voidvoidsetPendingSetupIntentObject(SetupIntent expandableObject) voidsetPendingUpdate(Subscription.PendingUpdate pendingUpdate) If specified, pending updates that will be applied to the subscription once thelatest_invoicehas been paid.voidsetPrebilling(Subscription.Prebilling prebilling) Time period and invoice for a Subscription billed in advance.voidsetResponseGetter(StripeResponseGetter responseGetter) Indicates how the subscription should change when the trial ends if the user did not provide a payment method.voidsetSchedule(String id) voidsetScheduleObject(SubscriptionSchedule expandableObject) voidsetStartDate(Long startDate) Date when the subscription was first created.voidPossible values areincomplete,incomplete_expired,trialing,active,past_due,canceled,unpaid, orpaused.voidsetTestClock(String id) voidsetTestClockObject(TestClock expandableObject) voidsetTransferData(Subscription.TransferData transferData) The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.voidsetTrialEnd(Long trialEnd) If the subscription has a trial, the end of that trial.voidsetTrialSettings(Subscription.TrialSettings trialSettings) Settings related to subscription trials.voidsetTrialStart(Long trialStart) If the subscription has a trial, the beginning of that trial.update(SubscriptionUpdateParams params) Updates an existing subscription to match the specified parameters.update(SubscriptionUpdateParams params, RequestOptions options) Updates an existing subscription to match the specified parameters.Updates an existing subscription to match the specified parameters.update(Map<String, Object> params, RequestOptions options) Updates an existing subscription to match the specified parameters.Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setGlobalResponseGetter, urlEncode, urlEncodeIdMethods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
Subscription
public Subscription()
-
-
Method Details
-
getApplication
Get ID of expandableapplicationobject. -
setApplication
-
getApplicationObject
Get expandedapplication. -
setApplicationObject
-
getCustomer
Get ID of expandablecustomerobject. -
setCustomer
-
getCustomerObject
Get expandedcustomer. -
setCustomerObject
-
getDefaultPaymentMethod
Get ID of expandabledefaultPaymentMethodobject. -
setDefaultPaymentMethod
-
getDefaultPaymentMethodObject
Get expandeddefaultPaymentMethod. -
setDefaultPaymentMethodObject
-
getDefaultSource
Get ID of expandabledefaultSourceobject. -
setDefaultSource
-
getDefaultSourceObject
Get expandeddefaultSource. -
setDefaultSourceObject
-
getLatestInvoice
Get ID of expandablelatestInvoiceobject. -
setLatestInvoice
-
getLatestInvoiceObject
Get expandedlatestInvoice. -
setLatestInvoiceObject
-
getOnBehalfOf
Get ID of expandableonBehalfOfobject. -
setOnBehalfOf
-
getOnBehalfOfObject
Get expandedonBehalfOf. -
setOnBehalfOfObject
-
getPendingSetupIntent
Get ID of expandablependingSetupIntentobject. -
setPendingSetupIntent
-
getPendingSetupIntentObject
Get expandedpendingSetupIntent. -
setPendingSetupIntentObject
-
getSchedule
Get ID of expandablescheduleobject. -
setSchedule
-
getScheduleObject
Get expandedschedule. -
setScheduleObject
-
getTestClock
Get ID of expandabletestClockobject. -
setTestClock
-
getTestClockObject
Get expandedtestClock. -
setTestClockObject
-
getDiscounts
Get IDs of expandablediscountsobject list. -
setDiscounts
-
getDiscountObjects
Get expandeddiscounts. -
setDiscountObjects
-
attachCadence
Attach a Billing Cadence to an existing subscription. When attached, the subscription is billed by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the Billing Cadence.- Throws:
StripeException
-
attachCadence
public Subscription attachCadence(Map<String, Object> params, RequestOptions options) throws StripeExceptionAttach a Billing Cadence to an existing subscription. When attached, the subscription is billed by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the Billing Cadence.- Throws:
StripeException
-
attachCadence
Attach a Billing Cadence to an existing subscription. When attached, the subscription is billed by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the Billing Cadence.- Throws:
StripeException
-
attachCadence
public Subscription attachCadence(SubscriptionAttachCadenceParams params, RequestOptions options) throws StripeException Attach a Billing Cadence to an existing subscription. When attached, the subscription is billed by the Billing Cadence, potentially sharing invoices with the other subscriptions linked to the Billing Cadence.- Throws:
StripeException
-
cancel
Cancels a customer’s subscription immediately. The customer won’t be charged again for the subscription. After it’s canceled, you can no longer update the subscription or its metadata.Any pending invoice items that you’ve created are still charged at the end of the period, unless manually deleted. If you’ve set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if
invoice_nowandprorateare both set to true.By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
- Throws:
StripeException
-
cancel
Cancels a customer’s subscription immediately. The customer won’t be charged again for the subscription. After it’s canceled, you can no longer update the subscription or its metadata.Any pending invoice items that you’ve created are still charged at the end of the period, unless manually deleted. If you’ve set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if
invoice_nowandprorateare both set to true.By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
- Throws:
StripeException
-
cancel
public Subscription cancel(Map<String, Object> params, RequestOptions options) throws StripeExceptionCancels a customer’s subscription immediately. The customer won’t be charged again for the subscription. After it’s canceled, you can no longer update the subscription or its metadata.Any pending invoice items that you’ve created are still charged at the end of the period, unless manually deleted. If you’ve set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if
invoice_nowandprorateare both set to true.By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
- Throws:
StripeException
-
cancel
Cancels a customer’s subscription immediately. The customer won’t be charged again for the subscription. After it’s canceled, you can no longer update the subscription or its metadata.Any pending invoice items that you’ve created are still charged at the end of the period, unless manually deleted. If you’ve set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if
invoice_nowandprorateare both set to true.By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
- Throws:
StripeException
-
cancel
public Subscription cancel(SubscriptionCancelParams params, RequestOptions options) throws StripeException Cancels a customer’s subscription immediately. The customer won’t be charged again for the subscription. After it’s canceled, you can no longer update the subscription or its metadata.Any pending invoice items that you’ve created are still charged at the end of the period, unless manually deleted. If you’ve set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed if
invoice_nowandprorateare both set to true.By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
- Throws:
StripeException
-
create
Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.When you create a subscription with
collection_method=charge_automatically, the first invoice is finalized as part of the request. Thepayment_behaviorparameter determines the exact behavior of the initial payment.To start subscriptions where the first invoice always begins in a
draftstatus, use subscription schedules instead. Schedules provide the flexibility to model more complex billing configurations that change over time.- Throws:
StripeException
-
create
public static Subscription create(Map<String, Object> params, RequestOptions options) throws StripeExceptionCreates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.When you create a subscription with
collection_method=charge_automatically, the first invoice is finalized as part of the request. Thepayment_behaviorparameter determines the exact behavior of the initial payment.To start subscriptions where the first invoice always begins in a
draftstatus, use subscription schedules instead. Schedules provide the flexibility to model more complex billing configurations that change over time.- Throws:
StripeException
-
create
Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.When you create a subscription with
collection_method=charge_automatically, the first invoice is finalized as part of the request. Thepayment_behaviorparameter determines the exact behavior of the initial payment.To start subscriptions where the first invoice always begins in a
draftstatus, use subscription schedules instead. Schedules provide the flexibility to model more complex billing configurations that change over time.- Throws:
StripeException
-
create
public static Subscription create(SubscriptionCreateParams params, RequestOptions options) throws StripeException Creates a new subscription on an existing customer. Each customer can have up to 500 active or scheduled subscriptions.When you create a subscription with
collection_method=charge_automatically, the first invoice is finalized as part of the request. Thepayment_behaviorparameter determines the exact behavior of the initial payment.To start subscriptions where the first invoice always begins in a
draftstatus, use subscription schedules instead. Schedules provide the flexibility to model more complex billing configurations that change over time.- Throws:
StripeException
-
deleteDiscount
Removes the currently applied discount on a subscription.- Throws:
StripeException
-
deleteDiscount
Removes the currently applied discount on a subscription.- Throws:
StripeException
-
deleteDiscount
public Discount deleteDiscount(Map<String, Object> params, RequestOptions options) throws StripeExceptionRemoves the currently applied discount on a subscription.- Throws:
StripeException
-
list
By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specifystatus=canceled.- Throws:
StripeException
-
list
public static SubscriptionCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionBy default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specifystatus=canceled.- Throws:
StripeException
-
list
By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specifystatus=canceled.- Throws:
StripeException
-
list
public static SubscriptionCollection list(SubscriptionListParams params, RequestOptions options) throws StripeException By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specifystatus=canceled.- Throws:
StripeException
-
migrate
Upgrade the billing_mode of an existing subscription.- Throws:
StripeException
-
migrate
public Subscription migrate(Map<String, Object> params, RequestOptions options) throws StripeExceptionUpgrade the billing_mode of an existing subscription.- Throws:
StripeException
-
migrate
Upgrade the billing_mode of an existing subscription.- Throws:
StripeException
-
migrate
public Subscription migrate(SubscriptionMigrateParams params, RequestOptions options) throws StripeException Upgrade the billing_mode of an existing subscription.- Throws:
StripeException
-
resume
Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will becomeactive, and if payment fails the subscription will bepast_due. The resumption invoice will void automatically if not paid by the expiration date.- Throws:
StripeException
-
resume
Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will becomeactive, and if payment fails the subscription will bepast_due. The resumption invoice will void automatically if not paid by the expiration date.- Throws:
StripeException
-
resume
Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will becomeactive, and if payment fails the subscription will bepast_due. The resumption invoice will void automatically if not paid by the expiration date.- Throws:
StripeException
-
resume
public Subscription resume(Map<String, Object> params, RequestOptions options) throws StripeExceptionInitiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will becomeactive, and if payment fails the subscription will bepast_due. The resumption invoice will void automatically if not paid by the expiration date.- Throws:
StripeException
-
resume
Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will becomeactive, and if payment fails the subscription will bepast_due. The resumption invoice will void automatically if not paid by the expiration date.- Throws:
StripeException
-
resume
public Subscription resume(SubscriptionResumeParams params, RequestOptions options) throws StripeException Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will becomeactive, and if payment fails the subscription will bepast_due. The resumption invoice will void automatically if not paid by the expiration date.- Throws:
StripeException
-
retrieve
Retrieves the subscription with the given ID.- Throws:
StripeException
-
retrieve
public static Subscription retrieve(String subscriptionExposedId, RequestOptions options) throws StripeException Retrieves the subscription with the given ID.- Throws:
StripeException
-
retrieve
public static Subscription retrieve(String subscriptionExposedId, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves the subscription with the given ID.- Throws:
StripeException
-
retrieve
public static Subscription retrieve(String subscriptionExposedId, SubscriptionRetrieveParams params, RequestOptions options) throws StripeException Retrieves the subscription with the given ID.- Throws:
StripeException
-
search
Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.- Throws:
StripeException
-
search
public static SubscriptionSearchResult search(Map<String, Object> params, RequestOptions options) throws StripeExceptionSearch for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.- Throws:
StripeException
-
search
public static SubscriptionSearchResult search(SubscriptionSearchParams params) throws StripeException Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.- Throws:
StripeException
-
search
public static SubscriptionSearchResult search(SubscriptionSearchParams params, RequestOptions options) throws StripeException Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.- Throws:
StripeException
-
update
Updates an existing subscription to match the specified parameters. When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes. To preview how the proration is calculated, use the create preview endpoint.By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they’ll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they’ll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month’s 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
Switching prices does not normally change the billing date or generate an immediate charge unless:
- The billing interval is changed (for example, from monthly to yearly).
- The subscription moves from free to paid.
- A trial starts or ends.
In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how Stripe immediately attempts payment for subscription changes.
If you want to charge for an upgrade immediately, pass
proration_behaviorasalways_invoiceto create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you passcreate_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription’s renewal date, you need to manually invoice the customer.If you don’t want to prorate, set the
proration_behavioroption tonone. With this option, the customer is billed 100 on May 1 and 200 on June 1. Similarly, if you setproration_behaviortononewhen switching between different billing intervals (for example, from monthly to yearly), we don’t generate any credits for the old subscription’s unused time. We still reset the billing date and bill immediately for the new subscription.Updating the quantity on a subscription many times in an hour may result in rate limiting. If you need to bill for a frequently changing quantity, consider integrating usage-based billing instead.
- Specified by:
updatein interfaceMetadataStore<Subscription>- Throws:
StripeException
-
update
public Subscription update(Map<String, Object> params, RequestOptions options) throws StripeExceptionUpdates an existing subscription to match the specified parameters. When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes. To preview how the proration is calculated, use the create preview endpoint.By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they’ll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they’ll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month’s 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
Switching prices does not normally change the billing date or generate an immediate charge unless:
- The billing interval is changed (for example, from monthly to yearly).
- The subscription moves from free to paid.
- A trial starts or ends.
In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how Stripe immediately attempts payment for subscription changes.
If you want to charge for an upgrade immediately, pass
proration_behaviorasalways_invoiceto create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you passcreate_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription’s renewal date, you need to manually invoice the customer.If you don’t want to prorate, set the
proration_behavioroption tonone. With this option, the customer is billed 100 on May 1 and 200 on June 1. Similarly, if you setproration_behaviortononewhen switching between different billing intervals (for example, from monthly to yearly), we don’t generate any credits for the old subscription’s unused time. We still reset the billing date and bill immediately for the new subscription.Updating the quantity on a subscription many times in an hour may result in rate limiting. If you need to bill for a frequently changing quantity, consider integrating usage-based billing instead.
- Specified by:
updatein interfaceMetadataStore<Subscription>- Throws:
StripeException
-
update
Updates an existing subscription to match the specified parameters. When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes. To preview how the proration is calculated, use the create preview endpoint.By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they’ll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they’ll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month’s 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
Switching prices does not normally change the billing date or generate an immediate charge unless:
- The billing interval is changed (for example, from monthly to yearly).
- The subscription moves from free to paid.
- A trial starts or ends.
In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how Stripe immediately attempts payment for subscription changes.
If you want to charge for an upgrade immediately, pass
proration_behaviorasalways_invoiceto create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you passcreate_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription’s renewal date, you need to manually invoice the customer.If you don’t want to prorate, set the
proration_behavioroption tonone. With this option, the customer is billed 100 on May 1 and 200 on June 1. Similarly, if you setproration_behaviortononewhen switching between different billing intervals (for example, from monthly to yearly), we don’t generate any credits for the old subscription’s unused time. We still reset the billing date and bill immediately for the new subscription.Updating the quantity on a subscription many times in an hour may result in rate limiting. If you need to bill for a frequently changing quantity, consider integrating usage-based billing instead.
- Throws:
StripeException
-
update
public Subscription update(SubscriptionUpdateParams params, RequestOptions options) throws StripeException Updates an existing subscription to match the specified parameters. When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes. To preview how the proration is calculated, use the create preview endpoint.By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they’ll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they’ll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month’s 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
Switching prices does not normally change the billing date or generate an immediate charge unless:
- The billing interval is changed (for example, from monthly to yearly).
- The subscription moves from free to paid.
- A trial starts or ends.
In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how Stripe immediately attempts payment for subscription changes.
If you want to charge for an upgrade immediately, pass
proration_behaviorasalways_invoiceto create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you passcreate_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription’s renewal date, you need to manually invoice the customer.If you don’t want to prorate, set the
proration_behavioroption tonone. With this option, the customer is billed 100 on May 1 and 200 on June 1. Similarly, if you setproration_behaviortononewhen switching between different billing intervals (for example, from monthly to yearly), we don’t generate any credits for the old subscription’s unused time. We still reset the billing date and bill immediately for the new subscription.Updating the quantity on a subscription many times in an hour may result in rate limiting. If you need to bill for a frequently changing quantity, consider integrating usage-based billing instead.
- Throws:
StripeException
-
setResponseGetter
Indicates how the subscription should change when the trial ends if the user did not provide a payment method.One of
cancel,create_invoice, orpause.- Specified by:
setResponseGetterin interfaceStripeActiveObject- Overrides:
setResponseGetterin classApiResource- Parameters:
responseGetter- theStripeResponseGetterinstance to use for making further requests.
-
getApplicationFeePercent
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. -
getAutomaticTax
-
getBillingCadence
The Billing Cadence which controls the timing of recurring invoice generation for this subscription.If unset, the subscription will bill according to its own configured schedule and create its own invoices.If set, this subscription will be billed by the cadence instead, potentially sharing invoices with the other subscriptions linked to that Cadence. -
getBillingCycleAnchor
The reference point that aligns future billing cycle dates. It sets the day of week forweekintervals, the day of month formonthandyearintervals, and the month of year foryearintervals. The timestamp is in UTC format. -
getBillingCycleAnchorConfig
The fixed values used to calculate thebilling_cycle_anchor. -
getBillingMode
The billing mode of the subscription. -
getBillingSchedules
Billing schedules for this subscription. -
getBillingThresholds
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -
getCancelAt
A date in the future at which the subscription will automatically get canceled. -
getCancelAtPeriodEnd
Whether this subscription will (ifstatus=active) or did (ifstatus=canceled) cancel at the end of the current billing period. -
getCanceledAt
If the subscription has been canceled, the date of that cancellation. If the subscription was canceled withcancel_at_period_end,canceled_atwill reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. -
getCancellationDetails
Details about why this subscription was cancelled. -
getCollectionMethod
Eithercharge_automatically, orsend_invoice. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription asactive.One of
charge_automatically, orsend_invoice. -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
getCustomerAccount
ID of the account who owns the subscription. -
getDaysUntilDue
Number of days a customer has to pay invoices generated by this subscription. This value will benullfor subscriptions wherecollection_method=charge_automatically. -
getDefaultTaxRates
The tax rates that will apply to any subscription item that does not havetax_ratesset. Invoices created will have theirdefault_tax_ratespopulated from the subscription. -
getDescription
The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. -
getEndedAt
If the subscription has ended, the date the subscription ended. -
getInvoiceSettings
-
getItems
List of subscription items, each with an attached price. -
getLastPriceMigrationError
Details of the most recent price migration that failed for the subscription. -
getLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
getNextPendingInvoiceItemInvoice
Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided atpending_invoice_item_interval. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
subscription. -
getPauseCollection
If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated topaused. Learn more about pausing collection. -
getPaymentSettings
Payment settings passed on to invoices created by the subscription. -
getPendingInvoiceItemInterval
Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling Create an invoice for the given subscription at the specified interval. -
getPendingUpdate
If specified, pending updates that will be applied to the subscription once thelatest_invoicehas been paid. -
getPrebilling
Time period and invoice for a Subscription billed in advance. -
getStartDate
Date when the subscription was first created. The date might differ from thecreateddate due to backdating. -
getStatus
Possible values areincomplete,incomplete_expired,trialing,active,past_due,canceled,unpaid, orpaused.For
collection_method=charge_automaticallya subscription moves intoincompleteif the initial payment attempt fails. A subscription in this status can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into anactivestatus. If the first invoice is not paid within 23 hours, the subscription transitions toincomplete_expired. This is a terminal status, the open invoice will be voided and no further invoices will be generated.A subscription that is currently in a trial period is
trialingand moves toactivewhen the trial period is over.A subscription can only enter a
pausedstatus when a trial ends without a payment method. Apausedsubscription doesn't generate invoices and can be resumed after your customer adds their payment method. Thepausedstatus is different from pausing collection, which still generates invoices and leaves the subscription's status unchanged.If subscription
collection_method=charge_automatically, it becomespast_duewhen payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will becomecanceledorunpaid(depending on your subscriptions settings).If subscription
collection_method=send_invoiceit becomespast_duewhen its invoice is not paid by the due date, andcanceledorunpaidif it is still not paid by an additional deadline after that. Note that when a subscription has a status ofunpaid, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.One of
active,canceled,incomplete,incomplete_expired,past_due,paused,trialing, orunpaid. -
getTransferData
The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. -
getTrialEnd
If the subscription has a trial, the end of that trial. -
getTrialSettings
Settings related to subscription trials. -
getTrialStart
If the subscription has a trial, the beginning of that trial. -
setApplicationFeePercent
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. -
setAutomaticTax
-
setBillingCadence
The Billing Cadence which controls the timing of recurring invoice generation for this subscription.If unset, the subscription will bill according to its own configured schedule and create its own invoices.If set, this subscription will be billed by the cadence instead, potentially sharing invoices with the other subscriptions linked to that Cadence. -
setBillingCycleAnchor
The reference point that aligns future billing cycle dates. It sets the day of week forweekintervals, the day of month formonthandyearintervals, and the month of year foryearintervals. The timestamp is in UTC format. -
setBillingCycleAnchorConfig
public void setBillingCycleAnchorConfig(Subscription.BillingCycleAnchorConfig billingCycleAnchorConfig) The fixed values used to calculate thebilling_cycle_anchor. -
setBillingMode
The billing mode of the subscription. -
setBillingSchedules
Billing schedules for this subscription. -
setBillingThresholds
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -
setCancelAt
A date in the future at which the subscription will automatically get canceled. -
setCancelAtPeriodEnd
Whether this subscription will (ifstatus=active) or did (ifstatus=canceled) cancel at the end of the current billing period. -
setCanceledAt
If the subscription has been canceled, the date of that cancellation. If the subscription was canceled withcancel_at_period_end,canceled_atwill reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. -
setCancellationDetails
Details about why this subscription was cancelled. -
setCollectionMethod
Eithercharge_automatically, orsend_invoice. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription asactive.One of
charge_automatically, orsend_invoice. -
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
setCustomerAccount
ID of the account who owns the subscription. -
setDaysUntilDue
Number of days a customer has to pay invoices generated by this subscription. This value will benullfor subscriptions wherecollection_method=charge_automatically. -
setDefaultTaxRates
The tax rates that will apply to any subscription item that does not havetax_ratesset. Invoices created will have theirdefault_tax_ratespopulated from the subscription. -
setDescription
The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs. -
setEndedAt
If the subscription has ended, the date the subscription ended. -
setId
Unique identifier for the object. -
setInvoiceSettings
-
setItems
List of subscription items, each with an attached price. -
setLastPriceMigrationError
public void setLastPriceMigrationError(Subscription.LastPriceMigrationError lastPriceMigrationError) Details of the most recent price migration that failed for the subscription. -
setLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
setMetadata
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. -
setNextPendingInvoiceItemInvoice
Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided atpending_invoice_item_interval. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
subscription. -
setPauseCollection
If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated topaused. Learn more about pausing collection. -
setPaymentSettings
Payment settings passed on to invoices created by the subscription. -
setPendingInvoiceItemInterval
public void setPendingInvoiceItemInterval(Subscription.PendingInvoiceItemInterval pendingInvoiceItemInterval) Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling Create an invoice for the given subscription at the specified interval. -
setPendingUpdate
If specified, pending updates that will be applied to the subscription once thelatest_invoicehas been paid. -
setPrebilling
Time period and invoice for a Subscription billed in advance. -
setStartDate
Date when the subscription was first created. The date might differ from thecreateddate due to backdating. -
setStatus
Possible values areincomplete,incomplete_expired,trialing,active,past_due,canceled,unpaid, orpaused.For
collection_method=charge_automaticallya subscription moves intoincompleteif the initial payment attempt fails. A subscription in this status can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into anactivestatus. If the first invoice is not paid within 23 hours, the subscription transitions toincomplete_expired. This is a terminal status, the open invoice will be voided and no further invoices will be generated.A subscription that is currently in a trial period is
trialingand moves toactivewhen the trial period is over.A subscription can only enter a
pausedstatus when a trial ends without a payment method. Apausedsubscription doesn't generate invoices and can be resumed after your customer adds their payment method. Thepausedstatus is different from pausing collection, which still generates invoices and leaves the subscription's status unchanged.If subscription
collection_method=charge_automatically, it becomespast_duewhen payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will becomecanceledorunpaid(depending on your subscriptions settings).If subscription
collection_method=send_invoiceit becomespast_duewhen its invoice is not paid by the due date, andcanceledorunpaidif it is still not paid by an additional deadline after that. Note that when a subscription has a status ofunpaid, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.One of
active,canceled,incomplete,incomplete_expired,past_due,paused,trialing, orunpaid. -
setTransferData
The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices. -
setTrialEnd
If the subscription has a trial, the end of that trial. -
setTrialSettings
Settings related to subscription trials. -
setTrialStart
If the subscription has a trial, the beginning of that trial. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object. -
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:
getMetadatain interfaceMetadataStore<Subscription>
-