# 無料トライアルを設定 無料トライアル期間を使用してサブスクリプションの支払いを遅らせます。 Stripe Checkout で無料トライアルを設定できます。無料トライアルの最大期間は 2 年 (730 日) ですが、ほとんどのビジネスでは 30 日などの短いトライアルが使用されています。トライアルの長期化に影響する可能性のある問題には、以下のようなものがあります。 - 初回の支払い前に期限切れになる支払い方法 - 購入完了率の低下 # ホスト型ページ > This is a ホスト型ページ for when payment-ui is stripe-hosted. View the full page at https://docs.stripe.com/payments/checkout/free-trials?payment-ui=stripe-hosted. 以下のいずれかのパラメーターを渡すことで、顧客のサブスクリプションを無料トライアルで開始するように Checkout Session を設定できます。 - [Subscription_data.trial_period_days](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_period_days): 無料トライアルの期間 (日数)。 - [Subscription_data.trial_end](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_end)、トライアル期間の終了を表す Unix タイムスタンプです。 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d mode=subscription \ --data-urlencode "success_url=https://example.com/success" \ -d "line_items[0][price]={{PRICE_ID}}" \ -d "line_items[0][quantity]=1" \ -d "subscription_data[trial_period_days]=30" ``` ## 決済手段を収集しない無料トライアル デフォルトでは、Checkout Sessions はトライアル終了後に使用する決済手段を収集します。[payment_method_collection=if_required](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_method_collection) を渡すことで、支払いの詳細を収集することなく、顧客を無料トライアルに登録できます。 [trial_settings.end_behavior.missing_payment_method](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_settings-end_behavior-missing_payment_method) を過ぎてトライアルが終了する前に顧客が決済手段指定しなかった場合に、サブスクリプションをキャンセルするか一時停止するかを選択します。 - **サブスクリプションのキャンセル**- 無料トライアルのサブスクリプションが決済手段なしで終了した場合、すぐにキャンセルされます。顧客が将来有料プランに加入することを決定した場合、別のサブスクリプションを作成できます。 - **サブスクリプションの一時停止**- 無料トライアルのサブスクリプションが支払い方法を指定せずに終了した場合、サブスクリプションは一時停止され、再開されるまで循環しません。サブスクリプションを一時停止しても、請求書は生成されません (サブスクリプションの[支払い回収](https://docs.stripe.com/billing/subscriptions/pause-payment.md)が一時停止されている場合とは異なります)。サブスクリプションの一時停止後に顧客が支払い方法を追加した場合は、同じサブスクリプションを再開できます。サブスクリプションは無期限に一時停止したままにすることができます。 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d mode=subscription \ --data-urlencode "success_url=https://example.com/success" \ -d "line_items[0][price]={{PRICE_ID}}" \ -d "line_items[0][quantity]=1" \ -d "subscription_data[trial_period_days]=30" \ -d "subscription_data[trial_settings][end_behavior][missing_payment_method]=cancel" \ -d payment_method_collection=if_required ``` ### 支払い詳細を自動収集 トライアルの有効期限が切れる前に、顧客から支払いの詳細を収集します。 [サブスクリプションとメール通知の設定](https://dashboard.stripe.com/settings/billing/automatic)の**無料トライアルに関するメッセージを管理する**で、顧客のトライアルの有効期限が近づいている場合にリマインドメールを自動送信するように選択できます。 次に、**Stripe 上の決済画面へのリンク\**オプションを選択して、顧客が支払いの詳細を追加または更新するためのリンクをお知らせメールに含めます。サンドボックスでは無料トライアルのお知らせメールは送信されません。無料トライアルのお知らせメール[の設定](https://docs.stripe.com/billing/revenue-recovery/customer-emails.md#trial-ending-reminders)方法の詳細をご確認ください。 トライアルを提供する際にはカードネットワークの要件に準拠する必要があります。[トライアルとプロモーションの法令遵守要件](https://docs.stripe.com/billing/subscriptions/trials/manage-trial-compliance.md)について詳しくはこちらをご覧ください。 ### Billing カスタマーポータルで支払いの詳細を収集する お客様自らリマインダーを送信して、顧客を Billing カスタマーポータルにリダイレクトし、支払い情報を追加させることも可能です。 まず、[Billing カスタマーポータル](https://docs.stripe.com/customer-management.md)を設定して、顧客がサブスクリプションを自ら管理できるようにします。 次に、顧客から請求先情報を収集します。 1. `customer.subscription.trial_will_end` [イベント](https://docs.stripe.com/api/events/types.md#event_types-customer.subscription.trial_will_end)をリッスンします。 1. サブスクリプションに [default payment method (デフォルトの決済手段)](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-default_payment_method) がない場合、[Customer API](https://docs.stripe.com/api/customers/retrieve.md) を使用して顧客のメールアドレスを取得し、お客様のサイトへのリンクが記載されたメッセージを送信するようにしてください。メールに顧客 ID を埋め込んでおくと便利です (例: `https://example.com?...&customer={{CUSTOMER_ID}}`)。 1. 顧客がサイトにアクセスしたら、前のステップの顧客 ID を使用してカスタマーポータルセッションを作成します。 1. 顧客をカスタマーポータルに[リダイレクト](https://docs.stripe.com/customer-management/integrate-customer-portal.md#redirect)します。ここで顧客は、支払い情報を使用してサブスクリプションを更新できます。 顧客は、カスタマーポータルで**サブスクリプションを開始**を選択し、決済手段を追加して、[一時停止されたサブスクリプションを再開](https://docs.stripe.com/billing/subscriptions/trials/free-trials.md#resume-a-paused-subscription)することもできます。決済手段が関連付けられていない状態で無料トライアルが終了したときにサブスクリプションを一時停止またはキャンセルするように設定する方法については、[無料トライアル期間](https://docs.stripe.com/billing/subscriptions/trials/free-trials.md#create-free-trials-without-payment)をご覧ください。 # 埋め込みページ > This is a 埋め込みページ for when payment-ui is embedded-form. View the full page at https://docs.stripe.com/payments/checkout/free-trials?payment-ui=embedded-form. 以下のいずれかのパラメーターを渡すことで、顧客のサブスクリプションを無料トライアルで開始するように Checkout Session を設定できます。 - [Subscription_data.trial_period_days](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_period_days): 無料トライアルの期間 (日数)。 - [Subscription_data.trial_end](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_end)、トライアル期間の終了を表す Unix タイムスタンプです。 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d mode=subscription \ -d ui_mode=embedded_page \ --data-urlencode "return_url=https://example.com/return" \ -d "line_items[0][price]={{PRICE_ID}}" \ -d "line_items[0][quantity]=1" \ -d "subscription_data[trial_period_days]=30" ``` ## 決済手段を収集しない無料トライアル デフォルトでは、Checkout Sessions はトライアル終了後に使用する決済手段を収集します。[payment_method_collection=if_required](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_method_collection) を渡すことで、支払いの詳細を収集することなく、顧客を無料トライアルに登録できます。 [trial_settings.end_behavior.missing_payment_method](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_settings-end_behavior-missing_payment_method) を過ぎてトライアルが終了する前に顧客が決済手段指定しなかった場合に、サブスクリプションをキャンセルするか一時停止するかを選択します。 - **サブスクリプションのキャンセル**- 無料トライアルのサブスクリプションが決済手段なしで終了した場合、すぐにキャンセルされます。顧客が将来有料プランに加入することを決定した場合、別のサブスクリプションを作成できます。 - **サブスクリプションの一時停止**- 無料トライアルのサブスクリプションが支払い方法を指定せずに終了した場合、サブスクリプションは一時停止され、再開されるまで循環しません。サブスクリプションを一時停止しても、請求書は生成されません (サブスクリプションの[支払い回収](https://docs.stripe.com/billing/subscriptions/pause-payment.md)が一時停止されている場合とは異なります)。サブスクリプションの一時停止後に顧客が支払い方法を追加した場合は、同じサブスクリプションを再開できます。サブスクリプションは無期限に一時停止したままにすることができます。 ```curl curl https://api.stripe.com/v1/checkout/sessions \ -u "<>:" \ -d mode=subscription \ -d ui_mode=embedded_page \ --data-urlencode "return_url=https://example.com/return" \ -d "line_items[0][price]={{PRICE_ID}}" \ -d "line_items[0][quantity]=1" \ -d "subscription_data[trial_period_days]=30" \ -d "subscription_data[trial_settings][end_behavior][missing_payment_method]=cancel" \ -d payment_method_collection=if_required ``` ### 支払い詳細を自動収集 トライアルの有効期限が切れる前に、顧客から支払いの詳細を収集します。 [サブスクリプションとメール通知の設定](https://dashboard.stripe.com/settings/billing/automatic)の**無料トライアルに関するメッセージを管理する**で、顧客のトライアルの有効期限が近づいている場合にリマインドメールを自動送信するように選択できます。 次に、**Stripe 上の決済画面へのリンク\**オプションを選択して、顧客が支払いの詳細を追加または更新するためのリンクをお知らせメールに含めます。サンドボックスでは無料トライアルのお知らせメールは送信されません。無料トライアルのお知らせメール[の設定](https://docs.stripe.com/billing/revenue-recovery/customer-emails.md#trial-ending-reminders)方法の詳細をご確認ください。 トライアルを提供する際にはカードネットワークの要件に準拠する必要があります。[トライアルとプロモーションの法令遵守要件](https://docs.stripe.com/billing/subscriptions/trials/manage-trial-compliance.md)について詳しくはこちらをご覧ください。 ### Billing カスタマーポータルで支払いの詳細を収集する お客様自らリマインダーを送信して、顧客を Billing カスタマーポータルにリダイレクトし、支払い情報を追加させることも可能です。 まず、[Billing カスタマーポータル](https://docs.stripe.com/customer-management.md)を設定して、顧客がサブスクリプションを自ら管理できるようにします。 次に、顧客から請求先情報を収集します。 1. `customer.subscription.trial_will_end` [イベント](https://docs.stripe.com/api/events/types.md#event_types-customer.subscription.trial_will_end)をリッスンします。 1. サブスクリプションに [default payment method (デフォルトの決済手段)](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-default_payment_method) がない場合、[Customer API](https://docs.stripe.com/api/customers/retrieve.md) を使用して顧客のメールアドレスを取得し、お客様のサイトへのリンクが記載されたメッセージを送信するようにしてください。メールに顧客 ID を埋め込んでおくと便利です (例: `https://example.com?...&customer={{CUSTOMER_ID}}`)。 1. 顧客がサイトにアクセスしたら、前のステップの顧客 ID を使用してカスタマーポータルセッションを作成します。 1. 顧客をカスタマーポータルに[リダイレクト](https://docs.stripe.com/customer-management/integrate-customer-portal.md#redirect)します。ここで顧客は、支払い情報を使用してサブスクリプションを更新できます。 顧客は、カスタマーポータルで**サブスクリプションを開始**を選択し、決済手段を追加して、[一時停止されたサブスクリプションを再開](https://docs.stripe.com/billing/subscriptions/trials/free-trials.md#resume-a-paused-subscription)することもできます。決済手段が関連付けられていない状態で無料トライアルが終了したときにサブスクリプションを一時停止またはキャンセルするように設定する方法については、[無料トライアル期間](https://docs.stripe.com/billing/subscriptions/trials/free-trials.md#create-free-trials-without-payment)をご覧ください。 ## See also - [サブスクリプションでのトライアル期間の使用](https://docs.stripe.com/billing/subscriptions/trials/free-trials.md) - [トライアルの終了前にお知らせメールを送信する](https://docs.stripe.com/billing/subscriptions/trials/manage-trial-compliance.md#notify-customers-with-trial-end-reminder-emails) - [トライアルと従量課金制の組み合わせ](https://docs.stripe.com/billing/subscriptions/trials/free-trials.md#trials-usage-based-billing)