Source basics
Learn the basics of sources.
A source is associated with the payment method that a customer uses to fund a transaction. When generating a charge, Digital River retrieves data from the source.
In the Digital River APIs, each type of source has certain characteristics that determine how it's created and how a charge is eventually processed.
A source also contains a hash table that corresponds to its
type
. This data object holds detailed information specific to each type
. For example, a source with a type
of credit card
has a creditCard
hash table that lists the card's brand
, expirationMonth
, expirationYear
, and lastFourDigits
.Source
{
...
"type": "creditCard",
...
"creditCard": {
"brand": "MasterCard",
"expirationMonth": 5,
"expirationYear": 2025,
"lastFourDigits": "0008"
},
...
}
A source's characteristics revolve around the concepts of pull or push, synchronous or asynchronous, reusable or single-use, primary or secondary, and payment flow.
The difference between a pull and push payment source has to do with how a customer's funds are transferred.
With pull sources, customers provide their information and consent, and then the money is drawn from their account. No additional customer actions are usually necessary. Credit cards are the most common example.
When using a push payment source, the customer must explicitly send the funds before a charge can become capturable. These payment sources almost always require additional customer action. For example, if you enable wire transfers on your website or app, you'll need to present your customers with the necessary transfer information to complete payment and they must then "push" the funds.
With asynchronous payment methods, the source may first return in
state
of pending_funds
, pending_redirect
, or requires_action
before it transitions to chargeable
. For example, a source with a type
of payPal
is asynchronous because the customer is redirected to the PayPal site and must take additional action to authorize the transaction.When integrating asynchronous payment methods, you can create a webhook to listen for the
source.chargeable
event. This will allow you to determine when you should attach the source to a checkout or save the source to a customer's account.Some payment methods can be used to create sources that are reusable, meaning they support recurring charge authorizations. In customer initiated transactions, this allows you to present stored sources to customers for convenience purposes. You can also use reusable sources in subscription renewals that are merchant initiated.
For a list of payment methods that support recurring payments, refer to the Supported payment methods page. Additionally, as part of the enablement process, certain payment methods that are typically reusable can be restricted to single-use only.
Sources must have a
reusable
value of true
before they can be used to make multiple charges. Reusable sources however can't be created using a public API key. As a result, both Drop-in payments and DigitalRiver.js with elements only generate single-use sources. To make them reusable once they're created (assuming the source's type
supports re-usability), you must save the source to a customer. This flips reusable
to true
and prevents the source's state
from becoming consumed
once it's associated with the checkout.If a source's underlying payment method doesn't support re-usability, we block the source from being saved to a customer. As a result, with non-reusable sources, you should only attach the source to a checkout. This will generate a one-time charge authorization when you convert the checkout to an order.
A source's
flow
represents how your customers experience the payment process and what authentications they must complete. The enumerated flow
values are standard
, redirect
, and receiver
.standard
: In this flow, which mainly applies to credit cards, you obtain a customer's payment details on your storefront and submit this information to Digital River. The customer is never required to leave your website during the checkout process. No additional action is required by customers after they submit their information and a charge can be created immediatelyredirect
: In this flow, you obtain a customer's payment data on your storefront. You then redirect them to the payment provider where they are asked to authorize the transaction. Once the authorization is confirmed, a charge can be created. We recommend you adhere to these guidelines when using redirect payment methods.receiver
: This flow requires that customers push funds to an account before a charge can be created. Wire transfer is a common payment method that uses this authentication flow.
A source's
state
provides information about what can be done with the object. The state
of a source may be cancelled
, chargeable
, consumed
, failed
, requires_action
, pending_funds
, or pending_redirect
.Digital River only creates a charge object when the source is
chargeable
. To be notified of when the source transitions to this state
, you can listen for source.chargeable
events.Once charged, the
state
of single-use sources switches to consumed
and no additional charges can be created from that source. Reusable sources however can persist in a state
that is chargeable
.For sources with a
flow
of receiver
, such as wire transfers, it may take days before the funds are confirmed by the receiving bank or financial institution, thereby switching the source's state
from pending_funds
to chargeable
.For different success and error scenarios, you can create tests to determine whether your integration returns the expected
state
.Once all captures are complete, the customer's payment method is charged the
amount
value contained within the source, taking into account any cancellations you create or refunds you issue.Each time that Digital River returns an updated source, the value of
amount
can change. For example, if customers add or subtract items from their carts late in the checkout process, and you then update the checkout, the source is returned with an updated amount
.Last modified 6mo ago