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 in the request. The following sample response shows a credit card type Source in a chargeable state.
Only the last four digits of credit card numbers are returned by a GET
Source request.
Obtain a customer's sources
You can retrieve the Sources associated with a Customer by making a get Customer by identifier request and then parsing the sources
array contained in the response.
The following GET/customers/{id}
request supplies the identifier as a path parameter:
In the response, each element of the sources
array consists of a Source object attached to the Customer. In this particular response, the array contains two elements, which means the customer has two saved payment methods, both reusable and chargeable.
Display a customer's sources
The data contained in the sources
array can 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