"receipt" => array(
"customer" => array(
"full_name" => "Иванов Иван Иванович",
"phone" => "79000000000",
),
"items" => array(
array(
"description" => "Наименование товара 1",
"quantity" => "2.00",
"amount" => array(
"value" => "250.00",
"currency" => "RUB"
),
"vat_code" => "2",
"payment_mode" => "full_prepayment",
"payment_subject" => "commodity"
),
array(
"description" => "Наименование товара 2",
"quantity" => "1.00",
"amount" => array(
"value" => "100.00",
"currency" => "RUB"
),
"vat_code" => "2",
"payment_mode" => "full_prepayment",
"payment_subject" => "commodity"
)
)
)
// стартовый массив
$items = [
1 => array(
"description" => "Наименование товара 1",
"quantity" => "2.00",
"value" => "250.00",
"currency" => "RUB",
),
2 => array(
"description" => "Наименование товара 2",
"quantity" => "1.00",
"value" => "100.00",
"currency" => "RUB",
)
];
// пересобираем для отправки
$array['receipt']['customer']['full_name'] = 'Иванов Иван Иванович';
$array['receipt']['customer']['phone'] = '79000000000';
foreach ( $items as $key => $item ) {
$array['receipt']['items'][] = [
"description" => $item['description'],
"quantity" => $item['quantity'],
"amount" => array(
"value" => $item['value'],
"currency" => $item['currency'],
),
"vat_code" => "2",
"payment_mode" => "full_prepayment",
"payment_subject" => "commodity"
];
}
var_dump($array);
$item['description']
, $item['quantity']
и т.д.