On This Page
Accept Check Information
This section covers the implementation steps needed to complete the server-side and
client-side setup for accepting check information with
Microform Integration
.sImplementing
Microform Integration
is a three-step process: The figure below shows the flow for implementing
Microform Integration
: Server-Side Setup
This section contains the information you need to set up your server. Initializing
Microform Integration
within your webpage begins with a server‑to‑server
call to the sessions API. This step authenticates your merchant credentials and
establishes how the Microform Integration
frontend components will function.
The sessions API request contains parameters that define how Microform Integration
performs.The server-side component provides this
information:
- A transaction-specific public key is used by the customer's browser to protect the transaction.
- An authenticated context description package that manages the payment experience on the client side. It includes available payment options such as card networks, payment interface styling, and payment methods.
The functions are compiled in a JSON Web Token (JWT)
object referred to as the
capture context
. For information JSON Web Tokens, see
JSON Web Tokens.Capture Context
The capture context request is a signed JSON Web Token
(JWT) that includes all of the merchant-specific parameters. This request tells the
frontend JavaScript library how to behave within your payment experience. The request
provides authentication, one‑time keys, the target origin to the
Microform Integration
integration in addition to allowed card networks and payment
types (card or check). The capture context request includes these elements:- allowedCardNetworks
- allowedPaymentTypes
- clientVersion
- targetOrigins
- Target Origin
- The target origin is defined by the scheme (protocol), hostname (domain) and port number (if used).You must use the https:// protocol. Sub‑domains must also be included in the target origin.Any valid top‑level domain is supported such as .com, .co.uk, and.gov.br. Wildcards are not supported.For example, if you are launchingUnified Checkouton example.com, the target origin could be any of the following:You can define the payment cards and digital payments that you want to accept in the capture context.
- Allowed Card Networks
- Use theallowedCardNetworksfield to define the card types.These card networks are available for card entry:
- American Express
- Cartes Bancaires
- Carnet
- China UnionPay
- Diners Club
- Discover
- EFTPOS
- ELO
- JCB
- JCrew
- Mada
- Maestro
- Mastercard
- Meeza
- Visa
When you integrate withMicroform Integrationto accept card or check information, you must include at least one card network in theallowedCardNetworksfield in the capture context request. - Allowed Payment Types
- You can specify the type ofMicroform Integrationyou want to accept in the capture context. You can accept card and check information.
- Use theallowedPaymentTypesfield to define the payment type:
- CARD
- CHECK
allowedPaymentTypesfield is optional. When this field is provided in the capture context, theMicroform Integrationdefaults the field toCARDand is returned in the response regardless.
Creating the Server-Side Capture Context
The first step in integrating with
Microform Integration
is to develop the
server-side code that generates the capture context. The capture context is also
known as a session. You can use the SDK or call the API directly to generate the capture context.
To use the SDK to generate the capture context, use the sample code here: Flex Samples on Github.
Follow these steps to call the API directly to generate the capture context:
- Send an authenticated POST request to the/sessionsendpoint to create your capture context session:
- Production:https://api.cybersource.com/microform/v2/sessions
- Test:https://apitest.cybersource.com/microform/v2/sessions
Include the target origin URL and at least one accepted card type in the content of the body of the request. You must also include the type ofMicroform Integrationyou want to include in the capture context for accepting check information. If you do not include theallowedPaymentTypesfield in your capture request, the value defaults toCARD.For example:{ "clientVersion": "v2", "targetOrigins": [ "https://www.example.com" ], "allowedCardNetworks": [ "VISA" ], "allowedPaymentTypes": [ "CHECK" ] }To embed within multiple nested iframes, you must specify the origins of all the browser contexts used. For example:{ "clientVersion": "v2", "targetOrigins": [ "https://www.example.com", "https://www.basket.example.com", "https://ecom.example.com" ], "allowedCardNetworks": [ "VISA", "MASTERCARD", "AMEX", "CARTESBANCAIRES", "CARNET", "CUP", "DINERSCLUB", "DISCOVER", "EFTPOS", "ELO", "JCB", "JCREW", "MADA", "MAESTRO", "MEEZA" ], "allowedPaymentTypes": [ "CHECK" ] } - Pass the capture context response data object to your front-end application. The capture context is valid for 15 minutes.Successful Encrypted JWT ResponseeyJraWQiOiJqNCIsImFsZyI6IlJTMjU2In0.eyJmbHgiOnsicGF0aCI6Ii9mbGV4L3YyL3Rva2VucyIsImRhdGEiOiJtdnkwVk9OVk40bzA4bTRGQjhmU3FCQUFFS0JWOTdlNnR2VDd4cHdqaFkwMDRydFJ1dGI0R2YwWlNwNGdNeEkvanBVSWxFblZKa2JtUVNHaWFnUEdGc0NPazdMbHJGTHFKcXN2eitoTHhrY08xRkFcdTAwM2QiLCJvcmlnaW4iOiJodHRwczovL3N0YWdlZmxleC5jeWJlcnNvdXJjZS5jb20iLCJqd2siOnsia3R5IjoiUlNBIiwiZSI6IkFRQUIiLCJ1c2UiO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zQ4OTI4MSwianRpIjoiSXdEdHAxZkVZM2QwYUh6OSJ9.arokacvdTSUIehBY0ICi-QYynhFj7_0k-G39qbkNJydB3UyF2qJSaqwZiopO27kuqk8u9Z0cY-V9Nu04JgaV4s18doxnzx6vdTCC3krrIcxeINi23Qu-Szcpg7aaGvPVXMC0DVC14WUQiGJkOakJ54jWtl2VoFAgYziUMcYYpk4hxLVxurBtT7lvrfCXKoyWtxiUxoEpOc_Td_qi5nA8ByWUaieQmp1Zej61khQJ_hmXtlsAt4BqxeJWoJeR_5Sjz0vD5y4-oAeNNrAulDem7CKiRJQbI9fyqT-
AFTER COMPLETING THE TASK
Important Security Note:
- Ensure that all endpoints within your ownership are secure with some kind of authentication so they cannot be called at will by bad actors.
- Do not pass thetargetOriginin any external requests. Hard code it on the server side.
For more information on requesting the capture context, see Capture Context.
Validating the Server-Side Capture Context
The capture context that you generated is a JSON Web Token (JWT) data object. The
JWT is digitally signed using a public key. The purpose is to ensure the validity of the
JWT and confirm that it comes from
Cybersource
. When you do not have a
key specified locally in the JWT header, you should follow best cryptography practices
and validate the capture context signature. To validate a JWT, you can obtain its public key. This public RSA key is in JSON Web Key
(JWK) format. This public key is associated with the capture context on the
Cybersource
domain. To get the public key of a capture context from the header of the capture context itself,
retrieve the key ID associated with the public key. Then, pass the key ID to the
public-keys
endpoint.Example
From the header of the capture context, get the key ID (
kid
) as shown in
this example:{"kid": "3g", "alg": "RS256" }
Append the key ID to the endpoint
/flex/v2/public-keys/
. Then,
call this endpoint to get the public key. 3g
IMPORTANT
When validating the public key, some cryptographic methods
require you to convert the public key to PEM format.
Resource
Pass the key ID (kid), that you obtained from the capture context header, as a path
parameter, and send a GET request to the
/public-keys
endpoint:- Test:https://apitest.cybersource.com/flex/v2/public-keys/{kid}
- Production:https://api.cybersource.com/flex/v2/public-keys/{kid}
The resource returns the public key. Use this public RSA key to validate the capture
context.
Example
eyJraWQiOiJqNCIsImFsZyI6IlJTMjU2In0.eyJmbHgiOnsicGF0aC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vdjIuNS4xL2ZsZXgtbWljcm9mb3JtLm1pbi5qcyIsInRhcmdldE9yaWdpbnMiOlsiaHR0cHM6Ly90aGUtdXAtZGVtby5hcHBzcG90LmNvbSJdLCJtZk9yaWdpbiI6Imh0dHBzOi8vc3RhZ2VmbGV4LmN5YmVyc291cmNlLmNvbSIsImFsbG93ZWRQYXltZW50VHlwZXMiOlsiQ0hFQ0siXX0sInR5cGUiOiJtZi0yLjEuMCJ9XSwiaXNzIjoiRmxleCBBUEkiLCJleHAiOjE3MzM0OTAxODEsImlhdCI6MTczMzQ4OTI4MSwianRpIjoiSXdEdHAxZkVZM2QwYUh6OSJ9.arokacvdTSUIehBY0ICi-QYynhFj7_0k-G39qbkNJydB3UyF2qJSaqwZiopO27kuqk8u9Z0cY-V9Nu04JgaV4s18doxnzx6vdTCC3krrIcxeINi23Qu-Szcpg7aaGvPVXMC0DVC14WUQiGJkOakJ54jWtl2VoFAgYziUMcYYpk4hxLVxurBtT7lvrfCXKoyWtxiUxoEpOc_Td_qi5nA8ByWUaieQmp1Zej61khQJ_hmXtlsAt4BqxeJWoJeR_5Sjz0vD5y4-oAeNNrAulDem7CKiRJQbI9fyqT-
Base64 decode the capture context to get the key ID (
kid
) from its
header: {"kid": "3g", "alg": "RS256" }
Get its public key from
/flex/v2/public-keys/3g
:{ "kty":"RSA", "use":"enc", "kid":"3g", "n":"ir7Nl1Bj8G9rxr3co5v_JLkP3o9UxXZRX1LIZFZeckguEf7Gdt5kGFFfTsymKBesm3Pe 8o1hwfkq7KmJZEZSuDbiJSZvFBZycK2pEeBjycahw9CqOweM7aKG2F_bhwVHrY4YdKsp _cSJe_ZMXFUqYmjk7D0p7clX6CmR1QgMl41Ajb7NHI23uOWL7PyfJQwP1X8HdunE6ZwK DNcavqxOW5VuW6nfsGvtygKQxjeHrI-gpyMXF0e_PeVpUIG0KVjmb5-em_Vd2SbyPNme nADGJGCmECYMgL5hEvnTuyAybwgVwuM9amyfFqIbRcrAIzclT4jQBeZFwkzZfQF7MgA6QQ", "e":"AQAB" }
Client-Side Setup
You can integrate
Microform Integration
with your native payment
acceptance web page or mobile application. Web Page
Initiate and embed
Microform Integration
into your payment
acceptance web page.- Decode the JWT from the/microform/v2/sessionsresponse to get the capture context.
- Use theclientLibraryandclientLibraryIntegrityvalues that are returned in the JWT from/microform/v2/sessionsresponse to obtain theMicroform IntegrationJavaScript library URL and integrity value that you use to create your script tags.IMPORTANTYou must do this for every transaction as these values can be unique for each transaction. Do not hard code these values, as this can result in client-sideMicroform Integrationerrors. If you do not do this for every transaction, you may load a JavaScript library that is incompatible with the version you requested in the/sessionsrequest.Example/sessionsResponse:"data":{ "clientLibrary":"[EXTRACT clientLibrary VALUE from here]", "clientLibraryIntegrity": "[EXTRACT clientLibraryIntegrity VALUE from here]" }Example Script Tags<script src="[INSERT clientLibrary VALUE HERE]" integrity=”[INSERT clientLibraryIntegrity VALUE HERE]” crossorigin=”anonymous”> </script>Example Code for loading the script dynamically following JWT extraction Tagsconst head = document.getElementsByTagName('head')[0]; const script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.onload = function() { // Invoke the Flex SDK once the scripts are loaded asynchronously flexSetup(); } //url extracted from the JWT script.src = url; //integrity extracted from the JWT if (clientLibraryIntegrity) { script.integrity = clientLibraryIntegrity; script.crossOrigin = "anonymous"; } head.appendChild(script);
- Create the HTML placeholder objects to attach to the microforms.Microform Integrationattaches the microform fields to containers within your HTML. Within your HTML checkout, replace the payment card and CVN tag with a simple container.Microform Integrationuses the container to render an iframe for secured credit card input. The following example contains simpledivtags to define where to place the PAN and CVN fields within the payment acceptance page:<div id="number-container" class="form-control"></div>.Example: Accept Check Information Checkout Form<h1>Checkout</h1> <div id="errors-output" role="alert"></div> <form action="/token" id="my-sample-form" method="post"> <div class="form-group"> <label id="routingNumber-label">Routing Number</label> <div id="routingNumber-container" class="form-control"></div> <label for="accountNumber-label">Account Number</label> <div id="accountNumber-container" class="form-control"></div> <label for="accountNumberConfirm-label">Account Number Confirm</label> <div id="accountNumberConfirm-container" class="form-control"></div> </div> <div class="form-row"> <div class="form-group col-md-6"> <label for="accountType">Account Type</label> <select id="accountType" name="accountType" class="form-control"> <option value="C">Checking</option> <option value="S">Savings</option> <option value="X">Corporate checking</option> </select> </div> </div> <button type="button" id="pay-button" class="btn btn-primary">Pay</button> <input type="hidden" id="flexresponse" name="flexresponse"> </form>
- Invoke the Flex SDK by passing the capture context that was generated in the previous step to the microform object.const flex = new Flex(captureContext);
- Initiate the microform object with styling to match your web page.After you create a new Flex object, you can begin creating your Microform. You will pass your baseline styles and ensure that the button matches your merchant page:const microform = flex.microform("card", { styles: myStyles });
- Create and attach the microform fields to the HTML objects through the Microform Integration JavaScript library.const number = microform.createField('number', { placeholder: 'Enter card number' }); const securityCode = microform.createField('securityCode', { placeholder: '•••' }); number.load('#number-container'); securityCode.load('#securityCode-container');
- Create a function for the customer to submit their payment information, and invoke the tokenization request toMicroform Integrationfor the transient token.
Mobile Application
To initiate and embed
Microform Integration
into native payment
acceptance mobile application, follow the steps for web page setup, and ensure that
these additional requirements are met:- The card information acceptance fields of PAN and CVV must be hosted on a web page.
- The check information acceptance fields of routing number, account number, and confirmed account number must be hosted on a web page.
- The native application must load the hosted card entry form web page in a web view.
AFTER COMPLETING THE TASK
As an alternative, you can use the Mobile SDKs hosted on GitHub:
- Android sample: https://github.com/CyberSource/flex-v2-android-sample
Transient Tokens for Accepting Check Information
The response to a successful customer interaction with
Microform Integration
is a transient token. The transient token is a reference to the payment data that is
collected on your behalf. Tokens allow secure card or check payments to occur without
risk of exposure to sensitive payment information. The transient token is a short-term
token that expires after 15 minutes. This reduces your PCI burden/responsibility and
ensures that sensitive information is not exposed to your back-end systems. Transient Token Time Limit
The sensitive data associated with the transient token is available for use only for 15
minutes or until one successful authorization occurs. Before the transient token
expires, its data is still usable in other non-authorization services. After 15 minutes,
you must prompt the customer to restart the checkout flow.
Example: Creating the Pay Button with Event Listener for Accepting Check
Information
payButton.('click', function () { // Compiling account type into optional parameters var options = { accountType: document.querySelector('#accountType').value, }; // microform.createToken(options, function (err, token) { if (err) { // handle error console.error(err); errorsOutput.textContent = err.message; } else { // At this point you may pass the token back to your server as you wish. // In this example we append a hidden input to the form and submit it. console.log(JSON.stringify(token)); flexResponse.value = JSON.stringify(token); form.submit(); } }); });
When the customer submits the form,
Microform Integration
securely collects
and tokenizes the data in the loaded fields as well as the options supplied to the
createToken()
function. The month and year are included in the
request. If tokenization succeeds, your callback receives the token as its second
parameter. Send the token to your server, and use it in place of the PAN when you use
supported payment services.Example: Customer-Submitted Form for Accepting Check
Information
<script> // Variables from the HTML form const form = document.querySelector('#my-sample-form'); const payButton = document.querySelector('#pay-button'); const flexResponse = document.querySelector('#flexresponse'); const accountType = document.querySelector('#accountType') const errorsOutput = document.querySelector('#errors-output'); // the capture context that was requested server-side for this transaction const captureContext = <% -keyInfo %> ; // custom styles that will be applied to each field we create using Microform const myStyles = { 'input': { 'font-size': '14px', 'font-family': 'helvetica, tahoma, calibri, sans-serif', 'color': '#555' }, ':focus': { 'color': 'blue' }, ':disabled': { 'cursor': 'not-allowed' }, 'valid': { 'color': '#3c763d' }, 'invalid': { 'color': '#a94442' } }; // setup Microform const flex = new Flex(captureContext); const microform = flex.microform("check", { styles: myStyles }); const routingNumber = microform.createField("routingNumber", { placeholder: "Enter routing number" }); const accountNumber = microform.createField("accountNumber", { placeholder: "Enter account number" }); const accountNumberConfirm = microform.createField("accountNumberConfirm", { placeholder: "accountNumberConfirm" }); routingNumber.load('#routingNumber-container') accountNumber.load('#accountNumber-container') accountNumberConfirm.load('#accountNumberConfirm-container') // Configuring a Listener for the Pay button payButton.addEventListener('click', function () { // Compiling MM & YY into optional paramiters const options = { accountType: document.querySelector('#accountType').value, }; // microform.createToken(options, function (err, token) { if (err) { // handle error console.error(err); errorsOutput.textContent = err.message; } else { // At this point you may pass the token back to your server as you wish. // In this example we append a hidden input to the form and submit it. console.log(JSON.stringify(token)); flexResponse.value = JSON.stringify(token); form.submit(); } }); }); </script>
Transient Token Response Format
The transient token is issued as a JSON Web Token (RFC
7519). A JWT is a string consisting of three parts that are separated by
dots:
- Header
- Payload
- Signature
JWT example:
xxxxx.yyyyy.zzzzz
The payload portion of the token is an encoded Base64url JSON string and contains various
claims.
IMPORTANT
When you integrate with Cybersource APIs, Cybersource recommends that
you dynamically parse the response for the fields that you are looking for. Additional
fields may be added in the future.
You must ensure that your integration can handle
new fields that are returned in the response. While the underlying data structures
will not change, you must also ensure that your integration can handle changes to
the order in which the data is returned.
The internal data structure of the
JWT can expand to contain additional data elements. Ensure that your integration and
validation rules do not limit the data elements contained in responses.
Example: Token Payload for Accepting Check Information
{ "iss" : "Flex/00", "exp" : 1732527524, "type" : "mf-2.1.0", "iat" : 1732526624, "jti" : "1D3HRVI3KM4HFWQAZ2JFI993NEVBAH5NYJFIH82RAMYWDUJ444KT674445A4EAC0", "content" : { "paymentInformation" : { "bank" : { "routingNumber" : { }, "account" : { "number" : { }, "type" : { } } }, "paymentType" : { "name" : { "value" : "CHECK" } } } } }
Validating the Transient Token
After receiving the transient token, validate its integrity using the public key embedded
within the capture context created at the beginning of this flow. This verifies that
Cybersource
issued the token and that no data tampering occurred
during transit. Example: Capture Context Public Key
"jwk": { "kty": "RSA", "e": "AQAB", "use": "enc", "n": "3DhDtIHLxsbsSygEAG1hcFqnw64khTIZ6w9W9mZNl83gIyj1FVk-H5GDMa85e8RZFxUwgU_zQ0kHLtONo8SB52Z0hsJVE9wqHNIRoloiNPGPQYVXQZw2S1BSPxBtCEjA5x_-bcG6aeJdsz_cAE7OrIYkJa5Fphg9_pxgYRod6JCFjgdHj0iDSQxtBsmtxagAGHjDhW7UoiIig71SN-f-gggaCpITem4zlb5kkRVvmKMUANe4B36v4XSSSpwdP_H5kv4JDz_cVlp_Vy8T3AfAbCtROyRyH9iH1Z-4Yy6T5hb-9y3IPD8vlc8E3JQ4qt6U46EeiKPH4KtcdokMPjqiuQ", "kid": "00UaBe20jy9VkwZUQPZwNNoKFPJA4Qhc" }
Use the capture context public key to cryptographically validate the JWT provided from a
successful
microform.createToken
call. You might have to convert
the JSON Web Key (JWK) to privacy-enhanced mail (PEM) format for compatibility with some
JWT validation software libraries.The
Cybersource
SDK has functions that verify the token response. You
must verify the response to ensure that no tampering occurs as it passes through the
cardholder device. Do so by using the public key generated at the start of the
process.Example: Validating the Transient
Token
console.log('Response TransientToken: ' + req.body.transientToken); console.log('Response CaptureContext: ' + req.body.captureContext); // Validating Token JWT Against Signature in Capture Context const capturecontext = req.body.captureContext; const transientToken = req.body.transientToken; // Extracting JWK in Body of Capture Context const ccBody = capturecontext.split('.')[1]; console.log('Body: ' + ccBody); const atob = require('atob'); const ccDecodedValue = JSON.parse( atob(ccBody)); const jwk = ccDecodedValue.flx.jwk;