1 回答

TA貢獻1788條經驗 獲得超4個贊
在您的 php 調用中,您指定了phases參數兩次。因此只有第二個phases定義被用于創建訂閱計劃。此處的解決方法是將所有階段移動到單個數組和參數下,如下所示:
$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',
],
],
],
],
],
],
]);
我看到的唯一區別是,在 Curl 請求中,我明確傳遞了階段編號。
更多的是你在 phases 數組中傳遞相位索引。您必須在 cURL 中明確說明這一點,但在 php 中,您只需將每個元素添加到一個數組中,并且索引是隱含的。
- 1 回答
- 0 關注
- 234 瀏覽
添加回答
舉報