小编Elv*_*ali的帖子

如何在 Stripe 中指定订阅时长

我正在实现条带订阅,但在 api 文档中找不到如何在创建结账会话时指定订阅持续时间的信息。这是我到目前为止所拥有的:

    const customer = await stripe.customers.create({
      description: "My First Test Customer (created for API docs)",
      email: "some.email@gmail.com",
      address: {
        city: 'Toronto',
        country: 'CA',
        line1: "Some Address",
        line2: "Some unit number",
        postal_code: "M5G0V1",
        state: "ON",
      },
      name: "Some Name",
      phone: "Some Number",
    }); 
    const price = await stripe.prices.create({
      unit_amount: 599,
      currency: 'cad',
      recurring: {interval: 'month', interval_count: '1'},
      product: 'prod_KZfHFK4nfCqlGS',
    });
    const subscriptionSchedule = await stripe.subscriptionSchedules.create({
      customer: customer.id,
      start_date: 'now',
      end_behavior: 'cancel',
      phases: [
        {
          items: [
            {
              price: price.id, …
Run Code Online (Sandbox Code Playgroud)

stripe-payments

4
推荐指数
1
解决办法
3256
查看次数

标签 统计

stripe-payments ×1