LogoLogo
System Status
  • Digital River API
  • Getting started
  • Using our services
    • Local pricing
    • Item classification
    • Subscriptions
    • e-Invoicing
  • Integration options
    • Low-code checkouts
      • Implementing a Prebuilt Checkout
      • Implementing a Components checkout
      • Offering local pricing
      • Using a shipping endpoint
      • Processing subscription acquisitions
      • Adding custom fields
      • Offering store credit
      • Displaying policies and getting consent
      • Collecting e-invoice information
      • Handling completed checkout-sessions
    • Direct integrations
      • Standard flow
      • Building checkouts
        • Checking out guest and registered customers
        • Describing line items
          • Setting the price of an item
          • Managing items with shared SKU identifiers
        • Providing address information
        • Handling shipping choice
        • Tax identifiers
        • Applying a discount
        • Setting the customer type
        • Providing the IP address
        • Selecting a currency
        • Initiating a charge
        • Setting the purchase location
        • Configuring taxes
        • Accessing regulatory fee information
        • Localizing invoices and credit memos
        • Providing an upstream identifier
        • Applying store credit
        • Handling e-invoicing requirements
        • Landed cost
        • Tax calculation inputs
        • Selling entities
        • Payment sessions
        • Applying store credit (legacy)
        • Country specs
      • Building payment workflows
        • Handling redirect payment methods
        • Handling delayed payment methods
      • Subscription acquisitions
        • Handling subscription acquisitions
        • Handling external subscription acquisitions
        • Subscription information
      • Digital River coordinated fulfillments
        • Checking inventory levels
        • Using shipping quotes
        • Reserving inventory items
        • Managing a fulfillment order
        • Cancelling a fulfillment order
    • Connectors
  • Order management
    • Processing orders
    • Handling a rejected order
    • Accessing invoices and credit memos
    • Fulfilling goods and services
    • Capturing and cancelling charges
    • Payment reauthorizations
    • Handling reversals
      • Return basics
        • Digital River coordinated returns
        • Third party coordinated returns
      • Refund basics
        • Issuing refunds
        • Refunding asynchronous payment methods
      • Disputes and chargebacks
    • Customer notifications
    • Responding to events
      • Events
        • Key event types
        • All event types
      • Webhooks
        • Creating a webhook
        • Digital River API safelist
        • Digital River signature
      • Expanding events
      • Preventing webhooks from getting disabled
    • Distributor model
  • Subscription Management
    • Managing a subscription
    • Managing an external subscription
  • Payments
    • Payment solutions
      • Drop-in payments
        • How Drop-in payments work
        • Drop-in payments integration guide
      • DigitalRiver.js with Elements
        • Elements integration guide
        • Configuring payment methods
          • Configuring Afterpay
          • Configuring Alipay+ (cross-border)
          • Configuring Alipay (domestic)
          • Configuring Amazon Pay
          • Configuring Apple Pay
          • Configuring Bancontact
          • Configuring BNP Paribas
          • Configuring BLIK
          • Configuring CCAvenue
          • Configuring Clearpay
          • Configuring Credit Cards
          • Configuring FPX Online Banking
          • Configuring Google Pay
          • Configuring iDEAL
          • Configuring Klarna
          • Configuring Konbini
          • Configuring Online Banking (IBP)
          • Configuring Online Banking (Korea Bank Transfer)
          • Configuring PayCo
          • Configuring PayPal
          • Configuring SEPA Direct Debit
          • Configuring Trustly
          • Configuring Wire Transfer
          • Common payment sources
          • Common payment objects
    • Supported payment methods
      • Afterpay
      • Alipay (domestic)
      • Alipay+ (cross-border)
      • Amazon Pay
      • Apple Pay
      • Bancontact
      • BNP Paribas
      • BLIK
      • CCAvenue
      • Clearpay
      • Credit Cards
      • FPX Online Banking
      • Google Pay
      • iDEAL
      • Klarna
      • Konbini
      • Korea Bank Transfer (Online Banking)
      • Online Banking (IBP)
      • Pay with Installments France
      • PayCo
      • PayPal
      • PayPal Billing Agreement
      • PayPal Credit
      • PayPal Pay in 3
      • PayPal Pay in 4
      • PayPal RatenZahlung (Installment Payment)
      • SEPA Direct Debit
      • Trustly
      • Wire Transfer
    • Source basics
      • Managing sources
      • Handling credit card sources
      • Retrieving sources
    • Authorization declines
    • PSD2 and SCA
      • How to ensure SCA compliance
    • Payment testing scenarios
  • Product management
    • Product basics
    • Managing SKUs
    • Using product details
    • Grouping SKUs
    • SKU-inventory item pairs
    • Managing inventory items
    • Regulatory fees
      • What are regulatory fees?
        • Fees terminology
        • Regulatory fee management
        • European regulatory fees
        • Compliance obligations
        • WEEE directive requirements
        • Copyright directive requirements
        • Compliance challenges
      • Managing regulatory fees
  • Customer management
    • Customer basics
    • Creating and updating customers
    • Setting up tax exemptions
    • Recording a customer's request to be forgotten
  • Financial reporting
    • Financials basics
    • Sales transactions
      • Returning a list of sales transactions
      • Getting a sales transaction by ID
    • Sales summaries
      • Returning a list of sales summaries
      • Getting a sales summary by ID
    • Payouts
      • Returning a list of payouts
      • Getting a payout by ID
      • Get a list of transactions included in payout by ID
  • Developer resources
    • Digital River API reference
    • DigitalRiver.js reference
      • Including DigitalRiver.js
      • Initializing DigitalRiver.js
      • DigitalRiver object
      • Elements
        • Amazon Pay element
        • Apple Pay elements
        • Google Pay elements
        • IBAN element
        • iDEAL element
        • Konbini elements
        • Compliance element
        • Offline Refund elements
        • Online Banking elements
        • Tax Identifier element
        • Invoice attribute element
        • Delayed Payment Instructions element
        • PayPal elements
      • Guidelines for capturing payment details
      • Security
      • Digital River payment objects
      • Error types, codes, and objects
    • DigitalRiverCheckout.js reference
      • Including DigitalRiverCheckout.js
      • Initializing DigitalRiverCheckout.js
        • DigitalRiverCheckout configuration object
      • DigitalRiverCheckout object
        • Configuring Prebuilt Checkout
          • Performing actions
          • Defining experience
        • Components
          • Configuring components
          • Address component
          • Shipping component
          • Tax identifier component
          • Invoice component
          • Wallet component
          • Payment component
          • Compliance component
          • Order summary component
          • Thank you component
        • Rendering a checkout button
          • Performing actions on the checkout button
        • Determining the checkout's status
      • Accessing country and currency
    • DynamicPricing.js reference
    • Postman collection
  • administration
    • Sign in
    • Digital River Dashboard
      • Digital River Dashboard quick start guide
      • Key features
      • Reset your password
      • Test and production environments
      • Account
        • Adding an account
        • Switching accounts
        • Account access
      • Profile settings
        • Viewing your personal information
        • Changing your password
        • Updating your phone number
        • Enabling multi-factor authentication
      • Finance
        • Payouts
          • Viewing your payout details
          • Filtering your payouts
          • Exporting your payouts
        • Sales summaries
          • Viewing your sales summaries details
          • Filtering your sales summaries
          • Exporting your sales summaries
          • Exporting your sales summary details
        • Transactions
          • Viewing your transaction details
          • Filtering your transactions
          • Exporting your transactions
      • Order management
        • Orders
          • Searching for orders
          • Filtering your orders
          • Viewing the order details
          • Cancelling items
          • Fulfilling items
          • Downloading an invoice
          • Downloading a credit memo
          • Creating shipping labels
          • Recording a customer's request to be forgotten
          • Viewing returns and refunds
          • Creating a return
          • Accepting a return
          • Creating a refund
          • Viewing the order's timeline
        • Checkouts
          • Searching for checkouts
          • Filtering your checkouts
          • Viewing the checkout details
        • Prebuilt Checkout links
          • Generate Prebuilt Checkout links
          • View and work with Prebuilt Checkout link details
          • Add a customer during Prebuilt Checkout
          • Add a product during Prebuilt Checkout
      • Customers
        • Viewing customer details
        • Searching for customers
        • Filtering your customers
        • Editing account information
        • Adding a customer
        • Tax IDs and certificates
          • Adding a tax certificate
          • Adding a tax ID
          • Deleting a tax ID
        • Metadata
          • Adding metadata
          • Editing metadata
        • Manage subscriptions from the Customer Details page
        • Disabling a customer
        • Recording a customer's request to be forgotten
        • Deleting a customer
      • Catalog
        • SKUs
          • Viewing the SKU details
          • Searching for SKUs
          • Filtering your SKUs
          • Adding a SKU
          • Editing a SKU
          • Deleting a SKU
          • Adding a fee to a SKU
          • Editing a fee
          • Deleting a fee
          • Viewing product tariff codes
        • Managing customer subscriptions from Digital River Dashboard
      • Developers
        • API keys
          • Updating your API version
          • Getting your API keys
          • Changing the API version for your key
          • Creating a restricted key
          • Editing a restricted key
          • Deleting a restricted key
          • Rotating keys
        • Webhooks
          • Creating a webhook
          • Editing a webhook
          • Deleting a webhook
          • Rotating a webhook's secret
        • API logs
          • Filtering the API log
          • Viewing the API log details
        • Event logs
          • Filtering the events log
          • Viewing the event details
      • Settings
        • Users and roles
          • Roles
          • Searching for a user by name or email
          • Filtering your users and roles
          • Adding a user
          • Editing a user
          • Deleting a user
        • Prebuilt Checkout
        • Payment methods
          • Viewing your payment methods
          • Viewing payment method details
            • Enabling currencies
            • Managing countries
          • Enabling or disabling a payment method
  • General Resources
    • eCompass
    • eCompass documentation
    • Release notes
      • 2024
      • 2023
      • 2022
      • 2021
      • 2020
      • 2019
    • Standards and certifications
      • Certification process
      • Compliance requirements
      • Documentation requirements
      • Integration checklists
        • Admin portal
        • Products and SKUs
        • Customers and tax exemptions
        • Checkouts, payment sources, and orders
        • Disclosures, compliance statements, and emails
        • Fulfillments and cancellations
        • Customer portal
        • Order refund synchronization
        • Reversals
        • Error handling
      • Test and use cases
    • Commerce infrastructure
    • Versioning
    • Glossary
Powered by GitBook
On this page
  • Why use payment sessions?
  • When to use payment sessions
  • Configure elements
  • Retrieve available payment methods
  • Create sources
  • Determine when to create orders
  • Determine next action
  • The payment session object
  • Session state
  • Amount contributed and remaining
  • Next action
  • Migrating to payment sessions
  • Update your code
  1. Integration options
  2. Direct integrations
  3. Building checkouts

Payment sessions

Learn the basics of payment sessions

PreviousSelling entitiesNextApplying store credit (legacy)

Last updated 2 months ago

A payment session tracks a transaction's payment. On this page, you'll find information on:

Why use payment sessions?

Payment sessions allow you to . This solution lessens your front-end development burden. To take just one example, automatically retrieve a transaction's applicable and then present them to customers during the payment collection stage of a checkout.

Additionally, payment sessions simplify creation. Without them, you'll need to retrieve numerous data points from the and ensure they're properly formatted before passing them to . With payment sessions, however, you simply retrieve the payment.session.id and then pass that value to the appropriate , thereby minimizing your data transfer requirements

Payment sessions also allow you to comply with regulations. If you reference this object when creating , Digital River, when necessary, automatically collects a customer's authentication data.

When to use payment sessions

You can use payment sessions to:

Configure elements

Retrieve available payment methods

digitalriver.retrieveAvailablePaymentMethods({
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f"
}).then(function(result) {
    //do something with the data
});

Create sources

let configuration = {
    "sessionId": "172deb0f-de6f-4d2c-9555-53f3894b6318",
    "options": {
        "flow": "checkout",
        "showComplianceSection": true
    }, 
    onSuccess: function(data) {}, 
    onError: function(data) {}, 
    onReady: function(data) {}, 
    onCancel: function(data) {}
}
                                    
let dropin = digitalriverpayments.createDropin(configuration);
dropin.mount("drop-in");
let payload = {
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "type": "payPal",
    "payPal": {
        "returnUrl": "https://mywebsite.com/paymentCallBack.html",
        "cancelUrl": "https://mywebsite.com/paymentCallBack.html"
    }
}

digitalriver.createSource(payload).then(function(result) {
    if(result.state === "chargeable") {
        sendToBackEnd(result);
    } else {
        doErrorScenario();
    }
});

Determine when to create orders

Checkout
{
    "id": "8f349290-a6ec-438a-8623-ca0c6e6f65fa",
    ...
    "payment": {
        ...
        "session": {
            "id": "1403a59f-37a8-4d9e-8e13-838cf6f2a0cc",
            "amountContributed": 27.01,
            "amountRemainingToBeContributed": 0.0,
            "state": "requires_confirmation",
            "clientSecret": "1403a59f-37a8-4d9e-8e13-838cf6f2a0cc_a2a14087-2aa7-4876-b4f9-d16b5ae6817b"
        }
    }
}

Determine next action

The payment session object

The following section provides information on the payment session object:

Session state

A payment session has a defined lifecycle. Each stage of that lifecycle is represented by a state. When building your integration, we recommend you pay close attention to:

requires_source

requires_confirmation

pending_redirect

A payment session in a state of pending_redirect indicates that customers were successfully redirected to the payment provider's portal but have yet to complete the actions necessary to authorize payment.

pending_funds

A payment session state of pending_funds indicates that customers must complete an asynchronous process before payment is authorized.

pending

complete

Amount contributed and remaining

{
    "type": "bad_request",
    "errors": [
        {
            "code": "order_submit_failed",
            "message": "Payment session status is invalid."
        }
    ]
}

Next action

Order
{
    "id": "240354510336",
    ...
    "payment": {
        ...
        "session": {
            "id": "1b682138-ce9f-46ec-8b5e-94b710128cd9",
            ...
            "nextAction": {
                "action": "redirect",
                "data": {
                    "redirectUrl": "https://api.digitalriver.com:443/payments/redirects/3fab742c-a7e8-4a90-8951-86d071fa070d?apiKey=pk_test_a45b91ba4f984df7a229b2ab5941ce1c"
                }
            }
        }
    },
    ...
}
Order
{
    "id": "239809940336",
    ...
    "payment": {
        ...
        "session": {
            "id": "afaed310-419f-4ced-912c-6830a98c7384",
            ...
            "nextAction": {
                "action": "show_payment_instructions",
                "data": {
                    "sourceId": "9c00d78c-dbad-4303-b366-7e0a49c322e7",
                    "sourceClientSecret": "9c00d78c-dbad-4303-b366-7e0a49c322e7_246ed54a-0dfc-41f0-9e98-14036adf642e"
                }
            }
        }
    },
    ...
}

Migrating to payment sessions

Update your code

You'll also need to remove some parameters. The specific parameters that must be removed depend on the payment method.

Credit Card

For credit cards, you add sessionId to the payload, but do not remove any existing parameters.

The following tabs provide code examples of how sources are created without and with payment sessions.

var payload = {
    "type": "creditCard",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "john.doe@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "10380 Bren Road West",
            line2: "Suite 123",
            city: "Minnetonka",
            state: "MN",
            postalCode: "55343",
            country: "US"
        }
    }
}

digitalriver.createSource(cardCVV, payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "type": "creditCard",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "john.doe@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "10380 Bren Road West",
            line2: "Suite 123",
            city: "Minnetonka",
            state: "MN",
            postalCode: "55343",
            country: "US"
        }
    }
}

digitalriver.createSource(cardCVV, payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

PayPal

For PayPal, you add sessionId to the payload and remove amount, currency, payPal.items, payPal.taxAmount, payPal.shippingAmount, payPal.amountsEstimated, payPal.requestShipping, and payPal.shipping.

The following tabs provide code examples of how sources are created without and with payment sessions.

var payload = {
    "type": "payPal",
    "amount": 120.99,
    "currency": "USD",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel",
        "items": [{
                "name": "Cell Phone (Unlocked)",
                "quantity": 1,
                "unitAmount": 100
            },
            {
                "name": "Headphones",
                "quantity": 1,
                "unitAmount": 15
            }
        ],
        "taxAmount": 0.99,
        "shippingAmount": 5,
        "amountsEstimated": true,
        "requestShipping": true,
        "shipping": {
            "recipient": "John Doe",
            "phoneNumber": "952-555-1212",
            "address": {
                "line1": "54321 Fake St.",
                "line2": "Apt. 3C",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55341"
            }
        }
    }
}


digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "payPal",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel"
    }
}

digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

PayPal Billing

For PayPal Billing, you add sessionId to the payload and remove amount, currency, payPalBilling.items, payPalBilling.taxAmount, payPalBilling.shippingAmount, payPalBilling.amountsEstimated, payPalBilling.requestShipping, and payPalBilling.shipping.

The following tabs provide code examples of how sources are created without and with payment sessions.

var payload = {
    "type": "payPalBilling",
    "amount": 120.99,
    "currency": "USD",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel",
        "items": [{
                "name": "Cell Phone (Unlocked)",
                "quantity": 1,
                "unitAmount": 100
            },
            {
                "name": "Headphones",
                "quantity": 1,
                "unitAmount": 15
            }
        ],
        "taxAmount": 0.99,
        "shippingAmount": 5,
        "amountsEstimated": true,
        "requestShipping": true,
        "shipping": {
            "recipient": "John Doe",
            "phoneNumber": "952-555-1212",
            "address": {
                "line1": "54321 Fake St.",
                "line2": "Apt. 3C",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55341"
            }
        }
    }
}


digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "payPalBilling",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel"
    }
}

digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

PayPal Credit

For PayPal Credit, you add sessionId to the payload and remove amount, currency, payPal.items, payPal.taxAmount, payPal.shippingAmount, payPal.amountsEstimated, payPal.requestShipping, and payPal.shipping.

The following tabs provide code examples of how sources are created without and with payment sessions.

var payload = {
    "type": "payPalCredit",
    "amount": 120.99,
    "currency": "USD",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel",
        "items": [{
                "name": "Cell Phone (Unlocked)",
                "quantity": 1,
                "unitAmount": 100
            },
            {
                "name": "Headphones",
                "quantity": 1,
                "unitAmount": 15
            }
        ],
        "taxAmount": 0.99,
        "shippingAmount": 5,
        "amountsEstimated": true,
        "requestShipping": true,
        "shipping": {
            "recipient": "John Doe",
            "phoneNumber": "952-555-1212",
            "address": {
                "line1": "54321 Fake St.",
                "line2": "Apt. 3C",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55341"
            }
        }
    }
}


digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "payPalCredit",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel"
    }
}

digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

SEPA Direct Debit

For SEPA Direct Debit, you add sessionId to the payload and remove amount and currency.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "directDebit",
    "amount": 100,
    "currency": "EUR",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "123 Main Street",
            line2: "",
            city: "Paris",
            postalCode: "14390",
            country: "FR"
        }
    },
    "directDebit": {
        "returnUrl": "https://mypage.com"
    }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "directDebit",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "123 Main Street",
            line2: "",
            city: "Paris",
            postalCode: "14390",
            country: "FR"
        }
    },
    "directDebit": {
        "returnUrl": "https://mypage.com"
    }
}

digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Wire Transfer

For Wire Transfer, you add sessionIdto the payload and remove amount and currency.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "wireTransfer",
    "amount": 100,
    "currency": "EUR",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "123 Main Street",
            line2: "",
            city: "Paris",
            postalCode: "14390",
            country: "FR"
        }
    },
    "wireTransfer": {
    }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var data = {
    "type": "wireTransfer",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "123 Main Street",
            line2: "",
            city: "Paris",
            postalCode: "14390",
            country: "FR"
        }
    },
    "wireTransfer": {
    }
}

digitalriver.createSource(data).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Cash on Delivery - Japan

For Cash on Delivery - Japan, you add sessionId to the payload and remove amount and currency.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "codJapan",
    "amount": 100,
    "currency": "EUR",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "123 Main Street",
            line2: "",
            city: "Paris",
            postalCode: "14390",
            country: "FR"
        }
    },
    "codJapan": {
    }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "codJapan",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        phoneNumber: "000-000-0000",
        address: {
            line1: "123 Main Street",
            line2: "",
            city: "Paris",
            postalCode: "14390",
            country: "FR"
        }
    },
    "codJapan": {
    }
}

digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Payco - Korea Payments

For Payco - Korea Payments, you add sessionId to the payload and remove amount and currency.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "payco",
    "amount": 100,
    "currency": "KRW",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        address: {
            line1: "1234 Fake Street",
            line2: "Yaum-dong",
            city: "Ulsan-si",
            state: "Kyongsangnamdo",
            postalCode: "100-011",
            country: "KR"
        }
    },
    "payco": {
        "returnUrl": "https://yourReturnUrl.com"
    }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "payco",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        address: {
            line1: "1234 Fake Street",
            line2: "Yaum-dong",
            city: "Ulsan-si",
            state: "Kyongsangnamdo",
            postalCode: "100-011",
            country: "KR"
        }
    },
    "payco": {
        "returnUrl": "https://yourReturnUrl.com"
    }
}

digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Bank Transfer - Korea Payments

For Bank Transfer - Korea Payments, you add sessionId to the payload and remove amount and currency.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "bankTransfer",
    "amount": 100,
    "currency": "KRW",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        address: {
            line1: "1234 Fake Street",
            line2: "Yaum-dong",
            city: "Ulsan-si",
            state: "Kyongsangnamdo",
            postalCode: "100-011",
            country: "KR"
        }
    },
    "bankTransfer": {
        "returnUrl": "https://yourReturnUrl.com"
    }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "bankTransfer",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "owner": {
        firstName: "John",
        lastName: "Doe",
        email: "test@digitalriver.com",
        address: {
            line1: "1234 Fake Street",
            line2: "Yaum-dong",
            city: "Ulsan-si",
            state: "Kyongsangnamdo",
            postalCode: "100-011",
            country: "KR"
        }
    },
    "bankTransfer": {
        "returnUrl": "https://yourReturnUrl.com"
    }
}

digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Online Banking - IBP

For Online Banking - IBP, you add sessionId to the payload and remove amount and currency.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "onlineBanking",
    "amount": 100,
    "currency": "EUR",
    "owner": {
        "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@digitalriver.com",
            "phoneNumber": "000-000-0000",
            "address": {
                "line1": "52-58 Neue Mainzer Straße",
                "line2": "",
                "city": "Frankfurt am Main",
                "state": "HE",
                "postalCode": "60311",
                "country": "DE"
            }
        },
        "onlineBanking": {
            "returnUrl": "https://myurl.com/success",
            "cancelUrl": "https://myurl.com/cancel",
            "bankCode": "82"
        }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "onlineBanking",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "owner": {
        "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@digitalriver.com",
            "phoneNumber": "000-000-0000",
            "address": {
                "line1": "52-58 Neue Mainzer Straße",
                "line2": "",
                "city": "Frankfurt am Main",
                "state": "HE",
                "postalCode": "60311",
                "country": "DE"
            }
        },
        "onlineBanking": {
            "returnUrl": "https://myurl.com/success",
            "cancelUrl": "https://myurl.com/cancel",
            "bankCode": "82"
        }
}


digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Konbini

For Konbini, you add sessionId to the payload and remove amount and currency.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "konbini",
    "amount": 120.99,
     "currency": "JPY",
        "owner": {
            "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@digitalriver.com",
            "phoneNumber": "000-000-0000",
            "address": {
                "line1": "6 Chome-10-1 Roppongi, Minato",
                "state": "Tokyo",
                "postalCode": "106-0032",
                "country": "JP"
            }
        },
        "konbini": {
            "storeId": "010"
        }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
    "type": "konbini",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "owner": {
         "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@digitalriver.com",
            "phoneNumber": "000-000-0000",
            "address": {
                "line1": "6 Chome-10-1 Roppongi, Minato",
                "state": "Tokyo",
                "postalCode": "106-0032",
                "country": "JP"
            }
        },
        "konbini": {
            "storeId": "010"
        }
}


digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Klarna

For Klarna, you add sessionId to the payload and remove amount, currency, klarnaCredit.items, klarnaCredit.locale, klarnaCredit.discountAmount, klarnaCredit.taxAmount, klarnaCredit.shippingAmount, klarnaCredit.shipping, klarnaCredit.accountId, klarnaCredit.accountCreatedDate, klarnaCredit.accountUpdatedDate, klarnaCredit.hasPaidBefore, klarnaCredit.subscriptionDescription, klarnaCredit.subscriptionStartDate, klarnaCredit.subscriptionEndDate, klarnaCredit.autoRenewal, and klarnaCredit.affiliateName.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "klarnaCredit",
    "owner": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "email@email.org",
        "phoneNumber": "9522253720",
        "address": {
            "line1": "line1",
            "line2": "line2",
            "city": "Minnetonka",
            "state": "MN",
            "country": "US",
            "postalCode": "55410"
        }
    },
    "amount": "101.50",
    "currency": "USD",
    "klarnaCredit": {
        "returnUrl": "http://example.com/return",
        "cancelUrl": "http://example.com/cancel",
        "taxAmount": 0,
        "shippingAmount": 5.75,
        "items": [{
            "name": "Happy Ball",
            "quantity": "1",
            "unitAmount": "94.25",
            "subscriptionInfo": {
                "autoRenewal": true,
                "freeTrial": false
            }
        },
        {
            "name": "Happy Ball1",
            "quantity": "2",
            "unitAmount": "0.75"
        }],
        "locale": "en_US",
        "shipping": {
            "recipient": "Guy Incognito",
            "phoneNumber": "9522253720",
            "address": {
                "line1": "line1",
                "line2": "line2",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55410"
            },
            "email": "test_email@email.org"
        },
        "accountId": "456789",
        "accountCreatedDate": "2020-11-24T15:20:00.000Z",
        "accountUpdatedDate": "2012-11-25T15:30:00.001Z",
        "hasPaidBefore": false,
        "subscriptionDescription": "Klarna Credit Recurring",
        "subscriptionStartDate": "2019-10-24T15:00:00.030Z",
        "subscriptionEndDate": "2021-10-24T15:00:00.030Z",
        "autoRenewal": "false",
        "affiliateName": "Sample Affiliate"
    }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
  "type" : "klarnaCredit",
  "owner" : {
    "firstName" : "firstName",
    "lastName" : "lastName",
    "email" : "email@email.org",
    "phoneNumber" : "9522253720",
    "address" : {
      "line1" : "line1",
      "line2" : "line2",
      "city" : "Minnetonka",
      "state" : "MN",
      "country" : "US",
      "postalCode" : "55410"
    }
  },
  "sessionId" : "3aa75613-9596-438a-9604-67e20016aa96",
  "klarnaCredit" : {
    "returnUrl" : "http://example.org/return",
    "cancelUrl" : "http://example.org/cancel"
  }
}


digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

Klarna Recurring

For Klarna Recurring, you add sessionId to the payload and remove amount, currency, klarnaCreditRecurring.items, klarnaCreditRecurring.locale, klarnaCreditRecurring.discountAmount, klarnaCreditRecurring.taxAmount, klarnaCreditRecurring.shippingAmount, klarnaCreditRecurring.shipping, klarnaCreditRecurring.accountId, klarnaCreditRecurring.accountCreatedDate, klarnaCreditRecurring.accountUpdatedDate, klarnaCreditRecurring.hasPaidBefore, klarnaCreditRecurring.subscriptionDescription, klarnaCreditRecurring.subscriptionStartDate, klarnaCreditRecurring.subscriptionEndDate, klarnaCreditRecurring.autoRenewal, and klarnaCreditRecurring.affiliateName.

The following tabs provide code examples of how sources are created without and with payment sessions.

let payload = {
    "type": "klarnaCreditRecurring",
    "owner": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "email@email.org",
        "phoneNumber": "9522253720",
        "address": {
            "line1": "line1",
            "line2": "line2",
            "city": "Minnetonka",
            "state": "MN",
            "country": "US",
            "postalCode": "55410"
        }
    },
    "amount": "101.50",
    "currency": "USD",
    "klarnaCreditRecurring": {
        "returnUrl": "http://example.com/return",
        "cancelUrl": "http://example.com/cancel",
        "taxAmount": 0,
        "shippingAmount": 5.75,
        "items": [{
            "name": "Happy Ball",
            "quantity": "1",
            "unitAmount": "94.25",
            "subscriptionInfo": {
                "autoRenewal": true,
                "freeTrial": false
            }
        },
        {
            "name": "Happy Ball1",
            "quantity": "2",
            "unitAmount": "0.75"
        }],
        "locale": "en_US",
        "shipping": {
            "recipient": "Guy Incognito",
            "phoneNumber": "9522253720",
            "address": {
                "line1": "line1",
                "line2": "line2",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55410"
            },
            "email": "test_email@email.org"
        },
        "accountId": "456789",
        "accountCreatedDate": "2020-11-24T15:20:00.000Z",
        "accountUpdatedDate": "2012-11-25T15:30:00.001Z",
        "hasPaidBefore": false,
        "subscriptionDescription": "Klarna Credit Recurring",
        "subscriptionStartDate": "2019-10-24T15:00:00.030Z",
        "subscriptionEndDate": "2021-10-24T15:00:00.030Z",
        "autoRenewal": "false",
        "affiliateName": "Sample Affiliate"
    }
}

digitalriver.createSource(payload).then(function(result) {

    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var payload = {
  "type" : "klarnaCreditRecurring",
  "owner" : {
    "firstName" : "firstName",
    "lastName" : "lastName",
    "email" : "email@email.org",
    "phoneNumber" : "9522253720",
    "address" : {
      "line1" : "line1",
      "line2" : "line2",
      "city" : "Minnetonka",
      "state" : "MN",
      "country" : "US",
      "postalCode" : "55410"
    }
  },
  "sessionId" : "3aa75613-9596-438a-9604-67e20016aa96",
  "klarnaCreditRecurring" : {
    "returnUrl" : "http://example.org/return",
    "cancelUrl" : "http://example.org/cancel"
  }
}


digitalriver.createSource(payload).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

The following all can be configured with a payment session identifier:

If you're using to collect payment, you can call to get a transaction's applicable payment methods and then present them as options during checkouts.

To configure this method, retrieve the payment.session.id and pass it to sessionId.

Both of Digital River's can be configured with the payment.session.id. The data our payment service needs to create the is retrieved from that referenced object.

Before , a payment.session should be in a of requires_confirmation and its should be 0.

If you and its is pending_payment, then this indicates that the on the isn't authorized and the goods shouldn't be fulfilled yet.

To handle this state change event, check the value of the order's .

If it's redirect, refer to .

If it's show_payment_instructions, refer to .

The attributes described in this section are only contained in 2021-03-23 and higher.

For a complete list of payment session state values, refer to the , , or API reference documentation.

If a payment.session.state is requires_source, then this indicates that either:

No is associated with the checkout or

The aggregated amount of any associated with the checkout is less than the checkout's totalAmount.

In both cases, Digital River won't be able to generate an aggregated amount of large enough to cover the totalAmount. As a result, the remains greater than 0.0 and any attempt to is blocked.

When the payment session's state is requires_confirmation, then one or more have been applied to the , and the aggregated amount is sufficient to fund the transaction.

The payment.session.state must be requires_confirmation before you .

For example, if you a to a , then the drops to 0.0 and the payment session's state transitions to requires_confirmation.

This state only occurs when customers choose a whose resulting has a .

If an payment.session.state persists as pending_redirect, then customers either selected the cancel payment option or clicked their web browser's back button.

This state occurs when customers choose a whose resulting has a .

For example, an with a of and a payment.session.state of pending_funds means that customers have yet to complete payment at the designated convenience store (e.g. 7-11 or FamilyMart).

A pending payment session state means that customers have completed all the necessary actions (such as and redirects) but certain backend payment processes remain incomplete.

Once all of an payment are , its payment.session.state typically transitions to complete.

Once you associate a with a , Digital River uses it to fund the transaction in full and payment.session.amountRemainingToContribute drops to 0.0.

But when checkouts only contain , you need to confirm that sufficient funds exist to cover the checkout's totalAmount. If this isn't the case, and you , you receive the following error:

By comparing values in the payment.session, you can determine how much additional funding, if any, is required. The amountContributed represents the aggregated amount of all the checkout's payment.sources[]. The amountRemainingToBeContributed is how much is needed to fund the transaction.

If amountContributed is equal to the checkout's totalAmount or the amountRemainingToBeContributed is 0.0, then you don't need to request any more payment methods from the customer, and once the payment session's is , you can .

But if amountContributed is less than the checkout's totalAmount or amountRemainingToBeContributed is greater than 0.0, then the customer needs to supply additional payment methods before you . This only happens, however, when you have yet to associate a primary payment source with the checkout. Once that's done, amountRemainingToBeContributed drops to 0.0.

If customers opt to fund a transaction with a whose resulting has an authentication of redirect or receiver, then, after you and submit the , the , in most cases, will contain payment.session.nextAction and this object's nested action will be either redirect or show_payment_instructions.

If action is redirect, then send customers to the address specified by data.redirectUrl. For details, refer to .

If action is show_payment_instructions then use data.sourceId and data.sourceClientSecret to configure the . For details, refer to .

The conversion process is fairly straightforward if you collect payment using and are not currently using payment sessions but want to migrate to this solution.

To collect payment, we generally recommend that you use .

In the Digital River APIs, payment sessions are automatically enabled. This means that each time you , the response contains a payment session identifier that you use to configure .

You'll need to update your code to integrate with payment sessions. For each of your enabled , add sessionId to the payload that gets passed to .

The following sections contain instructions and example codes for each payment method: , , , , , , , , , , , , , and .

elements
iDeal
Tax identifier
Invoice attribute
PayPal
Handling redirect payment methods
Handling delayed payment methods
SCA
Handling redirect payment methods
delayed payment instructions element
Handling delayed payment methods
DigitalRiver.js with elements
Drop-in payments
payment.session.nextAction.action
state
amountContributed and amountRemainingToBeContributed
nextAction
requires_source
requires_confirmation
pending_redirect
pending_funds
pending
complete
SEPA Direct Debit
Credit Card
PayPal
PayPal Billing
PayPal Credit
Wire Transfer
Cash on Delivery - Japan
Payco - Korea Payments
Bank Transfer - Korea Payments
Online Banking - IBP
bPay
Konbini
Klarna
Klarna Recurring
gain access to Drop-in payments
Drop-in payments
payment methods
PSD2 and SCA
credit card sources
The benefits of using payment sessions
When to use payment sessions
The payment session object
How to migrate to payment sessions
Configure various elements
Retrieve available payment methods
Create sources
Determine when to create orders
Determine the next action to take after order creation
DigitalRiver.js with elements
sources[]
payment method
source
payment method
source
konbini
payment method
payment methods
state
amountRemainingToBeContributed
amountRemainingToContribute
amountRemainingToContribute
state
requires_confirmation
redirect authentication flow
receiver authentication flow
create the order
create the order
versions
payment.sources[].type
flow
create order request
creating an order
create an order
create an order
create the order
convert the checkout to an order
retrieveAvailablePaymentMethods()
createSource()
createSource()
createSource()
checkout's
checkout's
checkouts
orders
invoices
checkout's
charges[]
checkout's
checkout
checkout's
order's
order
order's
charges[]
capturable
checkout's
source
checkout
checkout's
checkout's
source
state
charge
checkout
checkout
source
order
create a checkout
source creation method
source creation methods
primary payment sources[]
primary sources[]
secondary sources[]
attach
primary source
primary payment sources[]
secondary payment sources[]
associate the source with the checkout