2 posts / 0 new
Last post
michelleharhai3221
Missing or Invalid API Key

Code adapted from github, no matter what I put in the setApiKey and setMerchantIdentifier calls I always get "Missing or Invalid API Key" back from the Payeezy.createToken() call

code snippet is below with {{where}} I've gotten each of the two values from, which seem correct to me!

<script src="https://developer.payeezy.com/v1/payeezy.js" type="text/javascript"></script>
<script type="text/javascript">

Payeezy.setApiKey('{{ My APIS > (Sandbox account) > Keys > API Key }}');
Payeezy.setMerchantIdentifier('{{ My APIS > (Sandbox account) > Entitlements > Merchant Identifier }}');

var responseHandler = function(status, response)
{
var $form = $('#payment-info-form');
if (status != 201) {
if (response.error) {
var errorMessages = response.error.messages;
var allErrors = '';
for (i=0; i<errorMessages.length;i++) {
allErrors = allErrors + errorMessages[i].description + '<br/>';
}
$form.find('.payment-errors').html(allErrors);
}
$form.find('button').prop('disabled', false);
} else {
var token = response.token.value;
alert(token)
$form.append($('<input type="hidden" name="payeezyToken"/>').val(token));
$form.get(0).submit();
}
};
jQuery(function($) {
$('#payment-info-form').submit(function(e) {
var $form = $(this);
$form.find('button').prop('disabled', true);
Payeezy.createToken(responseHandler);
return false;
});
});
</script>


pramodrao2872
Re: Missing or Invalid API Key

I see that you have two apps created in sandbox area called TESTONLY Nicola Couture. You have also added entitlements to both apps.

For Payeezy.js code, please set api key from My APIs and Merchant Identifier from Entitlements to generate the token. Use the api key and entitlement from the same app.

 

Before testing in payeezy.js code, you can also test this from DOCS & SANDBOX area by replacing api key and trtoken to verify the SECURITY tokens API is generating a token for you.

 

https://developer.payeezy.com/payeezy_new_docs/apis/get/securitytokens