- date_timestamp_get: documentation ( source)
- date_create: documentation ( source)
- array_chunk: documentation ( source)
- print_r: documentation ( source)
<?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);
This script was stopped while abusing our resources