public class Subscription extends ApiResource implements HasId, MetadataStore<Subscription>
Modifier and Type | Class and Description |
---|---|
static class |
Subscription.BillingThresholds |
ApiResource.RequestMethod, ApiResource.RequestType
CHARSET, GSON
PRETTY_PRINT_GSON
Constructor and Description |
---|
Subscription() |
Modifier and Type | Method and Description |
---|---|
Subscription |
cancel()
Cancels a customer’s subscription immediately.
|
Subscription |
cancel(java.util.Map<java.lang.String,java.lang.Object> params)
Cancels a customer’s subscription immediately.
|
Subscription |
cancel(java.util.Map<java.lang.String,java.lang.Object> params,
RequestOptions options)
Cancels a customer’s subscription immediately.
|
Subscription |
cancel(SubscriptionCancelParams params)
Cancels a customer’s subscription immediately.
|
Subscription |
cancel(SubscriptionCancelParams params,
RequestOptions options)
Cancels a customer’s subscription immediately.
|
protected boolean |
canEqual(java.lang.Object other) |
static Subscription |
create(java.util.Map<java.lang.String,java.lang.Object> params)
Creates a new subscription on an existing customer.
|
static Subscription |
create(java.util.Map<java.lang.String,java.lang.Object> params,
RequestOptions options)
Creates a new subscription on an existing customer.
|
static Subscription |
create(SubscriptionCreateParams params)
Creates a new subscription on an existing customer.
|
static Subscription |
create(SubscriptionCreateParams params,
RequestOptions options)
Creates a new subscription on an existing customer.
|
Discount |
deleteDiscount()
Removes the currently applied discount on a subscription.
|
Discount |
deleteDiscount(java.util.Map<java.lang.String,java.lang.Object> params)
Removes the currently applied discount on a subscription.
|
Discount |
deleteDiscount(java.util.Map<java.lang.String,java.lang.Object> params,
RequestOptions options)
Removes the currently applied discount on a subscription.
|
boolean |
equals(java.lang.Object o) |
java.math.BigDecimal |
getApplicationFeePercent()
A non-negative decimal between 0 and 100, with at most two decimal places.
|
java.lang.String |
getBilling()
Either `charge_automatically`, or `send_invoice`.
|
java.lang.Long |
getBillingCycleAnchor()
Determines the date of the first full invoice, and, for plans with `month` or `year` intervals,
the day of the month for subsequent invoices.
|
Subscription.BillingThresholds |
getBillingThresholds()
Define thresholds at which an invoice will be sent, and the subscription advanced to a new
billing period.
|
java.lang.Long |
getCancelAt()
A date in the future at which the subscription will automatically get canceled.
|
java.lang.Boolean |
getCancelAtPeriodEnd()
If the subscription has been canceled with the `at_period_end` flag set to `true`,
`cancel_at_period_end` on the subscription will be true.
|
java.lang.Long |
getCanceledAt()
If the subscription has been canceled, the date of that cancellation.
|
java.lang.Long |
getCreated()
Time at which the object was created.
|
java.lang.Long |
getCurrentPeriodEnd()
End of the current period that the subscription has been invoiced for.
|
java.lang.Long |
getCurrentPeriodStart()
Start of the current period that the subscription has been invoiced for.
|
java.lang.String |
getCustomer()
Get id of expandable `customer` object.
|
Customer |
getCustomerObject()
Get expanded `customer`.
|
java.lang.Long |
getDaysUntilDue()
Number of days a customer has to pay invoices generated by this subscription.
|
java.lang.String |
getDefaultPaymentMethod()
Get id of expandable `defaultPaymentMethod` object.
|
PaymentMethod |
getDefaultPaymentMethodObject()
Get expanded `defaultPaymentMethod`.
|
java.lang.String |
getDefaultSource()
Get id of expandable `defaultSource` object.
|
PaymentSource |
getDefaultSourceObject()
Get expanded `defaultSource`.
|
Discount |
getDiscount()
Describes the current discount applied to this subscription, if there is one.
|
java.lang.Long |
getEndedAt()
If the subscription has ended, the date the subscription ended.
|
java.lang.String |
getId()
Unique identifier for the object.
|
SubscriptionItemCollection |
getItems()
List of subscription items, each with an attached plan.
|
java.lang.String |
getLatestInvoice()
Get id of expandable `latestInvoice` object.
|
Invoice |
getLatestInvoiceObject()
Get expanded `latestInvoice`.
|
java.lang.Boolean |
getLivemode()
Has the value `true` if the object exists in live mode or the value `false` if the object
exists in test mode.
|
java.util.Map<java.lang.String,java.lang.String> |
getMetadata()
Set of key-value pairs that you can attach to an object.
|
java.lang.String |
getObject()
String representing the object's type.
|
Plan |
getPlan()
Hash describing the plan the customer is subscribed to.
|
java.lang.Long |
getQuantity()
The quantity of the plan to which the customer is subscribed.
|
java.lang.Long |
getStart()
Date of the last substantial change to this subscription.
|
java.lang.String |
getStatus()
Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`,
`canceled`, or `unpaid`.
|
java.math.BigDecimal |
getTaxPercent()
If provided, each invoice created by this subscription will apply the tax rate, increasing the
amount billed to the customer.
|
Invoice.TransferData |
getTransferData()
If specified, the funds from the subscription's invoices will be transferred to the destination
and the ID of the resulting transfers will be found on the resulting charges.
|
java.lang.Long |
getTrialEnd()
If the subscription has a trial, the end of that trial.
|
java.lang.Long |
getTrialStart()
If the subscription has a trial, the beginning of that trial.
|
int |
hashCode() |
static SubscriptionCollection |
list(java.util.Map<java.lang.String,java.lang.Object> params)
By default, returns a list of subscriptions that have not been canceled.
|
static SubscriptionCollection |
list(java.util.Map<java.lang.String,java.lang.Object> params,
RequestOptions options)
By default, returns a list of subscriptions that have not been canceled.
|
static SubscriptionCollection |
list(SubscriptionListParams params)
By default, returns a list of subscriptions that have not been canceled.
|
static SubscriptionCollection |
list(SubscriptionListParams params,
RequestOptions options)
By default, returns a list of subscriptions that have not been canceled.
|
static Subscription |
retrieve(java.lang.String subscriptionExposedId)
Retrieves the subscription with the given ID.
|
static Subscription |
retrieve(java.lang.String subscriptionExposedId,
java.util.Map<java.lang.String,java.lang.Object> params,
RequestOptions options)
Retrieves the subscription with the given ID.
|
static Subscription |
retrieve(java.lang.String subscriptionExposedId,
RequestOptions options)
Retrieves the subscription with the given ID.
|
static Subscription |
retrieve(java.lang.String subscriptionExposedId,
SubscriptionRetrieveParams params,
RequestOptions options)
Retrieves the subscription with the given ID.
|
void |
setApplicationFeePercent(java.math.BigDecimal applicationFeePercent)
A non-negative decimal between 0 and 100, with at most two decimal places.
|
void |
setBilling(java.lang.String billing)
Either `charge_automatically`, or `send_invoice`.
|
void |
setBillingCycleAnchor(java.lang.Long billingCycleAnchor)
Determines the date of the first full invoice, and, for plans with `month` or `year` intervals,
the day of the month for subsequent invoices.
|
void |
setBillingThresholds(Subscription.BillingThresholds billingThresholds)
Define thresholds at which an invoice will be sent, and the subscription advanced to a new
billing period.
|
void |
setCancelAt(java.lang.Long cancelAt)
A date in the future at which the subscription will automatically get canceled.
|
void |
setCancelAtPeriodEnd(java.lang.Boolean cancelAtPeriodEnd)
If the subscription has been canceled with the `at_period_end` flag set to `true`,
`cancel_at_period_end` on the subscription will be true.
|
void |
setCanceledAt(java.lang.Long canceledAt)
If the subscription has been canceled, the date of that cancellation.
|
void |
setCreated(java.lang.Long created)
Time at which the object was created.
|
void |
setCurrentPeriodEnd(java.lang.Long currentPeriodEnd)
End of the current period that the subscription has been invoiced for.
|
void |
setCurrentPeriodStart(java.lang.Long currentPeriodStart)
Start of the current period that the subscription has been invoiced for.
|
void |
setCustomer(java.lang.String id) |
void |
setCustomerObject(Customer expandableObject) |
void |
setDaysUntilDue(java.lang.Long daysUntilDue)
Number of days a customer has to pay invoices generated by this subscription.
|
void |
setDefaultPaymentMethod(java.lang.String id) |
void |
setDefaultPaymentMethodObject(PaymentMethod expandableObject) |
void |
setDefaultSource(java.lang.String id) |
void |
setDefaultSourceObject(PaymentSource expandableObject) |
void |
setDiscount(Discount discount)
Describes the current discount applied to this subscription, if there is one.
|
void |
setEndedAt(java.lang.Long endedAt)
If the subscription has ended, the date the subscription ended.
|
void |
setId(java.lang.String id)
Unique identifier for the object.
|
void |
setItems(SubscriptionItemCollection items)
List of subscription items, each with an attached plan.
|
void |
setLatestInvoice(java.lang.String id) |
void |
setLatestInvoiceObject(Invoice expandableObject) |
void |
setLivemode(java.lang.Boolean livemode)
Has the value `true` if the object exists in live mode or the value `false` if the object
exists in test mode.
|
void |
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Set of key-value pairs that you can attach to an object.
|
void |
setObject(java.lang.String object)
String representing the object's type.
|
void |
setPlan(Plan plan)
Hash describing the plan the customer is subscribed to.
|
void |
setQuantity(java.lang.Long quantity)
The quantity of the plan to which the customer is subscribed.
|
void |
setStart(java.lang.Long start)
Date of the last substantial change to this subscription.
|
void |
setStatus(java.lang.String status)
Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`,
`canceled`, or `unpaid`.
|
void |
setTaxPercent(java.math.BigDecimal taxPercent)
If provided, each invoice created by this subscription will apply the tax rate, increasing the
amount billed to the customer.
|
void |
setTransferData(Invoice.TransferData transferData)
If specified, the funds from the subscription's invoices will be transferred to the destination
and the ID of the resulting transfers will be found on the resulting charges.
|
void |
setTrialEnd(java.lang.Long trialEnd)
If the subscription has a trial, the end of that trial.
|
void |
setTrialStart(java.lang.Long trialStart)
If the subscription has a trial, the beginning of that trial.
|
Subscription |
update(java.util.Map<java.lang.String,java.lang.Object> params)
Updates an existing subscription on a customer to match the specified parameters.
|
Subscription |
update(java.util.Map<java.lang.String,java.lang.Object> params,
RequestOptions options)
Updates an existing subscription on a customer to match the specified parameters.
|
Subscription |
update(SubscriptionUpdateParams params)
Updates an existing subscription on a customer to match the specified parameters.
|
Subscription |
update(SubscriptionUpdateParams params,
RequestOptions options)
Updates an existing subscription on a customer to match the specified parameters.
|
checkNullTypedParams, classUrl, classUrl, instanceUrl, instanceUrl, multipartRequest, request, request, requestCollection, requestCollection, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeId
equals, getLastResponse, setLastResponse, toJson, toString
public java.lang.String getCustomer()
public void setCustomer(java.lang.String id)
public Customer getCustomerObject()
public void setCustomerObject(Customer expandableObject)
public java.lang.String getDefaultPaymentMethod()
public void setDefaultPaymentMethod(java.lang.String id)
public PaymentMethod getDefaultPaymentMethodObject()
public void setDefaultPaymentMethodObject(PaymentMethod expandableObject)
public java.lang.String getDefaultSource()
public void setDefaultSource(java.lang.String id)
public PaymentSource getDefaultSourceObject()
public void setDefaultSourceObject(PaymentSource expandableObject)
public java.lang.String getLatestInvoice()
public void setLatestInvoice(java.lang.String id)
public Invoice getLatestInvoiceObject()
public void setLatestInvoiceObject(Invoice expandableObject)
public static SubscriptionCollection list(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
status=canceled
.StripeException
public static SubscriptionCollection list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
status=canceled
.StripeException
public static SubscriptionCollection list(SubscriptionListParams params) throws StripeException
status=canceled
.StripeException
public static SubscriptionCollection list(SubscriptionListParams params, RequestOptions options) throws StripeException
status=canceled
.StripeException
public static Subscription create(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
StripeException
public static Subscription create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
StripeException
public static Subscription create(SubscriptionCreateParams params) throws StripeException
StripeException
public static Subscription create(SubscriptionCreateParams params, RequestOptions options) throws StripeException
StripeException
public Subscription update(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
update
in interface MetadataStore<Subscription>
StripeException
public Subscription update(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
update
in interface MetadataStore<Subscription>
StripeException
public Subscription update(SubscriptionUpdateParams params) throws StripeException
StripeException
public Subscription update(SubscriptionUpdateParams params, RequestOptions options) throws StripeException
StripeException
public static Subscription retrieve(java.lang.String subscriptionExposedId) throws StripeException
StripeException
public static Subscription retrieve(java.lang.String subscriptionExposedId, RequestOptions options) throws StripeException
StripeException
public static Subscription retrieve(java.lang.String subscriptionExposedId, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
StripeException
public static Subscription retrieve(java.lang.String subscriptionExposedId, SubscriptionRetrieveParams params, RequestOptions options) throws StripeException
StripeException
public Subscription cancel() throws StripeException
Note, however, that any pending invoice items that you’ve created will still be charged for 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 will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
By default, upon subscription cancellation, Stripe will stop 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.
StripeException
public Subscription cancel(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Note, however, that any pending invoice items that you’ve created will still be charged for 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 will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
By default, upon subscription cancellation, Stripe will stop 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.
StripeException
public Subscription cancel(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Note, however, that any pending invoice items that you’ve created will still be charged for 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 will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
By default, upon subscription cancellation, Stripe will stop 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.
StripeException
public Subscription cancel(SubscriptionCancelParams params) throws StripeException
Note, however, that any pending invoice items that you’ve created will still be charged for 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 will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
By default, upon subscription cancellation, Stripe will stop 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.
StripeException
public Subscription cancel(SubscriptionCancelParams params, RequestOptions options) throws StripeException
Note, however, that any pending invoice items that you’ve created will still be charged for 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 will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
By default, upon subscription cancellation, Stripe will stop 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.
StripeException
public Discount deleteDiscount() throws StripeException
StripeException
public Discount deleteDiscount(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
StripeException
public Discount deleteDiscount(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
StripeException
public java.math.BigDecimal getApplicationFeePercent()
public java.lang.String getBilling()
public java.lang.Long getBillingCycleAnchor()
public Subscription.BillingThresholds getBillingThresholds()
public java.lang.Long getCancelAt()
public java.lang.Boolean getCancelAtPeriodEnd()
public java.lang.Long getCanceledAt()
public java.lang.Long getCreated()
public java.lang.Long getCurrentPeriodEnd()
public java.lang.Long getCurrentPeriodStart()
public java.lang.Long getDaysUntilDue()
public Discount getDiscount()
public java.lang.Long getEndedAt()
public SubscriptionItemCollection getItems()
public java.lang.Boolean getLivemode()
public java.lang.String getObject()
public Plan getPlan()
public java.lang.Long getQuantity()
public java.lang.Long getStart()
public java.lang.String getStatus()
For `billing=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` state. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal state, the open invoice will be voided and no further invoices will be generated.
A subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over.
If subscription `billing=charge_automatically` it becomes `past_due` when payment to renew it fails and `canceled` or `unpaid` (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.
If subscription `billing=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, 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.
public java.math.BigDecimal getTaxPercent()
public Invoice.TransferData getTransferData()
public java.lang.Long getTrialEnd()
public java.lang.Long getTrialStart()
public void setApplicationFeePercent(java.math.BigDecimal applicationFeePercent)
public void setBilling(java.lang.String billing)
public void setBillingCycleAnchor(java.lang.Long billingCycleAnchor)
public void setBillingThresholds(Subscription.BillingThresholds billingThresholds)
public void setCancelAt(java.lang.Long cancelAt)
public void setCancelAtPeriodEnd(java.lang.Boolean cancelAtPeriodEnd)
public void setCanceledAt(java.lang.Long canceledAt)
public void setCreated(java.lang.Long created)
public void setCurrentPeriodEnd(java.lang.Long currentPeriodEnd)
public void setCurrentPeriodStart(java.lang.Long currentPeriodStart)
public void setDaysUntilDue(java.lang.Long daysUntilDue)
public void setDiscount(Discount discount)
public void setEndedAt(java.lang.Long endedAt)
public void setId(java.lang.String id)
public void setItems(SubscriptionItemCollection items)
public void setLivemode(java.lang.Boolean livemode)
public void setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
public void setObject(java.lang.String object)
public void setPlan(Plan plan)
public void setQuantity(java.lang.Long quantity)
public void setStart(java.lang.Long start)
public void setStatus(java.lang.String status)
For `billing=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` state. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal state, the open invoice will be voided and no further invoices will be generated.
A subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over.
If subscription `billing=charge_automatically` it becomes `past_due` when payment to renew it fails and `canceled` or `unpaid` (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.
If subscription `billing=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, 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.
public void setTaxPercent(java.math.BigDecimal taxPercent)
public void setTransferData(Invoice.TransferData transferData)
public void setTrialEnd(java.lang.Long trialEnd)
public void setTrialStart(java.lang.Long trialStart)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
protected boolean canEqual(java.lang.Object other)
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getId()
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
getMetadata
in interface MetadataStore<Subscription>