LogoLogo
System Status
  • Commerce API
    • Test and use cases
    • Roles and permissions
    • Sending API calls
  • Shopper APIs
    • Shopper basics
      • Common use cases
        • Creating a customer
        • Applying store credit
        • Private store workflow
        • Guest checkout
    • OAuth
      • Authentication
      • OAuth 2.0 APIs
      • Token
      • Access tokens
      • Session-aware access tokens
      • Authorizing a shopper
    • Shoppers
      • Managing shoppers
        • User management
        • Single sign-on (SSO)
        • Data validation
        • Bulk user management
        • Bulk user account export
      • Managing a shopper's account
      • Managing a shopper's address
      • Managing payment options
    • Product discovery
      • Categories
      • Products
      • Product variations
      • Pricing
      • Inventory status
      • Financing
      • Offers
        • Understanding offers
        • How to use point of promotions (POPs)
          • Retrieving all point of promotion offers for a specific product
          • Retrieving all offers for a specific point of promotion
        • How to use offers
      • Private stores
        • Managing private stores
        • Submitting an order for a private store
        • Useful APIs
      • Fulfillment
        • Electronic Fulfillment Service (OFI)
        • Digital rights
        • Digital rights revocation
        • Physical fulfillment
          • EDI X12 832 definition data elements
          • EDI X12 846 definition data elements
          • EDI X12 850 definition data elements
          • EDI X12 855 definition data elements
          • EDI X12 856 definition data elements
          • EDI X12 180-1 definition data elements
          • EDI X12 180-2 definition of data elements
          • EDI X12 180-3 definition of data elements
    • Cart
      • Applying a shopper to a cart
      • Getting the current cart
      • Creating or updating a cart
        • Adding a product to a cart
          • Gifting
        • Capturing the customer's IP address
        • Providing address information
        • Managing the shipping or billing address
        • Providing subscription information
        • Managing payment methods
        • Capturing the Terms of Sale (TOS) acceptance
      • Managing offers in a cart
        • Applying an offer
        • Applying a coupon or promo code
        • Getting all applied offers
        • Removing an applied offer
        • Removing eligible offers
        • Reconciling conflicting offers
        • Dynamic offers/personalization
          • Skipping Global Commerce merchandising offer arbitration
          • Triggering a promotional URL offer
          • Overriding a promotional URL offer discount
      • Pricing
        • Landed cost
          • Mixed cart support
          • Tax-included pretty price
      • Redirecting to a Digital River-hosted cart
      • Configuring taxes
        • Managing tax identifiers
      • Managing shipping options
        • Getting shipping options
        • Providing a shipping discount
      • Managing line items
      • Applying a price override
      • Managing payment sessions
      • Managing web checkout
      • Submitting a cart
        • Initiating a charge
        • Authorization declines
      • Resuming cart submission
      • HGOP2
    • Orders
      • Getting orders
      • Selling entities
      • Retrieving addresses from an order
      • Retrieving line items from an order
      • Order lookup
      • Returns
        • Initiate an authenticated session
        • Setting up returns in Global Commerce
        • Managing returns
    • Subscriptions
      • Retrieve the subscription
        • Getting all orders for a subscription
        • Getting a subscription's pending actions
        • Getting all subscriptions for a shopper
        • Getting a subscription by identifier
      • Update subscription at the next renewal
        • Changing the subscription renewal type
        • Changing the subscription renewal quantity
        • Adding or updating a perpetual unit price
        • Changing the subscription's payment option
        • Changing the subscription's payment source
      • Immediately change the subscription
        • Updating the subscription's shipping address
        • Updating a subscription's billing and shipping email address
        • Cancelling a subscription
      • Immediately apply a midterm subscription change
        • Reducing the subscription renewal quantity
  • Admin APIs
    • Admin basics
      • Available Admin API calls
    • Order management
      • Getting the order's details
      • Downloading the invoice
    • Offer management
    • Refund management
      • Authorization
      • Refund reason codes
      • Creating a satisfaction refund
      • Getting the available refunds for a specific order
      • Getting refunds for a specific order
      • Getting refunds available for a shopper's order
      • Getting the JSON schema for an order refund
      • Managing a refund for a delayed payment method
      • Refund error scenarios
    • Subscription management
      • Retrieve the subscription
        • Getting all orders for a subscription
        • Getting a subscription's pending actions
        • Getting all subscriptions for a shopper
        • Getting a subscription by identifier
      • Update the subscription at the next renewal
        • Changing the subscription renewal type
        • Changing the subscription renewal product
        • Changing the subscription renewal price
        • Changing the subscription renewal quantity
        • Adding or updating a perpetual unit price
        • Changing the subscription's payment option
        • Changing the subscription's payment source
      • Immediately change the subscription
        • Activating a subscription
        • Changing the subscription's external reference identifier
        • Updating a subscription's billing and shipping email address
        • Cancelling a subscription
        • Updating the subscription's expiration date
      • Immediately apply a midterm subscription change
        • Applying a midterm change with price override
        • Reducing the subscription renewal quantity
      • Subscription notifications
        • Updating the subscriber's email address
        • Card Account Updater
        • Sending a payment information change notification
        • Sending an expired credit card notification
        • Sending an invalid payment account notification
        • Sending a payment failure notification
        • Sending a subscription renewal reminder notification
        • Setting up subscription renewal reminders
        • Setting up trial subscription renewal reminders
        • Setting up marketing reminders
      • Using the Expired Card Optimizer
    • Customer management
      • Retrieving customer details
      • Requesting PII removal for a customer
    • Site management
      • Configuring authorized shipping and billing countries
      • Getting a site's authorized billing countries
      • Getting a site's authorized shipping countries
    • Product management
      • Getting started
      • Manage products (asynchronous API)
        • Creating or updating a product
        • Adding or updating a product variation
        • Deploying a product
        • Applying live changes
        • Retiring a product
        • Deleting a product variation
        • Deleting a base or individual product's locale
      • Retrieve products (synchronous API)
        • Getting a product by locale
        • Getting a product variation
        • Getting a product variation by locale
      • Get the task status for a product (synchronous API)
        • Getting the latest information on a product task
        • Retrieving the tasks for a specific product
        • Retrieving the tasks for products
      • Bulk operation
        • Asynchronous bulk operations
          • Creating products in bulk
          • Updating products in bulk
          • Deploying products in bulk
          • Deleting product variations in bulk
        • Bulk product upload (BPU)
        • Bulk Product Export (BPE)
          • Line-item level satisfaction refund
          • Order-level satisfaction refund
          • Auto-created line-item level return product
          • Line-item level return product
    • File management
      • Downloading a file
  • Payments
    • Payments 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 BLIK
          • Configuring Boleto
          • 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
      • BLIK
      • Boleto
      • CCAvenue
      • Clearpay
      • Credit Cards
      • FPX Online Banking
      • Google Pay
      • iDEAL
      • Klarna
      • Konbini
      • Korea Bank Transfer (Online Banking)
      • Online Banking (IBP)
      • 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
    • Building payment workflows
      • Flows by payment type
      • Handling redirect payment methods
    • PSD2 and SCA
    • Payment testing scenarios
      • Testing standard payment methods
      • Testing redirect payment methods
      • Testing receiver payment methods
      • Testing the CCAvenue payment method
  • Events
    • Events overview
    • Responding to events
    • Event types
      • Delayed payment event types
        • Delayed payment expired event
          • Boleto
          • Konbini
          • Wire Transfer
        • Delayed payment reminder event
          • Boleto
          • Konbini
          • Wire Transfer
      • Subscription event types
        • Subscription created event
        • Subscription updated event
        • Subscription action processed event
        • Subscription cancelled event
        • Subscription credit card expired event
        • Subscription payment information changed event
        • Subscription renewal reminder event
        • Subscription renewed event
        • Subscription trial converted event
        • Subscription trial renewal reminder event
        • Subscription payment failed event
      • Post-order event types
        • Invoice created event
        • Refund credit memo event
      • Inventory event types
        • Inventory out of stock event
        • Inventory source and management
        • Inventory self-managed updated event
        • Inventory fulfiller-managed updated event
      • Post-order Notification Integration Guide
    • Webhooks
      • Commerce API safelist
      • Searching for a webhook
      • Creating a webhook
      • Using webhooks
      • Editing a webhook
      • Turning webhooks on or off
      • Revealing a webhook's secret
      • Rotating a webhook's secret
      • Viewing the webhook details
      • Deleting a webhook
  • Developer Resources
    • Postman collection
    • Commerce API references
    • Shopper APIs reference
    • Admin APIs 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 element
        • Online Banking elements
        • Tax Identifier element
        • Delayed payment instructions element
        • PayPal elements
      • Guidelines for capturing payment details
      • Security
      • Digital River payment objects
      • Error types, codes, and objects
  • General resources
    • Global Commerce
    • Global Commerce
      • Company hierarchy
      • Categories
        • Getting a list of categories
      • Products
        • Product scenarios
        • Individual products
          • Creating an individual product
        • Base product with variants
          • Creating a base product with variants
        • Bundle offers
          • Creating a prorated bundle offer with a subscription
        • Product combination
          • Creating a product combination
        • Gifting
        • Inventory status
      • Customer service
        • Log a shopper's request to remove PII
      • Customers
        • Creating a customer
        • Digital River-maintained customer login
        • Client-maintained customer login
      • Transparent Commerce purchase flow
    • eCompass
    • eCompass documentation
    • Release notes
      • 2024
      • 2024 latest
      • 2023
      • 2022
      • 2021
      • 2020
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

Was this helpful?

  1. Payments
  2. Payments 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 4 months ago

Was this helpful?

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 the 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 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

Use the redirectUrl parameter in your createSource response to redirect your customer to PayPal for authorization.

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) {
        //If the payment has been authorized, attach the source 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

{
  "paymentMethod": {
    "sourceId": "e7ba0595-059c-460c-bad8-2812123b9313"
  }
}

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

Build the 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.

payPalBilling

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

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

var data = {
    "type": "payPalBilling",
    "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 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 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. Customers who cancel 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) {
        //If the payment has been authorized, attach the source 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 cart

{
  "paymentMethod": {
    "sourceId": "e7ba0595-059c-460c-bad8-2812123b9313"
  }
}

Option 2. Attach the source to a shopper

{
  "paymentOption": {
    "nickName": "My Token",
    "isDefault": "true",
    "sourceId": "61033d62-c0f4-4a7e-b844-07daf26ba84e"
  }
}

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 goods as follows:

  • United Kingdom: three interest-free monthly payments for purchases between £45 - £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 goods 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 goods 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

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 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. Customers who cancel 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.

    <script src="https://www.paypalobjects.com/api/checkout.js"></script>
    <div id="paypal-button"></div>
  2. 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');
  3. 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>
  4. z   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

{
  "paymentMethod": {
    "sourceId": "e7ba0595-059c-460c-bad8-2812123b9313"
  }
}

Testing PayPal Pay Later

A that includes the details of the transaction.

The address object must contain postal code and state/province data that using the state attribute. Note that the state attribute listed below corresponds to the countrySubdivision attribute used when providing address information. The payment session manages the correct field name on the backend.

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, attach the source you created earlier .

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 postal code and state/province data that using the state attribute. Note that the state attribute listed below corresponds to the countrySubdivision attribute used when providing address information. The payment session manages the correct field name on the backend.

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 .

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 postal code and state/province data that using the state attribute. Note that the state attribute listed below corresponds to the countrySubdivision attribute used when providing address information. The payment session manages the correct field name on the backend.

The PayPal SDK guide is located here:

For more details on how to attach 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, se 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.

adhere to a standardized format
https://developer.paypal.com/docs/archive/checkout/
https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#
here
adhere to a standardized format
https://developer.paypal.com/docs/archive/checkout/
https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#
here
here
adhere to a standardized format
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
Testing redirect payment methods
Testing redirect payment methods
Testing redirect payment methods
to an order or cart
attaching it to a cart
attaching it to a cart
a shopper
to attach it to an order or cart
to an order or cart
attaching it to a cart
PayPal login
PayPal login