Выставление счета qiwi api php
Пытаюсь выставить счет. curl сначала ждет ответа около минуты, потом возвращает код ответа 100 без тела ответа. Код:
$t = time() + 3600 * 24;
$date = date("Y-m-d\TH:i:sP", $t);
$data = [
"amount" => [
"value" => $sum,
"currency" => "RUB"
],
"comment" => "text comment",
"exporationDateTime" => $date,
"customer" => [
"phone" => $phone
]
];
$headers = ["Accept: application/json", "Authorization: Bearer $secret_key", "Content-Length: " . strlen(json_encode($data))];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_PUT => 1,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_URL => "https://api.qiwi.com/partner/bill/v1/bills/{$order_id}",
CURLOPT_HTTPHEADER => array_merge(array("Content-Type: application/json"), $headers)
]);
$result = curl_exec($curl);
Где может быть ошибка? Может у кого есть готовые примеры на php?