Ir para conteúdo
Fórum Script Brasil

Lucas B Simoes

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre Lucas B Simoes

Lucas B Simoes's Achievements

0

Reputação

  1. Estou tendo um problema semelhante. Criei uma classe genérica para realizar as transações com a API 3.0 da Cielo. Porém só consigo o retorno {"Code": 0, "Message": "InternalError". $array = array(); $array['MerchantOrderId'] = self::$_ORDER_ID; $array['Customer']['Name'] = self::$_CUSTOMER_NAME; $array['Payment']['Type'] = self::$_PAYMENT_TYPE; $array['Payment']['Amount'] = self::$_AMOUNT; //$array['Payment']['Provider'] = self::$_PROVIDER; $array['Payment']['Installments'] = self::$_Installments; $array['Payment']['CreditCard']['CardNumber'] = self::$_CARTAO_NUMERO; $array['Payment']['CreditCard']['Holder'] = self::$_CARTAO_HOLDER; $array['Payment']['CreditCard']['ExpirationDate'] = self::$_CARTAO_EXPIRATION; $array['Payment']['CreditCard']['SecurityCode'] = self::$_SECURITY_CODE; $array['Payment']['CreditCard']['Brand'] = self::$_BRAND; $json = json_encode($array); //var_dump($json); if (self::$_transaction_mode == '1') { $url = self::API_SENDBOX_TESTE; } else { $url = self::API_PRODUCAO; } $url = $url . '1/sales/'; ob_start(); //Initiate cURL. $ch = curl_init($url); //Tell cURL that we want to send a POST request. curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); //Attach our encoded JSON string to the POST fields. curl_setopt($ch, CURLOPT_POSTFIELDS, $json); $headers = array( 'Content-Type: application/json', 'MerchantId: ' . self::$_MerchantId, 'MerchantKey: ' . self::$_MerchantKey, 'RequestId: ' . self::$_RequestId, ); //Set the content type to application/json curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //Execute the request curl_exec($ch); $result = ob_get_contents(); ob_end_clean(); curl_close($ch);
×
×
  • Criar Novo...