サブスクリプションの仕組み
継続支払いとサブスクリプションのライフサイクルを管理します。
サブスクリプションでは、顧客は商品を利用するために継続的に支払いを行います。サブスクリプションの場合、以降も顧客に請求する必要があるため、1 回限りの購入よりも顧客について多くの情報を保持する必要があります。
Stripe では、サブスクリプション請求の管理に役立つ多くの機能を提供しています。
サブスクリプションのライフサイクル
The process of creating and managing subscriptions relies on core Stripe API resources, including Customers, Invoices, and PaymentIntents. See API object definitions for the full list of subscription-related resources.
推奨されるサブスクリプションフローは次のとおりです。
定期支払いを作成する
You can create a new subscription in the Dashboard or with the API. Every time you create a subscription, this triggers an event. Listen for these events with webhook endpoints, and make sure that your integration properly handles them.
Optionally, you can create a trial that doesn’t require payments for the subscription. In that case, the status
is trialing
. When the trial is over, the subscription moves to active
and the subscribed customer gets charged.
支払い処理
We recommend that you set the payment_
of a subscription to default_incomplete to help handle failed payments and complex payment flows like 3DS. This creates subscriptions with status incomplete
if payment is required, which allows you to subsequently collect and confirm payment information to activate the subscription.
If you set payment_
to allow_
, Stripe immediately attempts to collect payment on the invoice. If the payment fails, the subscription’s status changes to incomplete
. If you set payment_
to error_
, the subscription creation fails if the payment fails.
Subscriptions that you create in the Dashboard default to the appropriate payment behavior depending on the payment method.
Handle the invoice
When you create a subscription, Stripe automatically creates an invoice with the status open
. Your customer has about 23 hours to make a successful payment. During this time, the subscription status is incomplete
and the invoice status remains open
. The 23-hour window exists because your customer usually makes the first payment for a subscription while on-session. If the customer returns to your application after 23 hours, create a new subscription for them.
顧客が支払う
If your customer pays the invoice, the subscription updates to active
and the invoice to paid
. If they don’t make a payment, the subscription updates to incomplete_
and the invoice becomes void
.
To confirm whether the invoice has been paid:
- Webhookエンドポイントまたはその他のタイプのイベント送信先を設定し、
invoice.
イベントをリッスンします。paid - サブスクリプションオブジェクトを手動で確認し、
subscription.
を探します。自動請求または顧客による手動での支払いによって請求書への支払いが行われると、status=active status
はactive
になります。
For more details, see Subscription statuses and Payment statuses.
Provision access to your product 
When you create a subscription for a customer, this creates an active entitlement for each feature associated with that product. When a customer accesses your services, use their active entitlements to grant them access to the features included in their subscription.
Alternatively, you can use track active subscriptions with webhook events and provision the product for the customer based on that activity.
サブスクリプションを更新する
You can modify existing subscriptions as needed without having to cancel and recreate them. Some of the most significant changes you might make are upgrading or downgrading the subscription price or pausing payment collection for an active subscription.
You can listen to subscription events with webhook endpoints for changes to the subscription. For example, you might want to email a customer if a payment fails or revoke a customer’s access when they cancel their subscription.
For Stripe Checkout integrations, you can’t update the subscription or its invoice if the session’s subscription is incomplete
. You can listen to the checkout.session.completed event to make the update after the session has completed. You can also expire the session instead if you want to cancel the session’s subscription, void the subscription invoice, or mark the invoice as uncollectible.
Handle unpaid subscriptions 
For subscriptions with unpaid invoices, the unpaid invoices remain open but further payment attempts are paused. The subscription continues to generate invoices each billing period, which remain in the draft
status. To reactivate the subscription:
- 必要に応じて新しい支払い情報を収集します。
- 請求書の下書きで auto_advance を
true
に設定して、自動回収を有効にします。 - 未払い請求書の確定と支払いを行います。無効になっていない最新の請求書を期日前に支払うと、サブスクリプションのステータスが
active
に更新されます。
Invoices marked as uncollectable keep the underlying subscription active
. Stripe ignores voided invoices when determining subscription status and uses the most recent non-voided invoice instead.
The unpaid subscription’s status
depends on your failed payment settings in the Dashboard.
Cancel the subscription 
You can cancel a subscription at any time, including at the end of a billing cycle or after a set number of billing cycles.
By default, cancelling a subscription disables creating new invoices and stops automatic collection of all outstanding invoices from the subscription. It also deletes the subscription and you can no longer update the subscription or its metadata. If your customer wants to resubscribe, you need to collect new payment information from them and create a new subscription.
サブスクリプションステータス
Subscriptions can have the following statuses. The actions you can take on a subscription depend on its status.
ステータス | 説明 |
---|---|
trialing | サブスクリプションは現在トライアル期間中であり、顧客にプロダクトを支障なく提供できます。初回の支払いが行われると、サブスクリプションは自動的に active に移行します。 |
active | サブスクリプションは良好な状態です。past_ のサブスクリプションの場合、関連する請求書への最新の支払いまたは回収不能という判定によって、サブスクリプションは active に移行します。active は、サブスクリプションに関連するすべての未払いの請求書が支払われたことを示しているわけではないことに注意してください。その他の未払いの請求書は、支払い対象として残すか、回収不能と判定するか、必要に応じて無効化することができます。 |
incomplete | サブスクリプションを有効にするには、顧客が 23 時間以内に支払いを成功させる必要があります。または、支払いで顧客認証などの対応が必要です。保留中の支払いがあり、PaymentIntent のステータスが processing の場合も、サブスクリプションが incomplete になることがあります。 |
incomplete_ | サブスクリプションの初回の支払いが失敗し、サブスクリプションの作成から 23 時間以内に支払いが成功しませんでした。これらのサブスクリプションは顧客に請求されません。このステータスは、サブスクリプションの有効化に失敗した顧客を追跡するために存在します。 |
past_ | Payment on the latest finalized invoice either failed or wasn’t attempted. The subscription continues to create invoices. Your Dashboard subscription settings determine the subscription’s next status. If the invoice is still unpaid after all attempted smart retries, you can configure the subscription to move to canceled , unpaid , or leave it as past_ . To reactivate the subscription, have your customer pay the most recent invoice. The subscription status becomes active regardless of whether the payment is done before or after the latest invoice due date. |
canceled | サブスクリプションがキャンセルされました。キャンセル時に未払いのすべての請求書の自動回収が無効化されます (auto_ )。これは、更新できない最終的なステータスです。 |
unpaid | 最新の請求書は支払われていませんが、サブスクリプションはそのまま保持されます。最新の請求書は未処理のままになり、請求書は引き続き生成されますが、支払いの試行は行われません。サブスクリプションが unpaid の場合は、past_ の時点で支払いの試行と再試行がすでに行われているため、プロダクトへのアクセスを取り消します。サブスクリプションのステータスを active にするには、期日前に最新の請求書を支払う必要があります。 |
paused | デフォルトの決済手段が設定されずにサブスクリプションのトライアル期間が終了し、trial_settings.end_behavior.missing_payment_method が pause に設定されています。サブスクリプションの請求書は今後作成されなくなります。デフォルトの決済手段を顧客に関連付けた後、サブスクリプションを再開できます。 |
Payment statuses 
A PaymentIntent tracks the lifecycle of every payment. Whenever a payment is due for a subscription, Stripe generates an invoice and a PaymentIntent. The PaymentIntent ID attaches to the invoice and you can access it from the Invoice and Subscription objects.
The status of the PaymentIntent affects the status of the invoice and the subscription. Here’s how the different outcomes of a payment map to the different statuses:
支払い結果 | PaymentIntent ステータス | 請求書のステータス | サブスクリプションのステータス |
---|---|---|---|
成功 | succeeded | paid | active |
カードエラーによる失敗 | requires_ | open | incomplete |
認証による失敗 | requires_ | open | incomplete |
注
Asynchronous payment methods, such as ACH Direct Debit, handle subscription status transitions differently than immediate payment methods. When you use asynchronous methods, subscriptions transition directly to an active
state after creation, bypassing the incomplete
state typically associated with other payment types. If an asynchronous payment fails later, it voids the associated invoice but the subscription remains in the active
state. This behavior contrasts with immediate payment methods, where failed payments often lead to incomplete
or past_
states. Be aware of this distinction and implement appropriate logic to manage subscription status, access control, and payment retry mechanisms.
以降のセクションでは、これらのステータスと、各ステータスに対するアクションを説明します。
支払いの成功
When the customer’s payment is successful:
- The
status
of the PaymentIntent moves tosucceeded
. - The
status
of the subscription isactive
. - The
status
of the invoice ispaid
. - 設定済みの Webhook エンドポイントに Stripe が
invoice.
イベントを送信します。paid
For payment methods with longer processing periods, subscriptions are immediately activated. In these cases, the status of the PaymentIntent might be processing
for an active
subscription until the payment succeeds.
With your subscription now activated, provision access to your product.
支払い方法が必要
If payment fails because of a card error such as a decline:
- The
status
of the PaymentIntent isrequires_
.payment_ method - The
status
of the subscription isincomplete
. - The
status
of the invoice isopen
.
これらのシナリオを処理するには、以下のステップに従います。
- 顧客に通知します。
- Collect new payment information and confirm the PaymentIntent.
- サブスクリプションの default payment method (デフォルトの支払い方法) を更新します。
- Stripe re-attempts payment using Smart Retries or based on your custom retry rules.
- Use the invoice.payment_failed event to monitor subscription payment failure events and retry attempt updates. After a payment attempt on an invoice, its next_payment_attempt value is set using the current subscription settings in your Dashboard.
サブスクリプションの支払い失敗を処理する方法は以下のとおりです。
アクションが必要
Some payment methods require customer authentication with 3D Secure (3DS) to complete the payment process. 3DS completes the authentication process. Whether a payment method requires authentication depends on your Radar rules and the issuing bank for the card.
If payment fails because the customer needs to authenticate a payment:
- The
status
of the PaymentIntent isrequires_
.action - The
status
of the subscription isincomplete
. - The
status
of the invoice isopen
.
これらのシナリオを処理するには、以下のステップに従います。
- Webhook エンドポイントを使用して
invoice.
イベントの通知を監視します。これには認証が必要です。payment_ action_ required - 認証が必要であることを顧客に通知します。
- Retrieve the client secret for the PaymentIntent and pass it in a call to stripe.ConfirmCardPayment. This displays an authentication modal to your customers, attempts payment, then closes the modal and returns context to your application.
- イベントの送信先で
invoice.
イベントをモニタリングし、支払いが成功したことを確認します。ユーザーは、paid confirmCardPayment()
が完了する前にアプリケーションを離れることができます。支払いが成功したかどうかを確認することで、商品を正しく提供できます。