4
My problem refers to integration with Cielo and I’ve reviewed everything, but without success.
I read this post: /questions/54039/na-api-da-cielo-em-php
"I understood" what I said in the post and I did so:
<?
//string json contendo os dados de um funcionário
$request = '{
"MerchantOrder":"2014111703",
"Customer":{
"Name":"Comprador crédito simples"
},
"Payment":{
"Type":"CreditCard",
"Amount":15700,
"Installments":1,
"Descriptor":"123456789ABCD",
"CreditCard":{
"Holder":"Teste Holder",
"ExpirationDate":"12/2030",
"SecurityCode":"123",
"Brand":"Visa"
}
}
}';
$data_string = json_encode($request, false);
$ch = curl_init("https://apisandbox.cieloecommerce.cielo.com.br/1/sales");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELD, $data_string);
curl_setopt($ch, CURLOPT_HTPPHEADER, array(
'Content-Type: application/json',
'MerchantId: ' . $MerchantID,
'MerchantKey: ' . $MerchantKey,
'Content-Length: ' . strlen($datastring))
);
$result = curl_exec($ch);
$result = json_decode($result, false);
echo "$result->ProofOfSale";
echo "$result->Tid";
echo "$result->Authorization";
echo "$result->SoftDescriptor";
echo "$result->ECI";
echo "$result->Status";
echo "$result->ReturnCode";
echo "$result->ReturnMessage";
?>
The final part refers to the return variables that Cielo informs comfort this manual:
But nothing comes back.
I really don’t understand anything about json and how it works in php.
If you could help me, I’d be most grateful.