question

manikandank avatar image
manikandank asked bryanvargas answered

Error Generating Card Tokens: 'Invalid JSON Format' for American Express and MasterCard, but Successful for Visa and Discover

Hello Clover Community,


I'm facing an issue while trying to generate card tokens using the Clover API. Specifically, when attempting to generate a card token for American Express or MasterCard, I'm receiving a '400 Bad Request' response with the message 'Invalid JSON format.' Interestingly, this issue does not occur when using Visa or Discover cards for token generation.


I have provided the request payloads and responses for both unsuccessful (American Express/MasterCard) and successful (Visa/Discover) cases. I'm seeking insights, advice, or potential solutions to resolve this issue and achieve successful token generation for American Express and MasterCard transactions.


Any assistance or recommendations on debugging and resolving this issue would be greatly appreciated. Thank you for your time and expertise!

CardTokenApi Endpoint: https://token-sandbox.dev.clover.com/v1/tokens

For Mastercard and American Express:

Response

{"message":"Invalid JSON format"}

Request Payload

card: {brand: "American Express", number: "371111111111114", exp_month: "4", exp_year: "2024", cvv: "5434",…}

brand: "American Express"

cvv: "5434"

exp_month: "4"

exp_year: "2024"

first6: "371111"

last4: "1114"

number: "371111111111114"


For Visa and Discover (successfull):

{card: {brand: "Visa", number: "4242424242424242", exp_month: "3", exp_year: "2025", cvv: "654",…}}

card: {brand: "Visa", number: "4242424242424242", exp_month: "3", exp_year: "2025", cvv: "654",…}

brand: "Visa"

cvv: "654"

exp_month: "3"

exp_year: "2025"

first6: "424242"

last4: "4242"

number: "4242424242424242"


{id: "clv_1TSTShChcBuTFiuaUaT1dSp3", object: "token",…}

card: {exp_month: "3", exp_year: "2025", first6: "424242", last4: "4242", brand: "VISA"}

id: "clv_1TSTShChcBuTFiuaUaT1dSp3"

object: "token"

RequestResponse:

{

"id": "clv_1TSTShChcBuTFiuaUaT1dSp3",

"object": "token",

"card": {

"exp_month": "3",

"exp_year": "2025",

"first6": "424242",

"last4": "4242",

"brand": "VISA"

}

}

e-commerce apiAPI Token
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hortenciawaxman avatar image
hortenciawaxman answered

Your post is quite important to me; I look forward to reading more of your thoughts. I have discovered a quite enjoyable game called geometry dash unblocked ; if you have time, please join and play with me.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bryanvargas avatar image
bryanvargas answered

The brand for the payload for American Express is "AMEX" and for MasterCard is "MC"

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community