Building payment workflows

Learn how to create SCA-compliant workflows using Drop-in Payments and DigitalRiver.js with elements.

You can create Strong Customer Authentication (SCA) compliant workflows for both purchase transactions and account management.

When building workflows that use Drop-in Payments, you'll first need to perform some common, initial steps before proceeding to the workflow's specific steps.‌ For workflows using DigitalRiver.js with elements, you must also complete some prerequisites.

Each purchase and account management workflow has some key settings and methods.

Whether you are using Drop-in Payments or DigitalRiver.js with elements, any SCA requirements are automatically managed by Digital River. Two-factor authentication is handled by our authenticate source method. And our card acquirers use the 3-D Secure protocol to communicate with issuing banks. This protocol operates "behind the scene" and requires no developer interaction.

Limitations and constraints

Note the following limitations and constraints when building your payments workflow.

  • Do not change the currency when there is a secondary source in the cart. Specify the correct currency when creating a secondary payment source. After you apply the secondary source to the cart, do not change the currency. If you change the currency when calling /v1/shoppers, a 409 Conflict response contains specific information about what triggered the failure. In this instance, one of the currencies in the cart is not supported.

Error
{
    "errors": {
        "error": [
            {
                "relation": "https://developers.digitalriver.com/v1/shoppers/ShoppersResource",
                "code": "invalid-request",
                "description": "One or more sources in the cart does not support locale {Locale} and currency {Currency}."
            }
        ]
    }

}
  • Currently, you can't use the store credit to buy subscription products, pre-order products, or products on backorder. Additionally, you can't link more than one store credit source to an order, as multiple secondary sources are not currently supported.

Common Drop-in Payment steps

You must perform the following steps for any workflow that uses Drop-in Payments, whether built for purchases or account management.‌

Once you've completed these initial steps, you can perform those specific to your desired purchase or account management scenario.

Elements prerequisites

You need to use payment sessions when using DigitalRiver.js with elements to build workflows. So ensure you've completed the necessary migration. We assume you are familiar with creating and styling elements and capturing payment details.

Once you've completed these prerequisites, you can perform the steps specific to your desired purchase or account management scenario.

Purchase Flows

For almost all one-off, subscription, and mail-order/telephone-order (MOTO) transactions, Digital River supports SCA-compliant workflows using Drop-in Payments or DigitalRiver.js elements.‌

One-off

‌You can develop workflows that allow customers to enter, save, and retrieve their payment information while making one-off purchases.

Customers enter their credit card information

‌In this flow, customers supply their credit card information during a one-off transaction but don't save it to their accounts.

SCA required?Drop-in Payments supported?Elements supported?

Yes

Yes

Yes

Prerequisites: Perform the common Drop-in Payments steps.

Step one: Create a cart with all tax, shipping, duty, and fee amounts in a final state and a chargeType that is customer_initiated.

Step two: Retrieve the cart's payment session identifier, and use it to set the sessionId in the Drop-in Payments' configuration object. In options, set flow to checkout and usage to convenience, and (to prompt Drop-in payments to display the save payment option) showSavePaymentAgreement to true.

let configuration = {
    sessionId: "d3941a36-6821-4d93-be23-6190226ae5f7",
    options: {
        flow: "checkout",
        usage: "convenience"
    }
    ...
}

Step three: Use the configuration object to instantiate Drop-in Payments.

let dropin = digitalriver.createDropin(configuration);

Step four: Specify a container to place Drop-in Payments on your cart page.

Drop-in Payments renders in the specified container.

Customers enter their credit card information and click the configurable Pay Now button.

If the customer completes the SCA, then the onSuccess method is called, and Digital River returns a unique source in a chargeable state.

...
onSuccess: function (data) { doSometingWithTheSource(data) },
...

Step five: Attach the source to the cart.

Step six: Create the order by submitting the cart.

Customers save their credit card information

In this flow, customers enter credit card information and save it to their account during a one-off transaction.

SCA required?Drop-in Payments supported?Elements supported?

Yes

Yes

Yes

the the Prerequisites: Perform the common Drop-in Payments steps.

Step one: Create a cart with all tax, shipping, duty, and fee amounts in a final state. Set chargeType to customer_initiated and autoRenewal to true.

Step two: Retrieve the cart's payment session identifier, and use it to set the sessionId in the Drop-in Payments configuration object. In the configuration options, set flow to checkout and usage to convenience. To prompt Drop-in payments to display the save payment option, set showSavePaymentAgreement to true.

You should also configure the usage parameter. Doing so identifies the future use of the payment source.

let configuration = {
    sessionId: "d3941a36-6821-4d93-be23-6190226ae5f7",
    options: {
        "showSavePaymentAgreement": true,
        "usage": "subscription"
    },
    ...
}

let dropin = digitalriver.createDropIn(configuration);

Step three: Use the configuration object to instantiate Drop-in Payments.

let dropin = digitalriver.createDropIn(configuration);

Step four: Specify a container to place Drop-in Payments on your cart page.

The modal renders in the specified container.

Customers enter their credit card information, actively accept the save payment agreement, and click the configurable Pay Now button.

If the customer completes the SCA steps necessary to make the source chargeable, then the onSuccess method is called, and Digital River returns a unique Source in a chargeable state.

...
onSuccess: function (data) { doSometingWithTheSource(data) },
...

Step five: Attach the source to the shopper.

Step six: Attach the shopper to the cart.

Step seven: Create the order by submitting the cart.

Customers retrieve their payment information

In this one-off purchase flow, the customers select a credit card they previously saved to their account. The key step is to call the authenticate source method.

SCA required?Drop-in Payments supported?Elements supported?

Yes

No

Yes

Drop-in Payments do not currently support retrieving stored payment methods. To handle this flow, use Elements.

Subscription

You can create SCA-compliant workflows that allow customers to either save or retrieve a recurring payment method during subscription acquisitions. You can also set up workflows for merchant-initiated autorenewals.

Shopper enter and save their payment information during a subscription acquisition

In this flow, customers save payment information to their account and use that payment source to acquire an auto-renewing subscription.

SCA required?Drop-in Payments supported?Elements supported?

Yes

Yes

Yes

Prerequisites: Perform the common Drop-in Payments steps.

Step one: Create a cart with an authenticated customer, and all tax, shipping, duty, and fee amounts are in a final state. Set chargeType to customer_initiate and autoRenewal to true.

Step two: Retrieve the payment session identifier from the cart, and use it to set the sessionId in the Drop-in Payments configuration object.

In options, set flow to checkout and usage to convenience, and (to prompt Drop-in payments to display the save payment option) showTermsOfSaleDisclosure to true.

let configuration = {
    sessionId: "d3941a36-6821-4d93-be23-6190226ae5f7",
    options: {
        "flow": "checkout",
        "showTermsOfSaleDisclosure": true,
        "usage": "subscription"
    },    
    ...
}

Step three: Use the configuration object to instantiate Drop-in Payments.

let dropin = digitalriver.createDropIn(configuration);

Step four: Specify a container to place Drop-in Payments on your cart page.

Drop-in renders in the specified container.

Shoppers must enter their credit card information and click the configurable Pay Now button.

If the shopper completes the necessary SCA steps, then the onSucess method is called an,d Digital River returns a unique source in a chargeable state that is readyForStorage.

...
onSuccess: function (data) { doSometingWithTheSource(data) },
...

Step five: Attach the source to the shopper.

Step six: Create the order by submitting the cart.

Shopper retrieves credit card details during subscription acquisition

In this flow, during the checkout process, shoppers select a credit card they previously saved to their account to acquire an auto-renewing subscription.

SCA required?

Drop-in supported?

Elements supported?

Yes

No

Yes

‌The following demonstrates how to build a workflow for this scenario using Elements. When building this workflow, the key step is to call the authenticateSource method.

Drop-in Payments does not currently support retrieving stored payment methods. To handle this flow, use Digital River with elements.

Merchant-initiated auto renewals

In this flow, you initiate a subscription auto-renewal for the shopper. Although this flow type does not require SCA, you should ensure you're properly managing subscriptions, setting up auto-renewals, and initiating the charge type during the checkout process.

SCA required?Drop-in Payments supported?Elements supported?

No

N/A

N/A

Mail order/telephone order

SCA is not required for transactions where shoppers provide payment details by mail, fax, or telephone. But both Drop-in Payments and Elements support building workflows for mail order and telephone order (MOTO) transactions.

SCA required?Drop-in Payments supported?Elements supported?

No

No

Yes

Prerequisites: Perform the common Drop-in payments steps.

Step one: Create a cart with a chargeType of moto and all tax, shipping, duty, and fee amounts in a final state. This configures Drop-in payments to display only payment methods supported in MOTO transactions.

Step two: Retrieve the checkout's payment session identifier, and use it to set sessionId in the Drop-in payments' configuration object. In options, set flow to checkout and usage to convenience.

let configuration = {
    sessionId: "d3941a36-6821-4d93-be23-6190226ae5f7",
    options: {
        flow: "checkout",
        usage: "convenience"
    }
    ...
}

Step three: Use the configuration object to instantiate Drop-in payments.

let dropin = digitalriver.createDropin(configuration);

Step four: Specify a container to place Drop-in Payments on your checkout page.

The modal window renders in the specified container.

The merchant's representative enters the customer's credit card information and clicks the configurable Pay Now button. If the payment is authorized, then the onSuccess method is called, and Digital River returns a unique source in a chargeable state.

...
onSuccess: function (data) { doSometingWithTheSource(data) },
...

Step five: Attach the source to the cart.

Step six: Create the order by submitting the cart.

Account management flows

You can create flows that allow customers to manage recurring payment methods through their account portal.

In these account management flows you only need to adhere to SCA regulations when saving a customer's credit card for future use. While storing a card, make sure you identify the future use of the source. This increases the probability that future transactions will be approved.

You're not required to provide SCA when updating a credit card's expiration date or billing address.

Saving a credit card

C, customers can use their account portal to save credit card information for future transactions.

SCA required?Drop-in Payments supported?Elements supported?

Yes

Yes

Yes

Prerequisites: Perform the common Drop-in Payments steps.

Step one: Go to a page in your integration where customers manage their payment methods.

Step two: In the configuration object's options, set flow to managePaymentMethods and specify a value for usage that identifies the potential future use of the payment source.

let configuration = {
    options: {
        "flow": "managePaymentMethods",
        "usage": "subscription"
    },
    ...
}
  
let dropin = digitalriverpayments.createDropIn(configuration);

Step three: Use the configuration object to instantiate Drop-in Payments.

Step four: Specify a container to place Drop-in Payments on the account management page.

The modal window renders in the specified container.

Shoppers enter their credit card information, select the save payment agreement option and click the configurable add payment method button.

If the shopper completes the necessary SCA steps, then the onSucess method is called, and Digital River returns a unique source in a chargeable state that is readyForStorage.

...
onSuccess: function (data) { doSometingWithTheSource(data) },
...

Step six: Attach the source to the shopper.

Updating a credit card's expiration date or billing address

Customers use their account portal to update their saved credit card's expiration date or billing address in this flow.

SCA required?Drop-in Payments supported?Elements supported?

No

No

Yes

Drop-in Payments do not support interacting directly with saved payment methods.‌

Last updated