Establishing a Payment Session with a Capture Context
To establish a payment session, include the API fields you plan to use in that session
in the body of the request. The system then returns a JSON Web Token (JWT) that includes
the capture context.
To determine which fields to include in your capture context, identify the personal information
that you wish to isolate from the payment session.
Capture Context Fields
When making a session request, any fields that you request to be added to the capture context
are required by default. However, you can choose to make a field optional by setting
the
required
parameter to false
.For example, the following code snippet includes both required and optional fields:
"fields" : { "paymentInformation" : { "card" : { "number" : { }, "securityCode" : { "required" : true }, "expirationMonth" : { "number" : { "required" : false }, "expirationYear" : { "required" : false } } } } }
In this example, the
paymentInformation.card.number
and
paymentInformation.card.securityCode
fields are required and
the paymentInformation.card.expirationMonth
and
paymentInformation.card.expirationYear
fields are optional.
The inclusion of the paymentInformation.card.number
field in the
request sets it as a required field and, therefore, you do not need to include the
paymentInformation.card.number.required
field.Endpoint
Production:
GET
https://api.cybersource.com
/flex/v2/sessionsTest:
GET
https://apitest.cybersource.com
/flex/v2/sessionsREST Example: Establishing a Payment Session with a Capture Context
Request
{ "fields" : { "paymentInformation" : { "card" : { "number" : { }, "securityCode" : { "required" : false }, "expirationMonth" : { "required" : false }, "expirationYear" : { "required" : false }, "type" : { "required" : false } } } } }
Response
JWT is returned.