0
I am trying to make a request via API to make sales via credit card.
URL of the Handbook: https://developercielo.github.io/manual/cielo-ecommerce#requisi%C3%A7%C3%A3o
JSON informed by CIELO
{
"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 404 error method, I called support and the url is correct and this is the only thing they say.
Someone’s already done it and knows how to light me up?
Try putting the
MerchantKey
in theheader
as in the documentation.– Vinicius Lourenço