Tue, 07/28/2015 - 08:01
#1
Invalid JS Tokens
I can retrieve what appears to be a valid token through your JavaScript example script but the format is very different from what appears in your API Documentation system. The token I retrieve looks like "7968999999978291". What is correct?
When I post this token via PHP to your API to complete the transaction I get an error payload back `{"error":"Dynamic backend host not specified”}`.
When I post this token via your API doc I get a 400 Bad Request - “Invalid Token Type”.
Hi Michael,
The token you received is correct. The token retains the same length and the last 4 digits of the card number.
Please verify if your code is calling the api with this URL: https://api-cert.payeezy.com/v1/transactions
If it still doesn't work. Please send us your API request and response JSONs along with HTTP headers.
Regards,
Payeezy Team.
Thanks, my URL was incorrect, so that fixed the 'Dynamic backend host' error. However, I have new errors:
"Error":{
"messages":[
{"code":"invalid_card_type","description":"The card type is invalid"},
{"code":"invalid_exp_date","description":"Expiry Date is invalid"}
]
}
Shouldn't this have been done during the card tokenization process? Or do I need to pass the expiry date and card type in the PHP request as well?
Hi Michael,
You do need to pass the card type and expiry date along with the token.
You can find more information here: https://developer.payeezy.com/tokenbasedpayments/apis/post/transactions
Regards,
Payeezy Team
Ok thanks, i was in the wrong section of your docs somehow. https://developer.payeezy.com/payeezy_new_docs/apis/post/transactions-2
It seems that your PHP library is generating an invalid payload for token transactions. It is forcing a method of `credit_card` and not passing through the `token` data into the final JSON payload.
Here's what I'm sending into the purchase method, which is confirmed working in your API test system.
{
"merchant_ref":"MerchantID",
"transaction_type":"purchase",
"method":"token",
"amount":9698,
"currency_code":"USD",
"token":{
"token_type":"FDToken",
"token_data":{
"type":"visa",
"cardholder_name":"Michael",
"exp_date":"0416",
"value":"9947447799970026"
}
}
}
Here is the payload that your PHP library generates from the above and send through the API postTransaction method:
{
"merchant_ref":"MerchantID",
"transaction_type":"purchase",
"method":"credit_card",
"amount":9698,
"currency_code":"USD",
"credit_card":{
"type":"",
"cardholder_name":"",
"card_number":"",
"exp_date":"",
"cvv":""
}
}
Hi Michael,
Thank you for bringing this to our notice.
The method getTokenPayload actually is for retrieving tokens. It is related to this: https://developer.payeezy.com/tokenizedtreditcardpost/apis/post/transactions/tokens-1
I just noticed that the method to conduct "Token based payments" is missing. We are working to add it back to the repository.
Regards,
Payeezy Team