调至内容部分
创建账户或登录
Stripe 文档徽标
/
询问人工智能
创建账户登录
开始
付款
销售收入
平台和交易市场
资金管理
开发人员资源
API 和 SDK帮助
概览
关于 Stripe 支付
升级您的集成
支付分析
线上付款
概览查找您的用例使用 Managed Payments
使用 Payment Link
使用预制结账页面
    概览
    快速入门指南
    Checkout 的运作机制
    自定义外观样式
    收集额外信息
    收税
    动态更新结账流程
    管理产品目录
    订阅
      构建订阅集成
      配置免费试用
      每位客户限一个订阅。
      设置计费周期日期
    管理支付方式
    让客户用本地货币支付
    添加折扣、追加销售和可选商品
    设置未来付款
    支付过程中保存付款详情
    付款后
    从传统 Checkout 迁移
    迁移 Checkout 来使用 Prices
使用 Elements 构建自定义集成
构建应用内集成
线下支付
Terminal
支付方式
添加支付方式
管理支付方式
用 Link 更快结账
支付场景
处理多种货币
自定义支付流程
灵活收单
编排
超越支付功能
成立公司
加密货币
智能体商务 (Agentic Commerce)
Financial Connections
Climate
了解欺诈
Radar 欺诈保护
管理争议
验证身份
美国
简体中文
首页付款Use a prebuilt checkout pageSubscriptions

Configure free trials

Delay payments on subscriptions using free trial periods.

Stripe doesn’t set a specific limit on a free trial length. Most businesses use shorter trials (such as 30 days), but you can set longer periods. However, consider:

  • Keeping payment methods valid for post-trial charges
  • Potential impact on conversion rates with longer trials

You can configure a Checkout Session to start a customer’s subscription with a free trial by passing one of the following parameters:

  • subscription_data.trial_period_days, the length (in days) of your free trial.
  • subscription_data.trial_end, a Unix timestamp representing the end of the trial period.
Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -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

Free trials without collecting a payment method

By default, Checkout Sessions collect a payment method to use after the trial ends. You can sign customers up for free trials without collecting payment details by passing payment_method_collection=if_required.

Choose whether to cancel or pause the subscription if the customer doesn’t provide a payment method before the trial ends by passing trial_settings.end_behavior.missing_payment_method.

  • Cancel subscription-If the free trial subscription ends without a payment method, it cancels immediately. You can create another subscription if the customer decides to subscribe to a paid plan in the future.
  • Pause subscription-If the free trial subscription ends without a payment method, it pauses and doesn’t cycle until it’s resumed. When a subscription is paused, it doesn’t generate invoices (unlike when a subscription’s payment collection is paused). When your customer adds their payment method after the subscription has paused, you can resume the same subscription. The subscription can remain paused indefinitely.
Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -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

Collect payment details automatically

Before the trial expires, collect payment details from your customer.

Under Manage free trial messaging in your Subscriptions and emails settings, you can choose to automatically send a reminder email when a customer’s trial is about to expire.

Next, select the Link to a Stripe-hosted page option so the reminder email contains a link for the customer to add or update their payment details. We don’t send free trial reminder emails in a sandbox. Learn more about how to set up free trial reminders.

You must comply with card network requirements when offering trials. Learn more about compliance requirements for trials and promotions.

Collect payment details in the Billing customer portal

You can also send the reminder email yourself, and redirect customers to the Billing customer portal to add their payment details.

First, configure the Billing customer portal to enable your customers to manage their subscriptions.

Next, collect billing information from your customers:

  1. Listen to the customer.subscription.trial_will_end event.
  2. If the subscription doesn’t have a default payment method, get the customer’s email using the Customers API and send them a message with a link to your site. It’s helpful to embed the customer ID in the email, for example https://example.com?...&customer={{CUSTOMER_ID}}.
  3. When the customer lands on your site, create a customer portal session using the customer ID from the previous step.
  4. Redirect the customer to the customer portal, where they can update their subscription with payment details.

Your customers can also resume their paused subscription in the customer portal by selecting Start subscription, then adding a payment method. View free trial periods to learn how to configure a subscription to pause or cancel when a free trial ends without a payment method attached.

另请参阅

  • Using trial periods on subscriptions
  • Send an email reminder before the trial ends
  • Combine trials with usage-based billing
此页面的内容有帮助吗?
是否
  • 需要帮助?联系支持。
  • 查看我们的更改日志。
  • 有问题?联系销售。
  • LLM? Read llms.txt.
  • Powered by Markdoc