Re: Visa Card Token: Error mapping JSON to field [null]

kevokevoh
Helper

Visa Card Token: Error mapping JSON to field [null]

Hey,

I make a request to get a key of which I get back a keyId

When sending a request to receive a token I get a 400 Error mapping JSON

{ status: 400,
     reason: 'JSON_PARSER_ERROR',
     message: 'JSON parsing error - JsonMappingException',
     correlationId: null,
     details:
      [ { location: 'Line [1], column [1]',
          message: 'Error mapping JSON to field [null]' },
        [length]: 1 ],
     _embedded: {} },
  _links:
   { self: null,
     documentation: [ [length]: 0 ],
     next: [ [length]: 0 ] } }

Heres what I am sending

 { url: 'https://sandbox.api.visa.com/cybersource/payments/flex/v1/tokens?apikey={my_api_key}',
  method: 'POST',
  json: true,
  headers:
   { Accept: 'application/json',
     'Content-Type': 'application/json' },
  body: '{"kid":"Returned_KEY","cardDetails":{"cardNumber":"4111111111111111","cardType":"001"}}' }

Also when I send an encrypted card number ie similar to what is in docs, I still get the same error.

Whats the Issue here?

Thanks

 

 

6 REPLIES 6
API_Products
Visa Developer Support Specialist

Re: Visa Card Token: Error mapping JSON to field [null]

Hello kevokevoh,

 

 

If you are using CyberSource v1 APIs, this version was deprecated. You will need to move to v2 CyberSource APIs going forward. I have provided the link to the v2 Cybersource APIs below.

 

Cybersource Payments REST API

https://developer.visa.com/capabilities/cybersource/reference#cybersource__cybs_payments_v2

 

 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

kevokevoh
Helper

Re: Visa Card Token: Error mapping JSON to field [null]

Hey,

 

This is the endpoint that I am hitting and getting the error described above.

 

https://developer.visa.com/capabilities/cybersource/reference#cybersource__cybersource_flex_api__v1_...

 

Thanks

kevokevoh
Helper

Re: Visa Card Token: Error mapping JSON to field [null]

Curl Request of what I am doing

curl -d '{"keyId": "08oEBwb5VEozxYbt8dC7wSoxQ19XfKUA", "cardDetails": {"cardNumber": "4111111111111111", "cardType": "001"}}' -H "Content-Type: application/json" -X POST https://sandbox.api.visa.com/cybersource/payments/flex/v1/tokens?apikey=5JVREDISR0UUTJNJEM5021rH3RhbYpE2Ego520vv8mQnlrRzA -v

Response

{"responseStatus":{"status":400,"reason":"JSON_PARSER_ERROR","message":"JSON parsing error - UnrecognizedPropertyException","correlationId":null,"details":[{"location":"Line [1], column [63]","message":"Error mapping JSON to field [cardDetails]"}],"_embedded":{}},"_links":{"self":null,"documentation":[],"next":[]}}
API_Products
Visa Developer Support Specialist

Re: Visa Card Token: Error mapping JSON to field [null]

Hi @audymaccop and @kevokevoh,

 

You're both receiving errors because v1 CyberSource Payments API was deprecated. You will need to move to v2 CyberSource APIs going forward. Here's the link to v2 CyberSource Payments API.

 

Cybersource Payments REST API

https://developer.visa.com/capabilities/cybersource/reference#cybersource__cybs_payments_v2




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

Parthpanchal
Regular Visitor

Re: Visa Card Token: Error mapping JSON to field [null]

Uh oh... there has been an blunders together with your price [102] There seems to be a typo in your card information - please try again under. If the trouble persists, try the usage of a new card or fee approach.

every body getting the same message?

DaVinceCoder
Helper

Re: Visa Card Token: Error mapping JSON to field [null]

I also experience this one. Instead of "cardDetails" key name change it ti "cardInfo" , Below is from cybersource itself. Thank you

 

Screen Shot 2019-01-29 at 11.23.15 PM.png