'Flex api V2 (flex/v2/sessions) is giving VALIDATION_ERROR

I am trying to create capturecontext using https://apitest.cybersource.com/flex/v2/sessions with below request payload

{ "fields" : { "paymentInformation" : { "card" : {
"number":"4111111111111111", "expirationMonth":"12", "expirationYear":"2031", "type":"001", "securityCode":"737" } } } }

and getting below response

"{"correlationId":"303ff124-e250-42fc-97ef-388369e3e2af","details":[{"location":"fields.paymentInformation.card","message":"Unknown field definition property"}],"message":"One or more validation errors occurred","reason":"VALIDATION_ERROR"}"

Blockquote

I am following exactly same pattern mentioned on Cybersource developer guide.Can somebody please help me to identify the issue here.



Solution 1:[1]

The error says what's wrong:

"location":"fields.paymentInformation.card"

"message":"Unknown field definition property"

If you check in https://developer.cybersource.com/docs/cybs/en-us/digital-accept-flex/developer/all/rest/digital-accept-flex/flex-api-2/flex-api-2-generate-capture-context.html, the request should be something like:

{
  "fields" : {
    "paymentInformation" : {
      "card" : {
        "number" : { },
        "securityCode" : {
          "required" : false
        },
        "expirationMonth" : {
          "required" : false
        },
        "expirationYear" : {
          "required" : false
        },
        "type" : {
          "required" : false
        }
      }
    }
  }
} 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aline