Charlie Gerard
Posted on July 18, 2023
We recently made PayPal available as a payment method in the EU, UK, and Switzerland, so you can now offer an additional way for your customers to submit payments using their PayPal account.
If you have a Connect account, first reach out to the support team to see if you’re eligible. If you’re a direct merchant, meaning you accept payments directly from consumers, let’s go through the steps to enable it.
Requirements
This feature is only available for Stripe accounts set in the European Economic Area (with the exception of Hungary), the UK, and Switzerland. If your Stripe account is registered in another country, you will unfortunately not be able to activate PayPal at this time.
You’re also required to have a PayPal business account in the EEA, Switzerland or UK. You can create one during the onboarding process.
Enabling PayPal
To enable the PayPal feature in the Stripe Dashboard, navigate to the Payments settings page. If you’re eligible, you should see “PayPal” as an option under the “Wallets” section.
Click the “Turn on” button to start the onboarding process.
Confirm that your account meets all the requirements and click “Continue”.
Then, select where you’d like to keep your PayPal funds and click the “Connect to PayPal” button to connect and activate your accounts.
Alternatively you can choose to settle your funds into your PayPal account instead:
When you are redirected to PayPal, you can either log into an existing account or create a new one as part of the process. As mentioned in the previous section, your PayPal account needs to be a business account in the EEA, Switzerland or the UK.
Once this step is done, if you logged into an existing account, you should see a green checkmark on the right of the payment method to indicate that your PayPal account has been successfully connected to Stripe.
From there, you can enable or disable recurring payments as well as contact support if you need to change how your funds are settled.
If you created a new account as part of the onboarding flow, it will first be pending approval until you verify your email.
You can turn this payment method off at any time by opening the details dropdown and clicking the “Turn off” button in the Stripe Dashboard.
If you’re mostly using Stripe’s no-code products such as Payment Links, this is all you need to do. PayPal will now be a payment option for all your customers.
Integrating PayPal
No-code solution
Once you’ve enabled PayPal on your account, you can test that the feature is working by navigating to your products page, selecting a product you created a Payment Link for, click on the “View payment link” button under the Pricing section, copy the link, and open it in your browser. You should see PayPal displayed as a payment method.
Your customer will then be guided through PayPal’s UI to confirm the payment.
Checkout integration
Integrating PayPal as a payment method using the Stripe API requires minimal changes to your code.
First, if you’re using Checkout, locate where you are creating a Checkout session in your codebase. If you are already specifying different payment methods using the payment_method_types
attribute, all you need to do is add paypal
to your array.
const session = await stripe.checkout.sessions.create({
mode: "payment",
payment_method_types: ["card", "paypal"],
line_items: [
{
price: process.env.PRICE,
quantity: 1,
},
],
success_url: `${domainURL}/success.html?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${domainURL}/canceled.html`,
});
By default, if you don’t specify any payment method types, it will display all payment methods enabled, including PayPal.
const session = await stripe.checkout.sessions.create({
mode: "payment",
line_items: [
{
price: process.env.PRICE,
quantity: 1,
},
],
success_url: `${domainURL}/success.html?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${domainURL}/canceled.html`,
});
Payment Element and Express Checkout Element integration
If you’re using Payment Element or Express Checkout Element, locate where you are creating the PaymentIntent
. If you have the attribute automatic_payment_methods
set to enabled, PayPal will show up as an option automatically. Otherwise, if you’re using the payment_method_types
attribute to customize the options, you’ll only need to add paypal
to the array and you’ll be good to go.
const paymentIntent = await stripe.paymentIntents.create({
amount: 1999,
currency: currency,
payment_method_types: ['card', 'paypal']
});
These code samples shown above are using Node.js, but the change is very similar in other programming languages. If you want to read more, please check the docs.
Issuing refunds
If you need to issue a refund to a customer who paid using PayPal, navigate to the payments page in the Stripe Dashboard, select the payment you’d like to issue the refund for, click on the refund button, and confirm the refund in the pop-up displayed.
Conclusion
If you have a Stripe account registered in the EU, UK, or Switzerland, you can now enable PayPal as a payment method with Stripe with a few clicks and some minor code changes. This feature will allow you to reach more potential customers and provide them with a better checkout experience. If you’re interested in learning more, check out our docs.
About the author
Charlie Gerard is a developer advocate at Stripe, a published author and a creative technologist. She loves researching and experimenting with technologies. When she’s not coding, she enjoys spending time outdoors, reading, and setting random challenges for herself.
Posted on July 18, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 21, 2024
October 14, 2024