Ola, Bom dia. estou tentando implementar o GerenciaNet em TS mas quando tento criar qualquer cobrança recebo não autorizado,
private gerenciaInstance = Gerencianet({
sandbox: this.config.sandbox,
client_id: this.config.client_id,
client_secret: this.config.client_secret,
pix_cert: this.config.pix_cert,
});
async createCharge(credit_card: any, billing_address: any, costumer_data: any, products: any): Promise < any > {
const test = {
items: [
{
name: 'Product 1',
value: 1000,
amount: 2,
},
],
shippings: [
{
name: 'Default Shipping Cost',
value: 100,
},
],
};
console.log("Create Charge Gerencianet Data:" + JSON.stringify(test));
return this.gerenciaInstance.createCharge({}, test).then((response: any) => {
console.log("Create Charge Gerencianet Response:" + JSON.stringify(response));
return response;
}).catch((error: any) => {
console.log("Create Charge Gerencianet Error:" + JSON.stringify(error));
return error;
})
}
Resposta
Create Charge Gerencianet Data:{"items":[{"name":"Product 1","value":1000,"amount":2}],"shippings":[{"name":"Default Shipping Cost","value":100}]}
Create Charge Gerencianet Error:"Unauthorized"
Termos mais procurados: