I'm not very knowledgeable about javascript, but I need to integrate a payment API.
I've never done integrations with any API before.
Following the documentation I saw that you first need to generate a transaction token.
So I have this code:
function GeraToken() {
var base64 = $.encodeBASE64(AppKey:CHAVE, Signature:ASSINATURA);
$.ajax({
url: "http://desenvolvimento.intermeio.com/api/v2_1/Token/Gerar",
headers: { "Authorization": "Intermeio " + base64, Content-Type: application/json },
type: "POST",
crossDomain: true,
dataType: "json",
success: function () {
alert('FOI');
},
error: function (xhr, status) {
alert('NAO FOI');
}
});
}
Where the GeraToken () function is a button that calls.
But I wanted to make sure that the call was correct. When I click the button it does not return any of the two alerts. The most ideal would be to return the same screen token, just so I can see that it worked, because I need to store that token in the database. In the API it says that the return will be in JSON.
Could anyone help me?
Thank you!