JavaScript v2
PayPal
Options
The PayPal functionality of Braintree.js accepts a few different options. The below options can be
used for all PayPal integration types (Vault, Checkout with PayPal).
custom
or dropin
setup, you must specify
paypal
as its own object and nest the following configuration under it. For an
example, see our
Drop-in guide.
Client option | Description |
container | Required The id, native DOM element, or jQuery object specifying where on your page the PayPal button should be placed. |
paymentMethodNonceInputField |
The ID, native DOM element, or jQuery object specifying an input field that the client will
write the resulting
HTML
|
displayName | String The merchant name displayed inside of the PayPal lightbox; defaults to the company name on your Braintree account. |
singleUse | Boolean Defaults to {false}, but can be set to {true} to trigger the Checkout flow. |
intent | String
Applies to
Checkout flows
(
|
onUnsupported | Function A callback function that is fired for any error that can occur during the PayPal flow (e.g. if the customer's browser does not support the Checkout flow). This callback is not available in the Drop-in UI. |
onCancelled | Function A callback function that is fired when the customer clicks the "Cancel" button rendered on your page after successfully completing the PayPal flow. This callback is not available in the Drop-in UI. |
onSuccess | Deprecated Function
A callback function that is fired immediately after a user has logged in to PayPal; it is
not fired upon form submission like
|
onAuthorizationDismissed | Function A callback function that is fired when the customer cancels or closes out of the PayPal flow before successful completion. This is available in versions 2.18.0 and above. This callback is not available in the Drop-in UI. |
enableShippingAddress | Boolean
Returns a shipping address object in the
|
shippingAddressOverride | Object Allows you to pass a shipping address you have already collected into the PayPal payment flow. Full examples on Vault and Checkout pages. You can pass in the following parameters:
|
enableBillingAddress | Boolean
Required to retrieve a
|
amount | Float Required to invoke the Checkout flow. The amount of the transaction should be passed here. |
currency | String Required to invoke the Checkout flow. |
locale | String
Use this option to change the language, links, and terminology of the PayPal flow. This
locale will be used unless the buyer has set a preferred locale for their account. If no
locale is passed, a fallback locale will be used. Can be used in our
Vault
or
Checkout
flows. |
headless | Boolean
Use this option if you would like to use your own custom UI to launch the PayPal flow.
Defaults to
|
billingAgreementDescription | String Use this option to set the description of the pre-approved payment agreement visible to customers in their PayPal profile. Maximum 255 characters. Only available in versions 2.21.0 and higher. |