I am trying to execute the following code:
<?php
function post_api($url, $postfields) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
return $result;
}
$confirmations = 3;
$callback = urlencode("https://website.ml/ipnbtc?id=2&email=email@gmail.com");
$fee = "low";
$rules = [
array('address'=>'btc1', 'qouta'=> 95),
array('address'=>'btc2', 'qouta'=> 5),
array('address'=>'btc2', 'qouta'=> 0)
];
$postfields = json_encode(array('type'=>"payment_distribution", 'payment_distribution'=> $rules ));
$data = post_api("https://bitaps.com/api/create/payment/smartcontract/". $callback . "?confirmations=" . $confirmations . "&fee_level=" . $fee, $postfields);
echo $data;
$respond = json_decode($data,true);
$address = $respond["address"]; // Bitcoin address to receive payments
$payment_code = $respond["payment_code"]; //Payment Code
$invoice = $respond["invoice"]; // Invoice to view payments and transactions
?>
The error I get: {"error_code": 10, "message": "payment_list element incorrect keys", "details": ""}
How can i solve this error?