Error 404 when using Sky Ecommerce API

0

I'm trying to make a request via API to make sales via credit card.

Manual URL: link

JSON informed by SKY

{
   "MerchantOrderId":"2014111703",
   "Customer":{
      "Name":"Comprador crédito simples"
   },
   "Payment":{
     "Type":"CreditCard",
     "Amount":15700,
     "Installments":1,
     "SoftDescriptor":"123456789ABCD",
     "CreditCard":{
         "CardNumber":"1234123412341231",
         "Holder":"Teste Holder",
         "ExpirationDate":"12/2030",
         "SecurityCode":"123",
         "Brand":"Visa"
     }
   }
}

AJAX method I developed

$.ajax({
           url: "https://api.cieloecommerce.cielo.com.br/1/sales/",
           headers:{
             "Content-Type": "application/x-www-form-urlencoded",
             "MerchantId": "INFORMADO PELA CIELO",
           },
           data: {
             "MerchantKey": "INFORMADO PELA CIELO",
             "MerchantOrderId": idCarrinho,
             "Customer":{
                "Name": nomeCliente
             },
             "Payment":{
               "Type": "CreditCard",
               "Amount": valor,
               "Installments": 1,
               "SoftDescriptor":"NOME EMPRESA",
               "CreditCard":{
                   "CardNumber": apenasNumeros(numero),
                   "Holder": nome,
                   "ExpirationDate": data,
                   "SecurityCode": cvv,
                   "Brand": bandeira
               }
             }
           },
           type: "POST",
           success: function(data)
           {
             console.log(data);
           },
           error: function(x)
           {
              Materialize.toast("Ocorreu um erro!", 4000);
           }
});

When I use this method of error 404, I called the media and the url is correct and that's the only thing they say.

Has anyone ever had it and knows how to give me a light?

    
asked by anonymous 19.09.2018 / 20:28

1 answer

0

You can not make this call through JS. You will have to send the information from the server side.

In this way you leave exposed your MerchantId and your MerchantKey.

    
31.10.2018 / 04:40