我有这段 PHP 代码,它遍历 Stripe 请求以创建计划。在下面的请求中,它遍历整个请求(从而为数组的每个元素创建一个新订阅)。我需要它做的是仅通过阶段部分对其进行迭代(以便所有付款日期都在一个时间表中)。
$paymentdates = array ("1592043010", "1592910720", "1594850400", "1595851200", "1597021320");
foreach ($paymentdates as $paymentdate) {
$schedule = \Stripe\SubscriptionSchedule::create([
'customer' => 'cus_HMDwmb8iAV0X7k',
'start_date' => 'now',
'end_behavior' => 'cancel',
'phases' => [
// only iterate this part
[
'end_date' => $paymentdate,
'proration_behavior' => 'none',
'plans' => [
[
'price_data' => [
'unit_amount' => 2300,
'currency' => 'usd',
'product' => 'prod_HMDoA6Jpf0U1Fh',
'recurring' => [
'interval' => 'year',
],
],
],
],
// end iterate here
],
],
]);
}
qq_笑_17