Menu

Invoking the Checkout API

Once you have the transient token provided, the next step is to pass it to the Checkout API.
Make the request to the Checkout API from the customer's browser, using a standard form post (
application/x-www-form-urlencoded
) request.
If you are using the Checkout API inside an iframe, to avoid issues with third-party cookies not being supported, ensure that you use an iframe endpoint.

New Checkout API Request Fields

capture_context
The same capture context used with
Microform Integration
0.11.
This field is not supported with Hosted Checkout.
Capture contexts are valid for 15 minutes only. The Checkout API will not accept expired capture contexts.
Format: String
Required if you want to supply a transient token.
transient_token
The transient token JWT provided by
Microform Integration
0.11. If you pass this field, you must also pass the corresponding capture context (
capture
_context) must also be supplied.
You do not need to validate the transient token signature. The Checkout API will do this for you.

Example

The following example shows a request that calls the Secure Acceptance Checkout API and creates a token.
<form id="sa-form" action="https://secureacceptance.cybersource.com/silent/pay" method="post"> <input type="hidden" id="capture_context" name="capture_context" value="eyJraWQiOi...HHWuACdnLQ" /> <input type="hidden" id="transient_token" name="transient_token" value="" /> <-- Optional unsigned fields --> <input type="text" name="bill_to_forename value="" /> <input type="text" name="bill_to_surname value="" /> <input type="text" name="bill_to_phone value="" /> <input type="text" name="bill_to_email value="" /> <input type="text" name="bill_to_address_line1 value="" /> <input type="text" name="bill_to_address_line2 value="" /> <input type="text" name="bill_to_address_city value="" /> <input type="text" name="bill_to_address_state value="" /> <input type="text" name="bill_to_address_postal_code value="" /> <input type="text" name="bill_to_address_country" value="" /> </form> <script type="text/javascript"> var captureContext = document.getElementById('capture_context').value; var flex = new Flex(captureContext); // Initialize Flex Microform ... payButton.addEventListener('click', function() { // Compiling MM & YY into optional parameters var options = { expirationMonth: document.querySelector('#expMonth').value, expirationYear: document.querySelector('#expYear').value }; microform.createToken(options, function(err, token) { if (err) { // handle error console.error(err); errorsOutput.textContent = err.message; } else { document.getElementById('transient_token').value = token; // No need to verify JWS document.getElementById('sa-form').submit(); } }); }); </script>
Back to top