Managing payment sessions
Learn the basics of payment sessions and how to migrate your integration.
Last updated
Was this helpful?
Learn the basics of payment sessions and how to migrate your integration.
Last updated
Was this helpful?
A payment session tracks a customer's payment throughout the checkout process. Although you're not required to, we highly to reduce the complexity of building DigitalRiver.js payment collection flows and to comply with regulations.
is relatively straightforward and mostly involves for each of your approved payment methods.
Payment sessions allow you to comply with regulations. Digital River automatically collects the required authentication data from the customer's PSD2 transactions when using payment sessions to .
Payment sessions also simplify source creation by reducing the data you're required to provide. If you don't use payment sessions, you'll need to copy numerous data points returned in the cart and ensure it is properly formatted before passing them to the .
However, when , you can provide the session's unique identifier, thereby minimizing the data you must transfer.
Payment sessions also allow you to , which lessens your front-end development burden. For each transaction, applicable to the transaction and display them as options to customers.
When specify the sessionId
in the payload that you pass to the DigitalRiver.js . The data our payment services need to create the source is then retrieved from that session.
We highly recommend using payment sessions when creating a payment source in a cart flow to reduce the complexity of building the payment collection flows and to comply with regulations.
The following are the payment session states most important when building your integration:
The cart's payment.session.state
must be requires_confirmation
before you convert that cart to an order.
A cart's payment.session.state
can be requires_source
for either of the following reasons:
The payment session state
typically transitions to complete
once the order is created.
By comparing values in the cart's payment.session
, you can determine how much additional funding, if any, is still required. The amountContributed
represents the aggregated amount of all the cart's payment.sources[]
. The amountRemainingToBeContributed
is how much is needed to fully fund the transaction.
A cart's payment.session
can be used to determine when to create an order. Specifically, we provide you information on the , the .
This state
indicates that the cart's payment sources[] are sufficient to fund the transaction. For example, when you a to a checkout, the drops to zero, and the session's state
transitions to requires_confirmation
.
No or have yet been applied.
No primary payment source is applied, and there are not enough , such as , to fully fund the transaction.
In both of these scenarios, we won't be able to generate a charge amount large enough to cover the checkout's totalAmount
. So, the remains greater than zero, and any attempt to create an order is blocked.
Once a is attached to a cart, we use it to fully fund the transaction.
But when only are attached, you need to confirm sufficient funds exist to cover the totalAmount
. If this isn't the case, when you convert the cart to an order, you receive the following error:
If the amountContributed
is equal to the cart's totalAmount
or the amountRemainingToBeContributed
is zero, then you don't need to request any more payment methods from the customer. This means that once the , and all are met, you can convert the cart to an order.
But if the amountContributed
is less than the cart's totalAmount
or the amountRemainingToBeContributed
is greater than zero, the customer needs to supply additional payment methods before an order can be successfully created. However, this will only be the case when a is not yet attached to the checkout. Once that's done, we use it to fully fund the transaction and amountRemainingToBeContributed
drops to zero.
You can or . See for more information.
In DigitalRiver.js, you can use the payment session identifier to and present them to the customer during checkout.
The method also returns the data required to use one-click payment methods like Apple Pay and Google Pay and the data needed to retrieve compliance information via the DigitalRiver.js .
Although we generally recommend using to handle payments, you can also migrate your existing integration directly to payment sessions. For the Commerce API, .
Once you have completed this migration process, you must using or .