第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Stripe 在 PHP 中創(chuàng)建多個(gè)階段

Stripe 在 PHP 中創(chuàng)建多個(gè)階段

PHP
慕桂英546537 2023-04-21 15:31:00
我正在嘗試使用 Stripe 為一個(gè)非常具體的用例創(chuàng)建多個(gè)階段。使用 Stripe Billings API 運(yùn)行以下代碼實(shí)際上不會(huì)創(chuàng)建多個(gè)階段。它只創(chuàng)建一個(gè)階段(最后一個(gè))。$schedule = \Stripe\SubscriptionSchedule::create([  'customer' => 'cus_HMDwmb8iAV0X7k',  'start_date' => 'now',  'end_behavior' => 'cancel',    'phases' => [      [        'end_date' => 1592910720,        'proration_behavior' => 'none',        'plans' => [          [            'price_data' => [              'unit_amount' => 5000,              'currency' => 'usd',              'product' => 'prod_HMrCxIwor5bbjO',              'recurring' => [                  'interval' => 'year',              ],            ],          ],        ],      ],    ],    'phases' => [      [        'end_date' => 1594850400,        'proration_behavior' => 'none',        'plans' => [          [            'price_data' => [              'unit_amount' => 6000,              'currency' => 'usd',              'product' => 'prod_HMrCxIwor5bbjO',              'recurring' => [                  'interval' => 'year',              ],            ],          ],        ],      ],    ],]);
查看完整描述

1 回答

?
尚方寶劍之說

TA貢獻(xiàn)1788條經(jīng)驗(yàn) 獲得超4個(gè)贊

在您的 php 調(diào)用中,您指定了phases參數(shù)兩次。因此只有第二個(gè)phases定義被用于創(chuàng)建訂閱計(jì)劃。此處的解決方法是將所有階段移動(dòng)到單個(gè)數(shù)組和參數(shù)下,如下所示:


$schedule = \Stripe\SubscriptionSchedule::create([

  'customer' => $customer->id,

  'start_date' => 'now',

  'end_behavior' => 'cancel',

    'phases' => [

      [

        'end_date' => 1592910720,

        'proration_behavior' => 'none',

        'plans' => [

          [

            'price_data' => [

              'unit_amount' => 5000,

              'currency' => 'usd',

              'product' => $product->id,

              'recurring' => [

                  'interval' => 'year',

              ],

            ],

          ],

        ],

      ],

      [

        'end_date' => 1594850400,

        'proration_behavior' => 'none',

        'plans' => [

          [

            'price_data' => [

              'unit_amount' => 6000,

              'currency' => 'usd',

              'product' => $product->id,

              'recurring' => [

                  'interval' => 'year',

              ],

            ],

          ],

        ],

      ],

    ],

]);

我看到的唯一區(qū)別是,在 Curl 請(qǐng)求中,我明確傳遞了階段編號(hào)。


更多的是你在 phases 數(shù)組中傳遞相位索引。您必須在 cURL 中明確說明這一點(diǎn),但在 php 中,您只需將每個(gè)元素添加到一個(gè)數(shù)組中,并且索引是隱含的。


查看完整回答
反對(duì) 回復(fù) 2023-04-21
  • 1 回答
  • 0 關(guān)注
  • 267 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)