# Set up PayPal

Connect PayPal to your platform, test a purchase in the sandbox, then go live. Buyers choose PayPal on the checkout next to Stripe.

PayPal runs next to Stripe. Buyers choose the payment method on the checkout. Your platform asks for the billing address, computes the VAT, applies the voucher and writes the invoice. With PayPal, the buyer only confirms the payment.

## What you need

- **Stripe is set up.** PayPal follows the Stripe mode: in test mode the platform uses the PayPal sandbox, in live mode your real PayPal account.
- **A PayPal business account.** Its login also opens the developer dashboard and the sandbox.
- **Your seller details** under **Admin**, **Products**, **Invoices**. Without them, the platform computes no VAT for PayPal.

## 1. Create two apps at PayPal

PayPal gives each mode its own keys. So you create one app for the sandbox and one for live.

1. Open the [PayPal developer dashboard](https://developer.paypal.com/dashboard/applications) and sign in with your PayPal business account.
2. Open **Apps & Credentials** and set the switch at the top to **Sandbox**.
3. Click **Create App**, enter a name (for example the name of your platform) and click **Create App**.
4. Copy the **Client ID** and the **Secret**.
5. Set the switch to **Live** and create a second app there in the same way. Copy its client ID and secret too.

## 2. Enter the keys

1. Open **Admin**, then **Integrations**, then the **PayPal** tab.
2. Paste the client ID and the secret of the live app into the fields without a suffix.
3. Paste the client ID and the secret of the sandbox app into the fields with **(sandbox)**.
4. Click **Save**.

A saved key shows only as dots with a check mark. The platform never shows it again.

## 3. Create the webhooks

PayPal reports payments, subscriptions, refunds and reversals to your platform through a webhook.

1. On the **PayPal** tab, click **Set up PayPal**.
2. The platform creates its webhook in each mode that has keys, so in the sandbox and in live. You do not enter the webhook at PayPal yourself.

Above the button you then see the state, for example: **Live: on. Test: on. Buyers see PayPal on the checkout (live mode).** A mode shows **keys missing** while its keys are missing, and **keys in, click "Set up PayPal"** while its webhook is missing.

You can click **Set up PayPal** again at any time, for example after new keys. A webhook that already fits stays as it is.

## 4. Check the VAT

For Stripe payments, Stripe Tax computes the VAT. For PayPal, your platform computes it from your seller details under **Admin**, **Products**, **Invoices**:

- **Seat in the EU, no OSS:** buyers pay the VAT of your country.
- **With OSS (Union OSS or non-Union OSS), from its start:** private buyers in the EU pay the VAT of their country.
- **Seat outside the EU, no OSS:** buyers pay no VAT.
- **Businesses with a VAT ID from another EU country:** the platform checks the number with VIES. If it is valid, reverse charge applies.

PayPal shows the buyer the amount with the VAT that the checkout computed. If the VAT is missing there, check the OSS scheme and its start. Test mode and live mode use the same seller details.

## 5. Test in the sandbox

Test the flow in the sandbox. No real money moves there.

1. Open **Admin**, then **Integrations**, then **Stripe**. Under **Mode**, choose **Test** and click **Switch**. The **PayPal** tab then shows **Buyers see PayPal on the checkout (test mode)**.
2. In the PayPal developer dashboard, open **Testing Tools**, then **Sandbox Accounts**. PayPal has already created an account of the type **Personal** there. Under **View/Edit Account** you find its email address and its password.
3. Open the order address of a plan, for example `/buy/<product>/<plan>`.
4. Enter the billing address and click **Continue**. Check the VAT in the summary.
5. Choose **PayPal**, accept the terms and click **Pay with PayPal** (for a subscription: **Subscribe with PayPal**).
6. Sign in at PayPal with the sandbox account and confirm the payment. Your real PayPal login does not work in the sandbox.

You then come back to your platform. Check:

- The buyer has access to the product.
- **Admin**, **Products**, **Invoices** lists the invoice with the prefix `TEST-` and the correct VAT.
- In the sandbox, the payment shows in the account of the type **Business**.

Then cancel a test subscription on **Cancel contracts**. Remove the test access under **Admin**, **Members**.

## 6. Go live

1. Open **Admin**, then **Integrations**, then **Stripe**.
2. Under **Mode**, choose **Live** and click **Switch**.
3. Check on the **PayPal** tab: **Buyers see PayPal on the checkout (live mode).**

From now on, buyers see PayPal in both checkout forms. How the checkout looks is described in [Sell products in the shop](sell-products).

## In daily use

- **Invoices:** your platform writes the invoice for every PayPal payment and a credit note for every refund. A full refund ends the access.
- **Refunds:** you refund in PayPal. PayPal reports the refund to your platform.
- **Cancellations:** a cancellation on **Cancel contracts** stops the next charges at PayPal. The access stays until the end of the paid period.
- **Partners:** partners earn on PayPal sales as on Stripe sales. Payouts go through Stripe Connect from your Stripe balance. If the balance is too low, you get an alert. Then top up the Stripe balance or move money from PayPal.

## If something does not work

- **Buyers do not see PayPal:** check the state on the **PayPal** tab for the current mode. If keys are missing, enter them. If the webhook is missing, click **Set up PayPal**.
- **The sandbox refuses your login:** sign in with the sandbox account of the type **Personal**, not with your real PayPal account.
- **PayPal shows the amount without VAT:** check your seller details and the OSS scheme (step 4).
- **The log shows "bad signature" for PayPal:** the webhook does not fit the keys. Click **Set up PayPal**.
- **A purchase gave no access:** open **Admin**, **Integrations**, **Logs** and find the purchase under **Recent deliveries**.
