Handling credit card sources

Learn how Source objects created from credit cards function within the Commerce API.
In the Commerce API, sources created from credit cards are multi-use, synchronous, and pull-based. This means that customers aren't required to re-enter payment details before every payment, they are provided instant notification of a payment's approval status, and the amount charged to the card can be updated repeatedly throughout the checkout process.
The Sources API supports a wide-range of credit cards.

Creating a credit card source

To ensure that you remain PCI compliant, credit card Source objects are created by DigitalRiver.js and then returned to your integration.
To create a credit card source, you must first include the DigitalRiver.js library on your payment collection form. You then create your payment form and embed elements on it. Once a customer has supplied payment details, you pass the data to DigitalRiver.js to create the payment source. We then return a source identifier to your integration.

Charging a credit card source

You can either attach the source to a customer for use in the current checkout and potentially reuse in future payments or attach it directly to a Cart. In the latter case, the source cannot be reused and will have a state of consumed once charged.
Credit card sources should be used shortly after they are created. This is because CVC data expires within a few minutes. Orders created with cards that lack CVC's are more likely to be declined and pose a greater fraud risk.
Once you have attached the source to a customer or directly to a cart, it can then be used by Digital River when you submit the Cart.