Boa tarde! Estou tentando implementar o pagamento via cartão em nodejs, porém recebo o erro "bad request". Alguém sabe como resolver ?
function Pagar(payment_token, card_mask, autorizacao){
var data = JSON.stringify({
"items": [
{
"name": "Meu Produto",
"value": 5990,
"amount": 1
}
],
"payment": {
"credit_card": {
"customer": {
"name": "Gorbadoc Oldbuck",
"cpf": "94271564656",
"email": "
[email protected]",
"birth": "1990-08-29",
"phone_number": "5144916523"
},
"installments": 1,
"payment_token": payment_token,
"billing_address": {
"street": "Avenida Juscelino Kubitschek",
"number": "909",
"neighborhood": "Bauxita",
"zipcode": "35400000",
"city": "Ouro Preto",
"complement": "",
"state": "MG"
}
}
}
});
var config = {
method: 'post',
maxBodyLength: Infinity,
url: '
https://cobrancas-h.api.efipay.com.br/v1/charge/one-step',
headers: {
'Authorization': autorizacao.access_token,
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
}