A simple client-side tokenization example integration using Flex JavaScript SDK to access the Flex API. For more details on this see our Developer Guide at: https://developer.cybersource.com/api/developer-guides/dita-flex/SAFlexibleToken/FlexAPI.html
- Modify
./src/main/webapp/credentials.properties
with the CyberSource REST credentials created through EBC Portal.
merchantId=YOUR MERCHANT ID
keyId=YOUR KEY ID (SHARED SECRET SERIAL NUMBER)
sharedSecret=YOUR SHARED SECRET
- Build and run the application using maven
mvn clean package
This will produce a .war
file that can be deployed to a Tomcat server instance. The deployed application will serve a demonstration card tokenization page on http://localhost:8080/
. To serve from a different domain, ensure that targetOrigin
domain is specified when making a call to the /keys
endpoint. For a detailed example please see FlexKeyProvider.java, line 47.
-
If you are having issues, checkout the full FLEX API documentation.
-
If the application throws
java.security.InvalidKeyException: Illegal key size
you have probably not installed the JCE unlimited policy files. -
Safari version 10 and below does not support
RsaOaep256
encryption schema, for those browser please specify encryption typeRsaOaep
when making a call to the/keys
endpoint. For a detailed example please see FlexKeyProvider.java, line 47.