PayPal: Drop In Guide
Integrate PayPal on your website or mobile application with just a few lines of code.
Before you begin
This guide assumes that you know how to
Accept payments with PayPal
Prepare the client session
PayPal requires the following data to process a payment successfully. Pass the following data in the client session, or in the payment request (for manual payment creation).
Parameter Name | Required | Description |
---|---|---|
currencyCode | ✓ | 3-letter currency code in ISO 4217 format, e.g. USD for US dollars |
order ↳ lineItems | ✓ | Details of the line items of the order |
order ↳ countryCode | ✓ | The country code of the user is required for PayPal. |
metadata ↳ paypal_custom_id | Primers direct integration to PayPal enables you send a custom ID to paypal to link your orders to a specific custom ID. | |
metadata ↳ paypal_invoice_id | Primers direct integration to PayPal enables you send a Invoice ID to paypal to link your orders to a specific invoice ID. | |
paypal_client_metadata_id | ✓ | Required field if the Billing Agreement is being created. |
Prepare the SDK for payments
Pre-requisites
If your website uses Content Security Policy, make sure to add the following rules:
Policy | Origin |
---|---|
frame-src | c.paypal.com |
child-src | c.paypal.com |
script-src | c.paypal.com |
Show Universal Checkout
PayPal is automatically presented to the customer when calling Primer.showUniversalCheckout.
Customization
Check the Customization Guide to learn how to customize payment method buttons.
Additionally, you can style the PayPal button by passing the following options:
Limitations
The button provided by PayPal has a maximum width of 750px. This value is hardcoded by PayPal and cannot be updated. We encourage you to limit the the width of the checkout to 750px to have consistent payment method buttons.
Troubleshooting
If the PayPal button fails to appear, check that a valid countryCode
has been provided in the client session.
If PayPal fails to render when the button is clicked, open your Developer Inspector - PayPal usually prints an error there.
Vaulting
Vaulting PayPal requires the Billing Agreement API to be activated on your account. Get in touch with your account manager at PayPal to activate this feature.
In order to be approved by PayPal for Billing Agreements, you may be required to collect device data using their Fraudnet/Magnes library and pass a user session identifier to PayPal during the transaction. This can be done by passing this as metadata.paypal_client_metadata_id in the Primer Client Session/Payment API.
In order to vault PayPal accounts, pass the following data in the Client Session:
Parameter Name | Required | Description |
---|---|---|
customerId | Yes | A unique identifier for your customer |
Pre-requisites
If your website uses Content Security Policy, make sure to add the following rules:
Policy | Origin |
---|---|
frame-src | c.paypal.com |
child-src | c.paypal.com |
script-src | c.paypal.com |
Show Universal Checkout
PayPal is automatically presented to the customer when calling Primer.showUniversalCheckout.
Customization
Check the Customization Guide to learn how to customize payment method buttons.
Additionally, you can style the PayPal button by passing the following options:
Limitations
The button provided by PayPal has a maximum width of 750px. This value is hardcoded by PayPal and cannot be updated. We encourage you to limit the the width of the checkout to 750px to have consistent payment method buttons.
Troubleshooting
If the PayPal button fails to appear, check that a valid countryCode
has been provided in the client session.
If PayPal fails to render when the button is clicked, open your Developer Inspector - PayPal usually prints an error there.
Vaulting
Vaulting PayPal requires the Billing Agreement API to be activated on your account. Get in touch with your account manager at PayPal to activate this feature.
In order to be approved by PayPal for Billing Agreements, you may be required to collect device data using their Fraudnet/Magnes library and pass a user session identifier to PayPal during the transaction. This can be done by passing this as metadata.paypal_client_metadata_id in the Primer Client Session/Payment API.
In order to vault PayPal accounts, pass the following data in the Client Session:
Parameter Name | Required | Description |
---|---|---|
customerId | Yes | A unique identifier for your customer |
Pre-requisites
Step 1: Add a URL scheme
PayPal on iOS makes use of deep links to bring the user back to your app.
Navigate in the Info tab in your project’s target settings, and add a URL type and give it a URL scheme value, e.g. merchant
.

Step 2: Configure Primer settings
Once the URL scheme is added in your project, pass it to the PrimerSettings object along with the rest of you settings.
Show Universal Checkout
PayPal is automatically presented to the customer when calling Primer.shared.showUniversalCheckout
.
Customization
Check the customization guide to learn how to customize Universal Checkout.
Vaulting
Vaulting PayPal requires the Billing Agreement API to be activated on your account. Get in touch with your account manager at PayPal to activate this feature.
In order to be approved by PayPal for Billing Agreements, you may be required to collect device data using their Fraudnet/Magnes library and pass a user session identifier to PayPal during the transaction. This can be done by passing this as metadata.paypal_client_metadata_id in the Primer Client Session/Payment API.
In order to vault PayPal accounts, pass the following data in the Client Session:
Parameter Name | Required | Description |
---|---|---|
customerId | ✓ | A unique identifier for your customer |
Pre-requisites
PayPal requires the SDK to open a browser to allow the customer to authenticate and approve their order. To prepare your app for that, add this to your AndroidManifest.xml
The applicationId
is defined as part of your defaultConfig
, on your app’s build.gradle
file. You can find more about it here.
⚠️
Please note that some payment method flows require that your applicationId
is composed of only lowercase letters. In order to easily support this you can use the manifest placeholder below.
and change the configuration above to:
This way your applicationId
remains unchanged and yet the intent-filter
will support all configured payment methods.
Show Universal Checkout
Customization
Check the customization guide to learn how to customize Universal Checkout.
Vaulting
Vaulting PayPal requires the Billing Agreement API to be activated on your account. Get in touch with your account manager at PayPal to activate this feature.
In order to be approved by PayPal for Billing Agreements, you may be required to collect device data using their Fraudnet/Magnes library and pass a user session identifier to PayPal during the transaction. This can be done by passing this as metadata.paypal_client_metadata_id in the Primer Client Session/Payment API.
In order to vault PayPal accounts, pass the following data in the Client Session:
Parameter Name | Required | Description |
---|---|---|
customerId | ✓ | A unique identifier for your customer |
Pre-requisites
iOS
To render the ‘PayPal’ button go to the ./ios
directory of your React Native project and open the .xcworkspace
file with Xcode. Go to the info tab in the project folder and add a custom URL type like this:

Finally, go to the settings
object in your javascript code once again and add the newly created URL type scheme and its identifier:
Android
PayPal requires an authentication step that is completed in an external browser view. To support this, open ./android/app/src/main/AndroidManifest.xml
in your project, then add the following:
Finally, go to the settings
object in your javascript code once again and add the newly created URL type scheme and its identifier:
Show Universal Checkout
PayPal is automatically presented to the customer when calling Primer.showUniversalCheckout
.
Customization
Check the customization guide to learn how to customize Universal Checkout.
Vaulting
Vaulting PayPal requires the Billing Agreement API to be activated on your account. Get in touch with your account manager at PayPal to activate this feature.
In order to be approved by PayPal for Billing Agreements, you may be required to collect device data using their Fraudnet/Magnes library and pass a user session identifier to PayPal during the transaction. This can be done by passing this as metadata.paypal_client_metadata_id in the Primer Client Session/Payment API.
In order to vault PayPal accounts, pass the following data in the Client Session:
Parameter Name | Required | Description |
---|---|---|
customerId | Yes | A unique identifier for your customer |
Pre-requisites
If your website uses Content Security Policy, make sure to add the following rules:
Policy | Origin |
---|---|
frame-src | c.paypal.com |
child-src | c.paypal.com |
script-src | c.paypal.com |
Show Universal Checkout
PayPal is automatically presented to the customer when calling Primer.showUniversalCheckout
.
Customization
Check the Customization Guide to learn how to customize payment method buttons.
Vaulting
Vaulting PayPal requires the Billing Agreement API to be activated on your account. Get in touch with your account manager at PayPal to activate this feature.
In order to be approved by PayPal for Billing Agreements, you may be required to collect device data using their Fraudnet/Magnes library and pass a user session identifier to PayPal during the transaction. This can be done by passing this as metadata.paypal_client_metadata_id in the Primer Client Session/Payment API.
In order to vault PayPal accounts, pass the following data in the Client Session:
Parameter Name | Required | Description |
---|---|---|
customerId | ✓ | A unique identifier for your customer |
Prepare the SDK for vaulting
When showing drop-in checkout, set the option paymentFlow
to PREFER_VAULT
.
Test
When testing PayPal in your Primer Sandbox, make sure to use a PayPal sandbox account, not your own PayPal account. Go to PayPal’s Developer Dashboard to manage your sandbox accounts.
Go live
You don’t need to do anything particular to go live! Just make sure to use the Production credentials!
When showing drop-in checkout, set the option paymentFlow
to PREFER_VAULT
.
Test
When testing PayPal in your Primer Sandbox, make sure to use a PayPal sandbox account, not your own PayPal account. Go to PayPal’s Developer Dashboard to manage your sandbox accounts.
Go live
You don’t need to do anything particular to go live! Just make sure to use the Production credentials!
Test
When testing PayPal in your Primer Sandbox, make sure to use a PayPal sandbox account, not your own PayPal account. Go to PayPal’s Developer Dashboard to manage your sandbox accounts.
Go live
You don’t need to do anything particular to go live! Just make sure to use the Production credentials!
Test
When testing PayPal in your Primer Sandbox, make sure to use a PayPal sandbox account, not your own PayPal account. Go to PayPal’s Developer Dashboard to manage your sandbox accounts.
Go live
You don’t need to do anything particular to go live! Just make sure to use the Production credentials!