1 回答
TA贡献1818条经验 获得超7个赞
您在这里应该做的是首先构建阶段数组,最后创建时间表。我不完全理解为什么你有这么多阶段的同一个计划,但最终你会想要这样的东西
$paymentdates = array ("1592043010", "1592910720", "1594850400", "1595851200", "1597021320");
$phases = []
foreach ($paymentdates as $paymentdate) {
$phases[] = [
'end_date' => $paymentdate,
'plans' => [
[
'price_data' => [
'unit_amount' => 2300,
'currency' => 'usd',
'product' => 'prod_HMDoA6Jpf0U1Fh',
'recurring' => [
'interval' => 'year',
],
],
],
],
];
}
$schedule = \Stripe\SubscriptionSchedule::create([
'customer' => 'cus_HMDwmb8iAV0X7k',
'start_date' => 'now',
'end_behavior' => 'cancel',
'phases' => $phases
]);
- 1 回答
- 0 关注
- 94 浏览
添加回答
举报