<?php
$dataset = array(
array(
"product" => 4,
"unit_amount" => "2020",
"end_date" => date_timestamp_get(date_create("2020-07-12")) // Payment 1 Date
),
array(
"product" => 5,
"unit_amount" => "2000",
"end_date" => date_timestamp_get(date_create("2020-07-15")) //Payment 2 Date
),
array(
"product" => 6,
"unit_amount" => "3400",
"end_date" => date_timestamp_get(date_create("2020-07-16")) //Payment 3 Date
),
array(
"product" => 7,
"unit_amount" => "3700",
"end_date" => date_timestamp_get(date_create("2020-07-18")) //Payment 4 Date
),
);
$phases = [];
foreach ($dataset as $data) {
$phases[] = [
'end_date' => $data["end_date"],
'transfer_data' => [
'amount_percent' => 20,
'destination' => 10],
'proration_behavior' => 'none',
'plans' => [
[
'price_data' => [
'unit_amount' => $data["unit_amount"],
'currency' => 'usd',
'product' => $data["product"],
'recurring' => [
'interval' => 'month',
],
],
],
],
];
}
$schedule_batch = array_chunk($phases, 2);
$numberofbatches = count($schedule_batch);
print_r($schedule_batch);
Abusive script
This script was stopped while abusing our resources
- Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.3.33, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
- Array
(
[0] => Array
(
[0] => Array
(
[end_date] => 1594504800
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 2020
[currency] => usd
[product] => 4
[recurring] => Array
(
[interval] => month
)
)
)
)
)
[1] => Array
(
[end_date] => 1594764000
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 2000
[currency] => usd
[product] => 5
[recurring] => Array
(
[interval] => month
)
)
)
)
)
)
[1] => Array
(
[0] => Array
(
[end_date] => 1594850400
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 3400
[currency] => usd
[product] => 6
[recurring] => Array
(
[interval] => month
)
)
)
)
)
[1] => Array
(
[end_date] => 1595023200
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 3700
[currency] => usd
[product] => 7
[recurring] => Array
(
[interval] => month
)
)
)
)
)
)
)
- Output for 7.3.32, 7.4.26, 8.0.13
- Array
(
[0] => Array
(
[0] => Array
(
[end_date] => 1594512000
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 2020
[currency] => usd
[product] => 4
[recurring] => Array
(
[interval] => month
)
)
)
)
)
[1] => Array
(
[end_date] => 1594771200
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 2000
[currency] => usd
[product] => 5
[recurring] => Array
(
[interval] => month
)
)
)
)
)
)
[1] => Array
(
[0] => Array
(
[end_date] => 1594857600
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 3400
[currency] => usd
[product] => 6
[recurring] => Array
(
[interval] => month
)
)
)
)
)
[1] => Array
(
[end_date] => 1595030400
[transfer_data] => Array
(
[amount_percent] => 20
[destination] => 10
)
[proration_behavior] => none
[plans] => Array
(
[0] => Array
(
[price_data] => Array
(
[unit_amount] => 3700
[currency] => usd
[product] => 7
[recurring] => Array
(
[interval] => month
)
)
)
)
)
)
)
preferences:
148.5 ms | 434 KiB | 5 Q