Broadleaf Microservices
  • v1.0.0-latest-prod

Using PayPal as a Digital wallet

Braintree supports the ability to use PayPal as a digital wallet, while processing transactions via Braintree.

In short, via the Braintree Drop-in UI, we’re able to gather a nonce representing one of the customer’s payment methods that is stored via PayPal. Once we’ve obtained this nonce, all transaction interactions mimic what’s done for any other nonce that we might obtain from the Drop-in UI.

Braintree Dashboard Configuration

To enable PayPal with Braintree’s Drop-in UI, you must first enable it via the Braintree dashboard.

To test this integration, you will need to link you PayPal sandbox account to your Braintree sandbox account.

  1. Log into your Braintree sandbox Control Panel

  2. Navigate to Settings > Processing > Payment Methods > PayPal

  3. Click Link Sandbox

  4. Enter the Email address, Client ID, and Client Secret for your PayPal sandbox test account

  5. Click Link PayPal Sandbox

Cart Operation Service Configuration

Add the following properties to declare PayPal processed via BRAINTREE as an available payment method option in checkout.

broadleaf:
  cartoperation:
    service:
      checkout:
        checkout-payment-method-options:
          - payment-method-type: PAYPAL
            payment-method-gateway-type: BRAINTREE

How to Gather a PayPal Nonce via the Drop-in UI

If you have PayPal configured in your dashboard, include the PayPal configuration object in your Drop-in create call to render PayPal as an available payment option.

Drop-in UI supports several styles of PayPal interactions. The following example uses the checkout flow:

braintree.dropin.create({
  ...
  paypal: {
    flow: 'checkout',
    amount: '10.00',
    currency: 'USD'
  }
});

Call requestPaymentMethod to get a PayPal payment method payload, which includes a payment method nonce to send to your server at payload.nonce.