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
  • PayPal Express Checkout (Digital Wallet)
  • Step 1: Build the PayPal objects
  • Step 2: Create a PayPal source using DigitalRiver.js
  • Step 3: Authorize a PayPal source
  • Step 4: Use the Authorized source
  • Testing PayPal Express Checkout (Digital Wallet)
  • PayPal Billing Agreement
  • Step 1: Build a PayPal Billing Agreement Source Request object
  • Step 2: Create a PayPal Billing Agreement source using DigitalRiver.js
  • Step 3: Authorize a PayPal Billing Agreement source
  • Step 4: Use the authorized source
  • Testing PayPal Billing Agreement
  • PayPal Pay Later
  • PayPal Pay in 3
  • PayPal Pay in 4
  • PayPal RatenZahlung
  • PayPal Credit
  • Step 1: Build a Credit source request object
  • Step 2: Create a PayPal Credit source using DigitalRiver.js
  • Step 3: Authorize a PayPal Credit source
  • Step 4: Use the Authorized source
  • Testing PayPal Pay Later
  1. Payments
  2. Payment solutions
  3. DigitalRiver.js with Elements
  4. Configuring payment methods

Configuring PayPal

Learn how to configure PayPal for DigitalRiver.js with Elements.

PreviousConfiguring PayCoNextConfiguring SEPA Direct Debit

Last updated 5 months ago

PayPal offers the following payment methods: , , , , , and .

PayPal Express Checkout (Digital Wallet)

PayPal is a payment service that facilitates payments between parties through online funds transfers. On its website, PayPal allows customers to establish an account connected to a user's credit card or checking account.

You can find an example of integration .

Use the for subscriptions. That includes any instance where the cart contains both subscription and non-subscription products.

If you're using , you can create a payment method for your app or website in four easy steps:

Step 1: Build the PayPal objects

Build the PayPal objects.

PayPal source request object

A PayPal source request object requires the following fields.

Field
Value

type

payPal

sessionId

The payment session identifier.

payPal

"PayPal": {
    "returnUrl": "http://mypage.com",
    "cancelUrl": "https://mypage.com/cancel",
    "requestShipping": true
}
Field
Required/Optional
Description

returnUrl

Required

If you choose to utilize the full redirect flow, this is where you will redirect your customer to after authorizing within the PayPal experience.

cancelUrl

Required

If you choose to utilize the full redirect flow, this is where you will redirect your customer to after canceling within the PayPal experience.

requestShipping

Optional

If true, PayPal provides a shipping selection for the customer on the PayPal portal. Set this value to true for sessions with physical items. If false or omitted, no shipping selection will be shown.

Step 2: Create a PayPal source using DigitalRiver.js

Use the DigitalRiver.js library to create and mount elements to the HTML container.

var data = {
    "type": "payPal",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel"
    }
}

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

PayPal source response example

{
    "clientId": "gc",
    "channelId": "drdod15",
    "liveMode": false,
    "id": "d6a44e5d-1373-4013-847d-10deb4ded4df",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",    
    "clientSecret": "d6a44e5d-1373-4013-847d-10deb4ded4df_ddd44e5d-1373-4013-847d-10deb4ded4df",
    "type": "payPal",
    "reusable": false,
    "amount": "10.00",
    "currency": "USD",
    "state": "pending_redirect",
    "creationIp": "209.87.178.4",
    "createdTime": "2019-05-22T00:00:46.975Z",
    "updatedTime": "2019-05-22T00:00:46.975Z",
    "flow": "redirect",
    "redirect": {
        "redirectUrl": "https://api.digitalriver.com:443/payments/redirects/b8f2207b-8236-4608-b5a2-812790d42ed8?apiKey=pk_test_6cb0fe9ce3124093a9ad906f6c589e2ds",
        "returnUrl": "https://example.com?action=paymentSuccess",
        "cancelUrl": "https://example.com?action=paymentFailure"
    },
    "payPal": {
        "shipping": {
            "recipient": "John Doe",
            "phoneNumber": "555-555-1212",
            "address": {
                "line1": "54321 Fake St.",
                "line2": "Apt. 3C",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55341"
            }
        },
        "token": "EC-1HD67063RG318840B"
    }
}    "clientSecret": "d6a44e5d-1373-4013-847d-10deb4ded4df_ddd44e5d-1373-4013-847d-10deb4ded4df",
    "type": "payPal",
    "reusable": false,
    "amount": "10.00",
    "currency": "USD",
    "state": "pending",
    "creationIp": "209.87.178.4",
    "createdTime": "2019-05-22T00:00:46.975Z",
    "updatedTime": "2019-05-22T00:00:46.975Z",
    "flow": "redirect",
    "redirect": {
        "redirectUrl": "https://api.digitalriver.com:443/payments/redirects/b8f2207b-8236-4608-b5a2-812790d42ed8?apiKey=pk_test_6cb0fe9ce3124093a9ad906f6c589e2ds",
        "returnUrl": "https://example.com?action=paymentSuccess",
        "cancelUrl": "https://example.com?action=paymentFailure"
    },
    "payPal": {
        "shipping": {
            "recipient": "John Doe",
            "phoneNumber": "555-555-1212",
            "address": {
                "line1": "10380 Bren Road W",
              	"line2": "",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55343"
            }
        },
        "token": "EC-1HD67063RG318840B"
    }
}

Step 3: Authorize a PayPal source

When you create a PayPal source, the customer is required to authorize the charge at PayPal. You can accomplish this by either redirecting the customer to PayPal or using the PayPal SDK to authorize the charge as part of your experience.

Redirecting the customer to PayPal for authorization

To redirect your customer to PayPal for authorization, use the redirectUrl parameter in your createSource response.

window.location.href = sourceResponse.redirect.redirectUrl;

At PayPal, the customer can authorize or cancel the transaction when presented with the transaction details. If the authorization is successful, the customer will be redirected to the PayPal Return URL parameter you specified when you created the source. If the customer cancels, they will be returned to the PayPal Cancel URL parameter you specified.

Using the PayPal SDK to authorize payment

Use the PayPal Checkout SDK to streamline the authorizing PayPal transactions. This will allow you to control things like the appearance of the PayPal button and embed the entire experience into your workflow.

Example:

  1. Include the PayPal Checkout SDK on your page and specify a location where the button will appear.

<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<div id="paypal-button"></div>
var paypalSourceData = {
    "type": "payPal",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPal": {
        "returnUrl": redirectUrl,
        "cancelUrl": cancelUrl,
    }
};
 
paypal.Button.render({
    // Configure environment
    env: 'sandbox',
    // Customize button (optional)
    locale: 'en_US',
    style: {
        label: 'checkout',
        size: 'responsive',
        color: 'gold',
        shape: 'rect',
        layout: 'horizontal',
        fundingicons: 'false',
        tagline: 'false'
    },
    // Set up a payment
    payment: function(data, actions) {
        return digitalriver.createSource(paypalSourceData).then(function(result) {
            if (result.error) {
                //handle the errors that were returned
                handleErrors(result.error)
            } else {
                return result.source.payPal.token;
            }
        });
    },
    // Execute the payment
    onAuthorize: function(data, actions) {
        //the payment has been authorized, use the source and attach it to your customer's account.
        doSomething();
    },
    onCancel: function(data) {
        //the payment has been cancelled, do something to try and get the shopper back on track
        doSomethingElse();
    }
}, '#paypal-button');

Step 4: Use the Authorized source

Attach the source to a checkout

{
  "customerId": "5774321008",
  "sourceId": "src_a78cfeae-f7ae-4719-8e1c-d05ec04e4d37"
}

Testing PayPal Express Checkout (Digital Wallet)

PayPal Billing Agreement

The PayPal billing agreement allows consumers to use their PayPal account to make recurring payments when they purchase a subscription product by clicking the PayPal button. Consumers can choose to auto-renew or manually renew.

Currency supported: All currencies available in supported countries.

Create a PayPal billing agreement payment method for your app or website in four easy steps:

Step 1: Build a PayPal Billing Agreement Source Request object

A PayPal billing agreement source request object requires the following fields.

Field
Value

type

payPalBilling

sessionId

The payment session identifier. The checkout flow requires this field, so do not define it in the account management flow.

owner

The customer's billing information. This field is required in the account management flow as there won't be a sessionId.

payPalBilling

Step 2: Create a PayPal Billing Agreement source using DigitalRiver.js

In this step, you can integrate and use the DigitalRiver.js library to facilitate the creation of a PayPal Billing Agreement source. This process involves configuring and mounting the necessary elements into your webpage for both checkout and account management flows. By following the provided code examples, you can seamlessly connect the billing agreement flow to your backend systems, ensuring a smooth and efficient payment process.

var data = {
    "type": "payPalBilling",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPalBilling": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel"
    }
}

digitalriver.createSource(data).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});
var data = {
    "type": "payPalBilling",
    "currency": "USD",
    "owner": {
        "firstName": "Jane",
        "lastName": "Doe",
        "email": "jdoe@digitalriver.com",
        "phoneNumber": "952-253-1234",
        "address": {
            "line1": "87 Delaware",
            "line2": "Unit 2",
            "city": "Saint Paul",
            "state": "MN",
            "postalCode": "55107",
            "country": "US"
        }
    },
    "payPalBilling": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel"
    },
    "mandate": {
        "terms": "I agree to have my PayPal Billing information saved for future use"
    },
    "usage": "subscription"
};
digitalriver.createSource(data).then(function(result) {
    if (result.error) {
        //handle errors
    } else {
        var source = result.source;
        //send source to back end
        sendToBackend(source);
    }
});

PayPal billing source example

{
    "clientId": "gc",
    "channelId": "drdod15",
    "liveMode": false,
    "id": "d6a44e5d-1373-4013-847d-10deb4ded4df",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",    
    "clientSecret": "d6a44e5d-1373-4013-847d-10deb4ded4df_accd4e5d-1373-4013-847d-10deb4ded4df",
    "type": "payPalBilling",
    "reusable": false,
    "amount": "10.00",
    "currency": "USD",
    "state": "pending",
    "creationIp": "209.87.178.4",
    "createdTime": "2019-05-22T00:00:46.975Z",
    "updatedTime": "2019-05-22T00:00:46.975Z",
    "flow": "redirect",
    "redirect": {
        "redirectUrl": "https://api.digitalriver.com:443/payments/redirects/b8f2207b-8236-4608-b5a2-812790d42ed8?apiKey=pk_test_6cb0fe9ce3124093a9ad906f6c589e2ds",
        "returnUrl": "https://example.com?action=paymentSuccess",
        "cancelUrl": "https://example.com?action=paymentFailure"
    },
    "payPalBilling": {
        "shipping": {
            "recipient": "John Doe",
            "phoneNumber": "555-555-1212",
            "address": {
                "line1": "10380 Bren Road W",
                "line2": "",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55343"
            }
        },
        "token": "EC-1HD67063RG318840B"
    }
}

Step 3: Authorize a PayPal Billing Agreement source

When you create a PayPal Billing Agreement source, the customer is required to authorize the charge through PayPal. You can accomplish this by either redirecting the customer to PayPal or using the PayPal SDK to authorize the charge as part of your experience.

Redirecting the customer to PayPal for authorization

To redirect your customer to PayPal for authorization, use the redirectUrl parameter in your createSource response.

window.location.href = sourceResponse.redirect.redirectUrl;

PayPal will present the customer with the transaction details where they can authorize, or cancel the transaction. A successful authorization redirects the customer to the PayPal Return URL parameter you specified when you created the source. If the customer cancels, they will return to the PayPal Cancel URL parameter you specified when you created the source.

Using the PayPal SDK to authorize payment

Use the PayPal Checkout SDK to streamline the authorizing PayPal transactions. This will allow you to control things like the appearance of the PayPal button and embed the entire experience into your workflow.

Example:

  1. Include the PayPal Checkout SDK on your page and specify a location where the button will appear.

  2. Use the PayPal SDK to customize and place the PayPal button on your page. The PayPal SDK returns two functions, onAuthorize and onCancel. If the payment was authorized, attach the source you created earlier to a shopper or customer.

var paypalSourceData = {
    "type": "payPalBilling",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPalBilling": {
        "returnUrl": redirectUrl,
        "cancelUrl": cancelUrl,
    }
};
 
paypal.Button.render({
    // Configure environment
    env: 'sandbox',
    // Customize button (optional)
    locale: 'en_US',
    style: {
        label: 'checkout',
        size: 'responsive',
        color: 'gold',
        shape: 'rect',
        layout: 'horizontal',
        fundingicons: 'false',
        tagline: 'false'
    },
    // Set up a payment
    payment: function(data, actions) {
        return digitalriver.createSource(paypalSourceData).then(function(result) {
            if (result.error) {
                //handle the errors that were returned
                handleErrors(result.error)
            } else {
                return result.source.payPal.token;
            }
        });
    },
    // Execute the payment
    onAuthorize: function(data, actions) {
        //the payment has been authorized, use the source and attach it to your customer's account.
        doSomething();
    },
    onCancel: function(data) {
        //the payment has been cancelled, do something to try and get the shopper back on track
        doSomethingElse();
    }
}, '#paypal-button');

Step 4: Use the authorized source

Option 1: Attach the source to a checkout

{
  "customerId": "5774321008",
  "sourceId": "src_a78cfeae-f7ae-4719-8e1c-d05ec04e4d37"
}

Option 2: Attach the source to a customer

{
  "id": "5774321008",
  "sourceId": "src_a78cfeae-f7ae-4719-8e1c-d05ec04e4d37"
}

Testing PayPal Billing Agreement

PayPal Pay Later

PayPal Pay in 3

PayPal Pay in 3 is a short-term card installment payment option automatically provided by PayPal Express Checkout Wallet when a customer signs in to PayPal Checkout. Presents within the PayPal wallet on a category known as "Pay Later". Note that PayPal Pay in 3 does not support recurring subscriptions. Presenting this payment method in the PayPal Express Checkout Wallet requires no additional setup. If the shopper's purchase history along with the items in checkout qualify, PayPal Pay in 3 will be available as a payment method.

PayPal Pay in 3 allows shoppers to pay for physical good purchases as follows:

  • United Kingdom: three interest-free monthly payments for purchases between £45 and £2,000, with the first payment due at checkout.

When a customer selects this payment method, a "soft hit" will appear in their credit report.

PayPal Pay in 4

PayPal Pay in 4 is a pay-later option dynamically available through PayPal Express Checkout Wallet. It is presented within the PayPal wallet under a category known as "Pay Later." Note that PayPal Pay in 4 does not support recurring subscriptions. Presenting this payment method in the PayPal Express Checkout Wallet requires no additional setup. If the shopper's purchase history and the items in checkout qualify, PayPal Pay in 4 will be available as a payment method.

PayPal Pay in 4 allows shoppers to pay for physical good purchases as follows:

  • France: Four interest-free monthly payments for purchases between €30 and €2,000, with the first payment due at checkout.

  • United States: Four interest-free biweekly payments for purchases between $30 and $600, with the first payment due at checkout.

  • Australia: Four interest-free biweekly payments for purchases between AUD $50 and $1,500, with the first payment due at checkout.

When a customer selects this payment method, a "soft hit" will appear in their credit report.

PayPal RatenZahlung

PayPal RatenZahlung is a pay-later option available through PayPal Express Checkout Wallet. It is presented within the PayPal wallet in a category known as "Pay Later." Note that PayPal RatenZahlung does not support recurring subscriptions. Presenting this payment method in the PayPal Express Checkout Wallet requires no additional setup. If the shopper's purchase history and the items in the checkout qualify, PayPal RatenZahlung will be available as a payment method. PayPal RatenZahlung allows shoppers to pay for physical good purchases as follows:

  • Germany: The shopper selects three, six, twelve, or twenty-four monthly payments with an interest rate of 9.99% for purchases between €99 and €5,000, with the first payment due at checkout.

PayPal Credit

Additional setup required: If you want to use PayPal Credit, contact your Account Manager. After you sign the client addendum, the Account Manager will send instructions for setting up PayPal Credit banners.

PayPal Credit allows consumers to buy online and pay later for their products. This payment method is accepted in thousands of online stores and is available everywhere PayPal is accepted (as long as the PayPal Credit and PayPal accounts are linked). PayPal Credit uses the date of birth and last 4 digits of SSN to approve or deny a consumer for a line of credit, and the applicant will be notified within seconds whether they have been approved or not.

Create a PayPal payment method for your app or website in four easy steps:

Step 1: Build a Credit source request object

A PayPal billing credit source request object requires the following fields.

Field
Value

type

payPalCredit

sessionId

The payment session identifier.

payPalCredit

Step 2: Create a PayPal Credit source using DigitalRiver.js

Use the DigitalRiver.js library to create and mount elements to the HTML container.

var data = {
    "type": "payPalCredit",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPal": {
        "returnUrl": "http://mypage.com",
        "cancelUrl": "https://mypage.com/cancel"
    }
}

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

PayPal Credit source response example

{
    "clientId": "gc",
    "channelId": "drdod15",
    "liveMode": false,
    "id": "d6a44e5d-1373-4013-847d-10deb4ded4df",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",    
    "clientSecret": "d6a44e5d-1373-4013-847d-10deb4ded4df_ssdd4e5d-1373-4013-847d-10deb4ded4df",
    "type": "payPal",
    "reusable": false,
    "amount": "120.99",
    "currency": "USD",
    "state": "pending_redirect",
    "creationIp": "209.87.178.4",
    "createdTime": "2019-05-22T00:00:46.975Z",
    "updatedTime": "2019-05-22T00:00:46.975Z",
    "flow": "redirect",
    "redirect": {
        "redirectUrl": "https://api.digitalriver.com:443/payments/redirects/b8f2207b-8236-4608-b5a2-812790d42ed8?apiKey=pk_test_6cb0fe9ce3124093a9ad906f6c589e2ds",
        "returnUrl": "https://example.com?action=paymentSuccess",
        "cancelUrl": "https://example.com?action=paymentFailure"
    },
    "payPalCredit": {
        "shipping": {
            "recipient": "John Doe",
            "phoneNumber": "555-555-1212",
            "address": {
                "line1": "54321 Fake St.",
                "line2": "Apt. 3C",
                "city": "Minnetonka",
                "state": "MN",
                "country": "US",
                "postalCode": "55341"
            }
        },
        "token": "EC-1HD67063RG318840B"
    }
}

Step 3: Authorize a PayPal Credit source

When you create a PayPal Credit source, the customer must authorize the charge at PayPal. You can accomplish this by either redirecting the customer to PayPal or using the PayPal SDK to authorize the charge as part of your experience.

Redirecting the customer to PayPal for authorization

To redirect your customer to PayPal for authorization, use the redirectUrl parameter in your createSource response.

window.location.href = sourceResponse.redirect.redirectUrl;

PayPal will present the customer with the transaction details where they can authorize or cancel the transaction. A successful authorization redirects the customer to the PayPal Return URL parameter you specified when you created the source. If the customer cancels, they will return to the PayPal Cancel URL parameter you specified when you created the source.

Using the PayPal SDK to authorize payment

Use the PayPal Checkout SDK to streamline the authorizing PayPal transactions. This will allow you to control things like the appearance of the PayPal button and embed the entire experience into your workflow.

Example:

  1. Include the PayPal Checkout SDK on your page and specify a location where the button will appear.

```markup
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<div id="paypal-button"></div>
```
```javascript
var paypalSourceData = {
    "type": "payPal",
    "sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
    "payPal": {
        "returnUrl": redirectUrl,
        "cancelUrl": cancelUrl
    }
};
 
paypal.Button.render({
    // Configure environment
    env: 'sandbox',
    // Customize button (optional)
    locale: 'en_US',
    style: {
        label: 'credit',
        size: 'responsive',
        color: 'blue',
        shape: 'rect',
        layout: 'horizontal',
        fundingicons: 'false',
        tagline: 'false'
    },
    // Set up a payment
    payment: function(data, actions) {
        return digitalriver.createSource(paypalSourceData).then(function(result) {
            if (result.error) {
                //handle the errors that were returned
                handleErrors(result.error)
            } else {
                return result.source.payPalCredit.token;
            }
        });
    },
    // Execute the payment
    onAuthorize: function(data, actions) {
        //the payment has been authorized, use the source and attach it to your customer's account.
        doSomething();
    },
    onCancel: function(data) {
        //the payment has been cancelled, do something to try and get the shopper back on track
        doSomethingElse();
    }
}, '#paypal-button');
```
  1. Include the PayPal Checkout SDK on your page and specify a location where the button will appear.

```markup
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<div id="paypal-button"></div>
```
   var paypalSourceData = {
       "type": "payPal",
       "amount": 10,
       "currency": "USD",
       }
   };

   paypal.Button.render({
       // Configure environment
       env: 'sandbox',
       // Customize button (optional)
       locale: 'en_US',
       style: {
           label: 'credit',
           size: 'responsive',
           color: 'blue',
           shape: 'rect',
           layout: 'horizontal',
           fundingicons: 'false',
           tagline: 'false'
       },
       // Set up a payment
       payment: function(data, actions) {
           return digitalriver.createSource(paypalSourceData).then(function(result) {
               if (result.error) {
                   //handle the errors that were returned
                   handleErrors(result.error)
               } else {
                   return result.source.payPalCredit.token;
               }
           });
       },
       // Execute the payment
       onAuthorize: function(data, actions) {
           //the payment has been authorized, use the source and attach it to your customer's account.
           doSomething();
       },
       onCancel: function(data) {
           //the payment has been cancelled, do something to try and get the shopper back on track
           doSomethingElse();
       }
   }, '#paypal-button');
 
paypal.Button.render({
    // Configure environment
    env: 'sandbox',
    // Customize button (optional)
    locale: 'en_US',
    style: {
        label: 'credit',
        size: 'responsive',
        color: 'blue',
        shape: 'rect',
        layout: 'horizontal',
        fundingicons: 'false',
        tagline: 'false'
    },
    // Set up a payment
    payment: function(data, actions) {
        return digitalriver.createSource(paypalSourceData).then(function(result) {
            if (result.error) {
                //handle the errors that were returned
                handleErrors(result.error)
            } else {
                return result.source.payPalCredit.token;
            }
        });
    },
    // Execute the payment
    onAuthorize: function(data, actions) {
        //the payment has been authorized, use the source and attach it to your customer's account.
        doSomething();
    },
    onCancel: function(data) {
        //the payment has been cancelled, do something to try and get the shopper back on track
        doSomethingElse();
    }
}, '#paypal-button');

Step 4: Use the Authorized source

{
  "customerId": "5774321008",
  "sourceId": "src_a78cfeae-f7ae-4719-8e1c-d05ec04e4d37"
}

Testing PayPal Pay Later

A that includes the details of the transaction.

The address object must contain and data that .

The PayPal SDK guide is located here:

More details on how you can customize the PayPal button are located here:

Use the PayPal SDK to customize and place the PayPal button on your page. The PayPal SDK returns two functions, onAuthorize and onCancel. If the payment was authorized, .

Once authorized, you can use the source by .

See for testing instructions.

You can find an example of the integration .

A that includes the details of the transaction.

See for a description of the payPalBilling object's required fields

The address object must contain and data that .

The PayPal SDK guide is located here:

More details on how you can customize the PayPal button are located here:

Once authorized, you can use the source by or for multiple uses.

See for testing instructions.

Additional setup optional: If you want to promote Pay in 3, contact your Customer Success Representative. The Representative will provide the set-up instructions for Pay in 3 banners. Click to access the upstream promotional banners.

Additional setup optional: If you want to promote Pay in 4, contact your Customer Success Representative. The Representative will provide the set-up instructions for Pay in 4 banners. Click to access the upstream promotional banners.

A that includes the details of the transaction.

See for a description of the payPalBilling object's required fields

The address object must contain and data that .

The PayPal SDK guide is located here:

For more details on how you can customize the PayPal button, go to

Use the PayPal SDK to customize and place the PayPal button on your page. The PayPal SDK returns two functions, onAuthorize and onCancel. If the payment was authorized, attach the source you created earlier .

Use the PayPal SDK to customize and place the PayPal button on your page. The PayPal SDK returns two functions, onAuthorize and onCancel. If the payment was authorized, attach the source you created earlier .

Once authorized, you can use the source by .

See for testing instructions.

https://developer.paypal.com/docs/archive/checkout/
https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#
here
https://developer.paypal.com/docs/archive/checkout/
https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#
here
here
https://developer.paypal.com/docs/archive/checkout/
https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#
here
DigitalRiver.js with Elements
PayPal
PayPal Express Checkout
PayPal Billing Agreement
PayPal Pay in 3
PayPal Pay in 4
PayPal RatenZahlung
PayPal Credit
PayPal Billing Agreement
Step 1: Build the PayPal objects
Step 2: Create a PayPal source using DigitalRiver.js
Step 3: Authorize a PayPay source
Step 4: Use the authorized source
Step 1: Build a PayPal Billing Agreement source request object
Step 2: Create a PayPal Billing Agreement source using DigitalRiver.js
Step 3: Authorize a PayPal Billing Agreement source
Step 4: Use the authorized source
PayPal source request object
Step 1: Build a PayPal Credit source request object
Step 2: Create a PayPal Credit source using DigitalRiver.js
Step 3: Authorize a PayPal Credit source
Step 4: Use the authorized source
PayPal source request object
PayPal Source Details object
PayPal source details object
PayPal Source Details object
attach the source you created earlier to the checkout
attaching it to a checkout
attaching it to a checkout
attaching it to a customer or shopper
to checkout
to checkout
attaching it to a checkout
Testing redirect payment methods
Testing redirect payment methods
Testing redirect payment methods
postal code
state/province
adhere to a standardized format
postal code
state/province
adhere to a standardized format
postal code
state/province
adhere to a standardized format
PayPal login
PayPal login