Bitaps.com错误代码10

时间:2017-10-12 00:52:55

标签: php bitcoin

这是他们在查询示例中为我添加的确切代码。无论我怎么做都不行。还有其他一些例子,但不是我需要的。

我得到的错误:{" error_code":10," message":" payment_list元素错误的键","详情": ""}

然而,当我使用他们的现场执行程序时它会起作用。

<?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
?>

1 个答案:

答案 0 :(得分:0)

单词 qouta 中的错误。需要配额

$rules = [
    array('address'=>'btc1', 'quota'=> 95),
    array('address'=>'btc2', 'quota'=> 5),
    array('address'=>'btc2', 'quota'=> 0)
  ];