Bitaps com Error Code 10

0 votes

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?
Sep 7, 2018 in Blockchain by digger
• 26,740 points
733 views

1 answer to this question.

0 votes

Mistake in word qouta. Need quota

$rules = [
    array('address'=>'btc1', 'quota'=> 95),
    array('address'=>'btc2', 'quota'=> 5),
    array('address'=>'btc2', 'quota'=> 0)
  ];
answered Sep 7, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

0 votes
1 answer
0 votes
1 answer
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
45,063 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,885 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
820 views
0 votes
1 answer

Blockcypher API code error

This code will work: <?php try ...READ MORE

answered Aug 23, 2018 in Blockchain by slayer
• 29,370 points
1,205 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP