Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user = 'xxxxxxxxxxxxxxxxxxxxxxxx';
- $pass = '';
- $data = array(
- "email" => "Baralho@gmail.com",
- "due_date" => "2018-10-08",
- "items" => array(
- "description"=>"carro",
- "quantity"=> 1,
- "price_cents"=>150000
- ),
- "payer"=>array(
- "cpf_cnpj"=>"644.620.920-74",
- "name"=>"Jeison",
- "phone_prefix"=>"31",
- "phone"=>"991872520",
- "address"=>array(
- "zip_code"=>"30520240",
- "number"=>"109",
- "street"=>"blenda"
- )
- )
- );
- $data_string=json_encode($data);
- $ch = curl_init();
- curl_setopt( $ch, CURLOPT_URL, 'https://api.iugu.com/v1/invoices/' );
- curl_setopt( $ch, CURLOPT_HEADER, 1 );
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Authorization: Basic ' . base64_encode( $user . ':' . $pass ) ) );
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch,CURLOPT_POST, TRUE);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- $return=curl_exec( $ch );
- curl_close( $ch );
- header("Content-Type: text/json; charset=utf8");`
- //demais itens omitidos
- $data = array(
- "items" => array(
- array(
- "description"=>"carro",
- "quantity"=> 1,
- "price_cents"=>150000
- )
- )
- );
- //demais itens omitidos
- $data = array(
- "items" => [
- [
- "description"=>"carro",
- "quantity"=> 1,
- "price_cents"=>150000
- ]
- ]
- );
Add Comment
Please, Sign In to add comment