0
public function create_plan_paystack(){
$data = array(
"name"=> "Monthly retainer", "interval"=>"monthly", "amount"=>500,'currency'=>'NGN','description'=>'test'
);
$sendjson = array();
$opts = array(
'http'=>array(
'header'=> ["Authorization: Bearer ".$this->config->item('paystack_sk')."\r\n" ,"Content-Type: application/json\r\n"] ,
'method' => 'GET',
'content' => json_encode($data)// http_build_query($data),
)
);
print_r($opts);
$context = stream_context_create($opts);
$json = file_get_contents("https://api.paystack.co/plan/".'PLN_lp20ulqhzezihrc',false,$context);
$obj = json_decode($json);
print_r($obj);
}
我想發佈$data
數組爲json。 「https://developers.paystack.co/docs/create-plan」這是他們給予.plaese幫助我的方式。在php中發佈數據爲json
'方法'=> 'POST',我chaged張貼方法 –