我正在尝试使用 Stripe 为一个非常具体的用例创建多个阶段。使用 Stripe Billings API 运行以下代码实际上不会创建多个阶段。它只创建一个阶段(最后一个)。
$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',
],
],
],
],
],
],
]);
尚方宝剑之说