Step 2: Create a Credit Card source using DigitalRiver.js
Create the elements
Use the DigitalRiver.js library to create and mount elements to the HTML container.
var options = { style: { base: { color:"#fff", fontFamily:"Arial, Helvetica, sans-serif", fontSize:"16px", } }}//Create your elementsvar cardNumber =digitalriver.createElement('cardnumber', options);var cardExpiration =digitalriver.createElement("cardexpiration", options);var cardCVV =digitalriver.createElement("cardcvv", options);//Place the created elements on the page.cardNumber.mount('card-number');cardExpiration.mount('card-expiration');cardCVV.mount('card-cvv');
Create the source
To create a credit card payment source, you must reference the created element and the supplemental data in your createSource request. DigitalRiver.js will retrieve and assemble the request on your behalf.
The address object must contain postal code and state/province data thatadheres to a standardized format using the state attribute. Note that the state attribute listed below corresponds to the countrySubdivision attribute used when providing address information. The payment session manages the correct field name on the backend.