比例配分の仕組み
比例配分 (日割り / 秒割り計算) の詳細は以下のとおりです。
The most complex aspect of changing existing subscriptions is proration, where the customer is charged a percentage of a subscription’s cost to reflect partial use. This page explains how prorations work with subscriptions and how to manage prorations for your customers.
How prorations work![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
For example, upgrading or downgrading a subscription can result in prorated charges. If a customer upgrades from a 10 USD per month plan to a 20 USD option, they’re charged prorated amounts for the time spent on each option. Assuming the change occurred halfway through the billing period, the customer is billed an additional 5 USD: -5 USD for unused time on the initial price, and 10 USD for the remaining time on the new price.
Proration ensures that customers are billed accurately, but a proration can result in different payment amounts than you may expect. Negative prorations aren’t automatically refunded and positive prorations aren’t immediately billed, although you can do both manually.
You can preview a proration to view the amount before applying the changes.
Prorations and discounts![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
When applying changes to existing subscriptions, discounts don’t affect the resulting proration line items.
What triggers prorations![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
By default, the following scenarios result in a proration:
- Changing to a price with a different base cost
- Changing to a price with a different billing interval
- Adding a trial period to an active subscription
- Changing the quantity
- Licensed (per-seat) subscriptions (because they’re billed at the start of each billing period)
When prorations are applied![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Prorations only apply to charges that occur ahead of the billing cycle. Usage-based billing isn’t subject to proration.
比例配分された金額は、API がサブスクリプションを更新するとすぐに算出されます。変更の前と後のサブスクリプションのコストを計算するために、現行の請求期間の開始時間と終了時間が使用されます。
Taxes and prorations![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
For information about how taxes work with prorations, see Collect taxes for recurring payments.
比例配分のプレビュー![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
You can retrieve an upcoming invoice to preview changes to a subscription. This API call doesn’t modify the subscription, it returns the upcoming invoice based only on the parameters that you pass. Changing the price
or quantity
both result in a proration. This example changes the price
and sets a date for the proration.
次のレスポンス例を展開して、以下を確認できます。
- 36 ~ 38 行目に、以前の価格の未使用時間に対するクレジット。
- 107 ~ 109 行目に、新しい価格で使用した時間に対するコスト。
- 276 ~ 279 行目に、インボイスの新しい小計と合計。
{ "account_country": "US", "account_name": "Test account", "amount_due": 3627, "amount_paid": 0, "amount_remaining": 3627, "application_fee_amount": null, "attempt_count": 0, "attempted": false, "billing_reason": "upcoming",
Use this information to confirm the changes with the customer before modifying the subscription. Because Stripe prorates to the second, prorated amounts may change between the time they’re previewed and the time the update is made. To avoid this, pass in a subscription_
to the invoice when you preview a change. When you update the subscription, pass the same date using the proration_
parameter on a subscription so that the proration is calculated at the same time.
比例配分の無効化![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
比例配分は proration_behavior パラメーターによって制御され、デフォルトでは create_prorations に設定されています。
To disable prorations on a per-request basis, set the proration_
parameter to none
. No parameter turns off all future prorations for a Subscription. To disable prorations indefinitely, set proration_
to none
for every request that generates prorations:
比例配分を無効にすると、次のインボイスが生成されたときに、顧客は新しい価格で全額を請求されます。