# subscription

From **Stripe API**.

Subscriptions allow you to charge a customer on a recurring basis.

Related guide: [Creating Subscriptions](https://stripe.com/docs/billing/subscriptions/creating).

- Type: `object`

## Properties

### `application_fee_percent`

- Required: false
- Type: `number`
- Nullable: true

A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account.

### `automatic_tax`

- Required: true
- Type: `object`

### `billing_cycle_anchor`

- Required: true
- Type: `integer`
- Format: `unix-time`

Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices.

### `billing_thresholds`

- Required: false
- Nullable: true

Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period

### `cancel_at`

- Required: false
- Type: `integer`
- Format: `unix-time`
- Nullable: true

A date in the future at which the subscription will automatically get canceled

### `cancel_at_period_end`

- Required: true
- Type: `boolean`

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. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.

### `canceled_at`

- Required: false
- Type: `integer`
- Format: `unix-time`
- Nullable: true

If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will 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.

### `collection_method`

- Required: true
- Type: `string`
- Allowed values: `"charge_automatically"`, `"send_invoice"`

Either `charge_automatically`, or `send_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.

### `created`

- Required: true
- Type: `integer`
- Format: `unix-time`

Time at which the object was created. Measured in seconds since the Unix epoch.

### `current_period_end`

- Required: true
- Type: `integer`
- Format: `unix-time`

End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.

### `current_period_start`

- Required: true
- Type: `integer`
- Format: `unix-time`

Start of the current period that the subscription has been invoiced for.

### `customer`

- Required: true
ID of the customer who owns the subscription.

### `days_until_due`

- Required: false
- Type: `integer`
- Nullable: true

Number of days a customer has to pay invoices generated by this subscription. This value will be `null` for subscriptions where `collection_method=charge_automatically`.

### `default_payment_method`

- Required: false
- Nullable: true

ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over `default_source`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).

### `default_source`

- Required: false
- Nullable: true

ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If `default_payment_method` is also set, `default_payment_method` will take precedence. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).

### `default_tax_rates`

- Required: false
- Type: `array`
- Nullable: true

The tax rates that will apply to any subscription item that does not have `tax_rates` set. Invoices created will have their `default_tax_rates` populated from the subscription.

### `discount`

- Required: false
- Nullable: true

Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis.

### `ended_at`

- Required: false
- Type: `integer`
- Format: `unix-time`
- Nullable: true

If the subscription has ended, the date the subscription ended.

### `id`

- Required: true
- Type: `string`
- maxLength: `5000`

Unique identifier for the object.

### `items`

- Required: true
- Type: `object`

List of subscription items, each with an attached price.

### `latest_invoice`

- Required: false
- Nullable: true

The most recent invoice this subscription has generated.

### `livemode`

- Required: true
- Type: `boolean`

Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.

### `metadata`

- Required: true
- Type: `object`

Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

### `next_pending_invoice_item_invoice`

- Required: false
- Type: `integer`
- Format: `unix-time`
- Nullable: true

Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`.

### `object`

- Required: true
- Type: `string`
- Allowed values: `"subscription"`

String representing the object's type. Objects of the same type share the same value.

### `pause_collection`

- Required: false
- Nullable: true

If specified, payment collection for this subscription will be paused.

### `payment_settings`

- Required: false
- Nullable: true

Payment settings passed on to invoices created by the subscription.

### `pending_invoice_item_interval`

- Required: false
- Nullable: true

Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval.

### `pending_setup_intent`

- Required: false
- Nullable: true

You can use this [SetupIntent](https://stripe.com/docs/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2).

### `pending_update`

- Required: false
- Nullable: true

If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid.

### `schedule`

- Required: false
- Nullable: true

The schedule attached to the subscription

### `start_date`

- Required: true
- Type: `integer`
- Format: `unix-time`

Date when the subscription was first created. The date might differ from the `created` date due to backdating.

### `status`

- Required: true
- Type: `string`
- Allowed values: `"active"`, `"canceled"`, `"incomplete"`, `"incomplete_expired"`, `"past_due"`, `"trialing"`, `"unpaid"`

Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, or `unpaid`. 

For `collection_method=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 `collection_method=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 `collection_method=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.

### `transfer_data`

- Required: false
- Nullable: true

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.

### `trial_end`

- Required: false
- Type: `integer`
- Format: `unix-time`
- Nullable: true

If the subscription has a trial, the end of that trial.

### `trial_start`

- Required: false
- Type: `integer`
- Format: `unix-time`
- Nullable: true

If the subscription has a trial, the beginning of that trial.

## JSON Schema

```json
{"description":"Subscriptions allow you to charge a customer on a recurring basis.\n\nRelated guide: [Creating Subscriptions](https://stripe.com/docs/billing/subscriptions/creating).","properties":{"application_fee_percent":{"description":"A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account.","nullable":true,"type":"number"},"automatic_tax":{"$ref":"#/components/schemas/subscription_automatic_tax"},"billing_cycle_anchor":{"description":"Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices.","format":"unix-time","type":"integer"},"billing_thresholds":{"anyOf":[{"$ref":"#/components/schemas/subscription_billing_thresholds"}],"description":"Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period","nullable":true},"cancel_at":{"description":"A date in the future at which the subscription will automatically get canceled","format":"unix-time","nullable":true,"type":"integer"},"cancel_at_period_end":{"description":"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. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.","type":"boolean"},"canceled_at":{"description":"If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with `cancel_at_period_end`, `canceled_at` will 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.","format":"unix-time","nullable":true,"type":"integer"},"collection_method":{"description":"Either `charge_automatically`, or `send_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.","enum":["charge_automatically","send_invoice"],"type":"string"},"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"current_period_end":{"description":"End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.","format":"unix-time","type":"integer"},"current_period_start":{"description":"Start of the current period that the subscription has been invoiced for.","format":"unix-time","type":"integer"},"customer":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}],"description":"ID of the customer who owns the subscription.","x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}]}},"days_until_due":{"description":"Number of days a customer has to pay invoices generated by this subscription. This value will be `null` for subscriptions where `collection_method=charge_automatically`.","nullable":true,"type":"integer"},"default_payment_method":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/payment_method"}],"description":"ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over `default_source`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/payment_method"}]}},"default_source":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/alipay_account"},{"$ref":"#/components/schemas/bank_account"},{"$ref":"#/components/schemas/bitcoin_receiver"},{"$ref":"#/components/schemas/card"},{"$ref":"#/components/schemas/source"}],"description":"ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If `default_payment_method` is also set, `default_payment_method` will take precedence. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/alipay_account"},{"$ref":"#/components/schemas/bank_account"},{"$ref":"#/components/schemas/bitcoin_receiver"},{"$ref":"#/components/schemas/card"},{"$ref":"#/components/schemas/source"}]}},"default_tax_rates":{"description":"The tax rates that will apply to any subscription item that does not have `tax_rates` set. Invoices created will have their `default_tax_rates` populated from the subscription.","items":{"$ref":"#/components/schemas/tax_rate"},"nullable":true,"type":"array"},"discount":{"anyOf":[{"$ref":"#/components/schemas/discount"}],"description":"Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis.","nullable":true},"ended_at":{"description":"If the subscription has ended, the date the subscription ended.","format":"unix-time","nullable":true,"type":"integer"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"items":{"description":"List of subscription items, each with an attached price.","properties":{"data":{"description":"Details about each object.","items":{"$ref":"#/components/schemas/subscription_item"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"SubscriptionItemList","type":"object","x-expandableFields":["data"]},"latest_invoice":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/invoice"}],"description":"The most recent invoice this subscription has generated.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/invoice"}]}},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","type":"object"},"next_pending_invoice_item_invoice":{"description":"Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`.","format":"unix-time","nullable":true,"type":"integer"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["subscription"],"type":"string"},"pause_collection":{"anyOf":[{"$ref":"#/components/schemas/subscriptions_resource_pause_collection"}],"description":"If specified, payment collection for this subscription will be paused.","nullable":true},"payment_settings":{"anyOf":[{"$ref":"#/components/schemas/subscriptions_resource_payment_settings"}],"description":"Payment settings passed on to invoices created by the subscription.","nullable":true},"pending_invoice_item_interval":{"anyOf":[{"$ref":"#/components/schemas/subscription_pending_invoice_item_interval"}],"description":"Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval.","nullable":true},"pending_setup_intent":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/setup_intent"}],"description":"You can use this [SetupIntent](https://stripe.com/docs/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-2).","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/setup_intent"}]}},"pending_update":{"anyOf":[{"$ref":"#/components/schemas/subscriptions_resource_pending_update"}],"description":"If specified, [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid.","nullable":true},"schedule":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/subscription_schedule"}],"description":"The schedule attached to the subscription","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/subscription_schedule"}]}},"start_date":{"description":"Date when the subscription was first created. The date might differ from the `created` date due to backdating.","format":"unix-time","type":"integer"},"status":{"description":"Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, or `unpaid`. \n\nFor `collection_method=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. \n\nA subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over. \n\nIf subscription `collection_method=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. \n\nIf subscription `collection_method=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.","enum":["active","canceled","incomplete","incomplete_expired","past_due","trialing","unpaid"],"type":"string"},"transfer_data":{"anyOf":[{"$ref":"#/components/schemas/subscription_transfer_data"}],"description":"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.","nullable":true},"trial_end":{"description":"If the subscription has a trial, the end of that trial.","format":"unix-time","nullable":true,"type":"integer"},"trial_start":{"description":"If the subscription has a trial, the beginning of that trial.","format":"unix-time","nullable":true,"type":"integer"}},"required":["automatic_tax","billing_cycle_anchor","cancel_at_period_end","collection_method","created","current_period_end","current_period_start","customer","id","items","livemode","metadata","object","start_date","status"],"title":"Subscription","type":"object","x-expandableFields":["automatic_tax","billing_thresholds","customer","default_payment_method","default_source","default_tax_rates","discount","items","latest_invoice","pause_collection","payment_settings","pending_invoice_item_interval","pending_setup_intent","pending_update","schedule","transfer_data"],"x-resourceId":"subscription"}
```
