> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lovable.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your app to PayPal

> Connect your app to PayPal to create checkouts, capture approved orders, issue refunds, and read order details in sandbox and live.

[PayPal](https://www.paypal.com/) is a checkout service for taking payments online. The PayPal connector lets your Lovable app create checkouts, capture approved orders (take the money after the buyer approves), issue refunds, and read order details in a PayPal account you already have. It's designed for apps that charge buyers through PayPal Checkout.

PayPal is available as an [app + chat connector](https://docs.lovable.dev/integrations/app-connectors.md): one shared connection that works in the project chat while you build and in your published apps.

With PayPal, your app can:

* Create a checkout for an order
* Capture the order after the buyer approves it
* Refund a capture, in full or in part
* Read an order's status
* List recent transactions after you enable **Transaction Search**

> [!NOTE]
>
> This page is about the PayPal connector, where you connect a PayPal account you already have. Looking for payments Lovable sets up for you? See [Payments](https://docs.lovable.dev/features/payments.md). The two are different features. Built-in payments use Stripe or Paddle.

## Common use cases and example apps

These examples show what you can build with PayPal, each with a prompt to start from.

| Example app | Example prompt | Description |
| :- | :- | :- |
| Shop checkout | *Use PayPal and build a checkout so customers can pay for their cart with PayPal.* | **Take payment for a cart.** The app creates a PayPal order for the cart total and captures it after the buyer approves. |
| Donation page | *Use PayPal and build a donation page where supporters choose an amount and pay with PayPal.* | **Accept one-off donations.** The app creates an order for the chosen amount and thanks the donor after the capture succeeds. |
| Event tickets | *Use PayPal and build a ticket page where visitors buy tickets and receive a confirmation.* | **Sell tickets through PayPal.** The app creates an order for the selected tickets and confirms the purchase after capture. |
| Booking deposit | *Use PayPal and build a booking form that takes a \$20 deposit to confirm the appointment.* | **Confirm a booking with a paid deposit.** The app charges the deposit through PayPal and confirms the booking after capture. |
| Order refunds | *Use PayPal and build an admin page where I can refund a captured PayPal order.* | **Refund a captured payment.** The app refunds the capture in full, or for the amount you enter. |
| Payments overview | *Use PayPal and build an admin page that lists recent PayPal transactions with their amount and status.* | **See recent PayPal activity.** The app lists transactions from your PayPal account after **Transaction Search** is enabled. |

## How to connect PayPal

Who can create PayPal connections depends on your plan and workspace settings. App + chat connectors are available by default. On Business and Enterprise plans, [Who can create connections and clients](https://docs.lovable.dev/integrations/admin-controls.md#who-can-create-connections-and-clients) starts at **Admins**. Some Enterprise workspaces start at **No one**, which disables the connector. An admin or owner changes it in **Connectors → Admin settings → App + chat connectors**.

You can create multiple PayPal connections using different REST apps, which is useful for separating sandbox and live payments. A REST app is the app you create in the PayPal Developer Dashboard. Each REST app has its own client ID and secret.

When the connection is created, you can [link it to the projects](https://docs.lovable.dev/integrations/app-connectors.md#link-a-connection-to-a-project) where you want to use it. Anyone building in a project can ask Lovable in chat to link their project to it.

### Prerequisites

Before connecting PayPal, make sure you have:

* A PayPal account. A live PayPal REST app needs a verified PayPal business account.
* A REST app on **Apps & Credentials**, in sandbox or in live
* Permission to **create connections** in your Lovable workspace (see [Who can create connections and clients](https://docs.lovable.dev/integrations/admin-controls.md#who-can-create-connections-and-clients))

> [!NOTE]
>
> Payments made through this connector go to your PayPal account. PayPal charges its fees directly, and billing is handled by PayPal, not Lovable.

### Step 1: Get your PayPal client ID and secret

A REST app has a client ID and a secret. The client ID identifies the REST app. The secret lets Lovable call PayPal for that REST app. Sandbox and live each have their own REST apps, so copy both values from the REST app in the environment you want.

To get a client ID and secret:

**1. Open the PayPal Developer Dashboard**

Sign in to the [PayPal Developer Dashboard](https://developer.paypal.com/dashboard/).

**2. Open Apps & Credentials**

Go to [Apps & Credentials](https://developer.paypal.com/dashboard/applications). Select **Sandbox** to test payments, or **Live** to take real payments.

**3. Open or create a REST app**

New accounts include a default REST app under **REST API apps**. To add a REST app, click **Create App**, enter an **App Name**, select **Merchant**, and click **Create App**. **Merchant** is the type for taking payments in your own app. **Platform** is for taking payments on behalf of other businesses.

**4. Copy the client ID and secret**

On the REST app page, copy the client ID and the secret from that same REST app. Store the secret securely.

> [!WARNING]
>
> The secret functions like a password. Keep it secure and never share it publicly. You will need the client ID and the secret in the next step.

See PayPal's documentation for more: [Get started with PayPal REST APIs](https://developer.paypal.com/api/get-started).

### Step 2: Connect PayPal to Lovable

Use a sandbox REST app for the first connection, so you can try payments without moving real money.

**1. Open PayPal in Connectors**

Open [**Connectors**](https://lovable.dev/dashboard?connectors) and select **PayPal**. For the other places to open the catalog from, see [Where to find connectors](https://docs.lovable.dev/integrations/introduction#where-to-find-connectors).

**2. Add a connection**

Click **Connect** on the connector page. The form is split into collapsible sections, **Details**, **Configure connection**, and **Sharing**.

**3. Name the connection**

Under **Details**, Lovable fills in a name for the connection, which you can change, for example to `PayPal Sandbox` or `PayPal Live` when you keep a connection for each environment. The name is only used inside Lovable to identify the connection.

**4. Configure the connection**

Under **Configure connection**, enter:

1. **Environment**: select **Sandbox (testing)** or **Live (production)**. **Sandbox (testing)** is selected by default. Use a REST app from that same environment.
2. **Client ID**: paste the client ID from that REST app. Sandbox and live REST apps are separate. **Open Apps & Credentials** next to the field opens the **Apps & Credentials** page.
3. **Secret**: paste the secret from the same REST app.

**5. Choose who can use this connection**

Under **Sharing**, the connection is private to you by default and shows a **Private** label. To share it, click **Share with others**. Then add workspace members by email, or click **Invite entire workspace** to make the connection available to everyone in your Lovable workspace.

See [Who can use connections and clients](https://docs.lovable.dev/integrations/admin-controls.md#who-can-use-connections-and-clients) for more information.

**6. Connect**

Click **Connect** at the bottom of the form. Lovable verifies the client ID and secret against the PayPal API before saving the connection.

When connected, anyone building in a project can ask Lovable in chat to link their project to PayPal (based on configured connection-level access). Your Lovable apps can then create checkouts, capture approved orders, and issue refunds.

## How checkout works

The buyer approves the payment in PayPal. Your app captures the order on the server after that approval. Your app marks the order paid when the capture succeeds.

The secret does not appear in the browser. Requests go through Lovable's [connector gateway](https://docs.lovable.dev/integrations/app-connectors.md#gateway-based-connectors).

PayPal can tell your app when a payment completes. Lovable builds the check that confirms each message really came from PayPal before your app acts on it.

Your app reads recent transactions from PayPal. PayPal can take up to 3 hours to include a new transaction in that list. The list needs **Transaction Search** enabled on the REST app.

## Test a payment in sandbox

To pay in sandbox, open **Testing Tools**, then **Sandbox Accounts**, in the PayPal Developer Dashboard. Sign in with a personal sandbox account. Sandbox payments stay inside PayPal's test accounts.

## Go live

Create a second connection with the client ID and secret from your live REST app. Set **Environment** to **Live (production)**. Then [unlink the sandbox connection](https://docs.lovable.dev/integrations/app-connectors.md#unlink-projects-from-a-connection) from the project and link the live connection.

## Limitations

The PayPal connector cannot:

* Give each person who uses your app a separate PayPal business account. Each connection is one PayPal REST app, shared across the projects linked to it. Buyers still pay with their own PayPal accounts at checkout.

## Troubleshooting

Use these checks when connecting fails, or when your app cannot list transactions.

> [accordion] Client ID must be at least 20 letters, numbers, underscores, or hyphens
>
> Lovable rejected the client ID before calling PayPal. Paste the client ID again from **Apps & Credentials**. It must be at least 20 letters, numbers, underscores, or hyphens.

> [accordion] Secret must be 16-512 characters with no spaces
>
> Lovable rejected the secret before calling PayPal. A space, including one at the end of a paste, causes this. Copy the secret again with no spaces. It must be 16 to 512 characters.

> [accordion] PayPal could not be reached. Try again in a moment.
>
> Lovable could not reach PayPal, so the credentials were not checked. Click **Connect** again in a moment.

> [accordion] PayPal did not validate your credentials.
>
> PayPal rejected the client ID and secret. In the PayPal Developer Dashboard, open **Apps & Credentials** and copy the client ID and secret from the same sandbox or live REST app as the **Environment** you selected. Click **Show error** to see PayPal's response.

> [accordion] My app can't list recent PayPal transactions
>
> The REST app needs **Transaction Search** before PayPal will list transactions. Open the REST app on **Apps & Credentials**, enable **Transaction Search**, and save. The change can take several hours to take effect, so try the listing again later. Checkout, capture, and refunds work without **Transaction Search**.

## Manage your PayPal connection

Connections are managed from [**Connectors**](https://lovable.dev/dashboard?connectors): select **PayPal**, then open the connection.

* **Unlink projects** to remove PayPal access from specific projects while keeping the connection available for others. See [Unlink projects from a connection](https://docs.lovable.dev/integrations/app-connectors.md#unlink-projects-from-a-connection) for the steps.
* **Delete the connection** to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use PayPal stop working until a new connection is added. See [Delete a connection](https://docs.lovable.dev/integrations/app-connectors.md#delete-a-connection) for the steps and who can delete.
