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?