Retrieving sources
Learn how to retrieve a single source as well as all the Source objects attached to a customer.
Get a source object by identifier
The following GET/sources/{id}
request retrieves a source by supplying its unique identifier as a path parameter.
This identifier was returned when you used the DigitalRiver.js library to create the source.
The response returns a Source object if a valid identifier and API key are provided. This sample response returns a Source with a type
of creditCard
and a state of chargeable
.
Only the last four digits of credit card numbers are returned by a GET
Source request.
Obtain a shopper's sources
You can retrieve the Sources associated with a Shopper by making a get shopper by ID request and parsing the sources
array contained in the response if the payment source is attached to the shopper's payment option. All payment sources will be listed when the shopper gets their payment options.
Step 1: Create your first payment source and option
Create your first payment source using the following:
POST https://api.digitalriver.com/payments/sources/
Create your first payment option using the following:
POST https://api.digitalriver.cm/v1/shoppers/me/payment-options/
Step 2: Create your second payment source and option
Create your second payment source using the following:
POST https://api.digitalriver.com/payments/sources/
Create your second payment option using the following:
POST https://api.digitalriver.com/v1/shoppers/me/payment-options/
Step 3: Get the shopper's payment options
Get the shopper's payment options using: GET https://api.digitalriver.com/v1/shoppers/me/payment-options/
Display a customer's sources
You can use the data contained in the sources
array to display a customer's saved payment methods on your website or app. To do this, parse the response and extract the values in the creditCard
, owner
, and address
hash tables. You can then use these values to present the card's brand name, last four digits, expiration date, and the customer's billing information.
Last updated