Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 3.5 KB

File metadata and controls

60 lines (43 loc) · 3.5 KB

CyberSource Flex Samples (NodeJS)

This repository provides simple examples demonstrating usage of the Unified checkout and the drop-in UI flows. For more details visit our Developer Guide at

  1. Unified Checkout: https://developer.cybersource.com/docs/cybs/en-us/unified-checkout/developer/all/rest/unified-checkout/uc-intro.html
  2. Drop-in UI: https://developer.cybersource.com/docs/cybs/en-us/click-to-pay/developer/all/rest/click-to-pay.html

Usage

  1. Clone or download this repository.
  2. cd into unified-checkout-node directory
  3. Generate a certificate and private key locally using the command
       openssl req -x509 -newkey rsa:2048 -nodes -keyout server.key -out server.cert -days 365
  4. Place these files in the bin directory
  5. Update json/js configuration files in the Data folder with your CyberSource sandbox credentials.
  6. [ Optional ] Fetch a network tokenization private key from EBC2 for your merchant account and put the path in unified-checkout-node\Data\Configuration.js in the property PemFileDirectory.
  7. Run npm install in the sample
  8. Run npm start.
  9. Browse to https://localhost:3000 in your browser

Requirements

  • Node
  • Express
  • NPM

Using the Application

❗️ This application uses Cybersource's test environment, and should be used with mock data.

All information is secured to our production standards, but please use a test card number such as 4111 1111 1111 1111 and false name / address information on the /checkout page (where information is entered into Unified Checkout's UI) to limit usage of any unnecessary personal information.

Unified Checkout requires an HTTPS URL, so navigate to https://localhost:3000 and proceed through the various screens to understand how things work under the hood. Note that you may receive a warning about the certificate's validity, and can simply proceed.

Otherwise you can add the ucDemoKeystore.p12 in ./unified-checkout-node/Resources using Keychain Access (Mac) or MMC (Windows).

To serve from a different domain, or change other request attributes, see default capture context request.

The targetOrigins field in this request controls where your checkout page is served.

Test Cards

  • 4111 1111 1111 1111 - Visa test card, frictionless 3DS

Additional Steps for Click to Pay Drop-in UI users

  1. Follow the steps outlined in the Click to Pay Drop-in UI developer guide to create a portfolio-level merchant with the proper configurations, upload a public encryption key, and create a transacting merchant as a child of this portfolio.
  2. Uncomment the following properties in application.properties in addition to the merchant properties specified in Setup Instructions.
    	porfolioId=YOUR PORTFOLIO ID
    	portfolioKeyId=YOUR PORTFOLIO KEY ID
    	portfolioSecretKey=YOUR PORTFOLIO SECRET KEY
  3. Upload your portfolio merchant's private key to a file called private_key.pem in the keystore folder. The key should match the specs outlined in the developer guide.