Skip to content

Instantly share code, notes, and snippets.

@joasgarcia
Created March 14, 2018 18:11
Show Gist options
  • Save joasgarcia/4604ca4dbf5cb1e9840a793b7e07d9d2 to your computer and use it in GitHub Desktop.
Save joasgarcia/4604ca4dbf5cb1e9840a793b7e07d9d2 to your computer and use it in GitHub Desktop.
Criar cliente API ASAAS
<?php
$customerData = array(
"name" => "João da Silva",
"cpfCnpj" => "09434952967",
"postalCode" => "89223005",
"mobilePhone" => "47989134255",
"email" => "[email protected]"
);
$customerParamsJson = json_encode($customerData);
$curlRequest = curl_init("https://www.asaas.com/api/v3/customers");
curl_setopt($curlRequest, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curlRequest, CURLOPT_POSTFIELDS, $customerParamsJson);
curl_setopt($curlRequest, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlRequest, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"access_token: <COLOQUE AQUI A SUA API KEY>"
));
$responseData = curl_exec($curlRequest);
curl_close($curlRequest);
var_dump($responseData);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment