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

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# Conectar un método de pago saliente de PayPal

> Añade PayPal como método de pago saliente haciendo que el titular de la cuenta inicie sesión en PayPal, para que los pagos solo vayan a una cuenta verificada a su nombre.

Asegúrate de que los pagos salientes solo lleguen a una cuenta de PayPal que sea propiedad del titular. El titular inicia sesión en PayPal en lugar de escribir un correo electrónico, y Whop guarda el correo electrónico de PayPal una vez que su nombre coincide con su configuración de pagos salientes.

| | Iniciar sesión con PayPal (esta guía) | Correo electrónico escrito |
| - | - | - |
| **Correo de pago** | De PayPal | Lo escribe el titular |
| **Demuestra que el titular es el propietario** | Sí | No |
| **Integración** | Una redirección y una página de retorno | Una llamada a la API |

> [!NOTE]
>
> Antes de empezar, necesitas:
>
> * Una clave de API con los alcances `payout:destination:read` y `payout:create_destination`.
> * El inicio de sesión con PayPal habilitado en la cuenta. Ponte en contacto con Whop para activarlo. Hasta entonces, `supports_paypal_login` es `false` y el paso 2 devuelve `403`.
> * Una [configuración de pagos salientes](https://docs.whop.com/es/developer/verification/overview.md) completada. Whop compara el nombre que figura en ella con la cuenta de PayPal.
> * Una página `https` a la que PayPal pueda devolver al titular, en un dominio añadido a la cuenta o a su plataforma. Añádelo con [Create Domain](https://docs.whop.com/es/api-reference/domains/create-domain.md) y `verification: {}`. No es necesario que termine de verificarse. `https://localhost` funciona para pruebas.
> * Whop SDK 2.5.0 o posterior, si usas un SDK.

## Cómo funciona la redirección

Todo ocurre en el navegador del titular, en una sola pestaña. Nunca llamas a PayPal directamente.

1. Tu servidor inicia una sesión y obtiene una `authorize_url` en PayPal.
2. El navegador del titular va allí, y el titular inicia sesión y aprueba.
3. PayPal devuelve el navegador a Whop, que lee el correo electrónico, el nombre y el estado de verificación de la cuenta.
4. Whop envía el navegador a tu `return_url` con `?paypal_link_token=…` o `?error=…`.
5. Tu servidor pasa el token a Whop, que comprueba el nombre y guarda el método.

## Encuentra el método de pago saliente

[Lista los métodos de pago saliente admitidos](https://docs.whop.com/es/api-reference/payouts/list-supported-payout-methods.md) y guarda el `id` del que tenga `supports_paypal_login: true`. Los SDK recorren todas las páginas de resultados por ti.

```typescript TypeScript theme={null}
import { WhopClient } from "@whop/sdk";

const client = new WhopClient({ token: process.env.WHOP_API_KEY });

const supportedMethods = await client.payouts.supportedMethods.list({
	account_id: "biz_xxxxxxxxxxxxx",
	destination_currency: "usd",
});

let paypalMethodId: string | undefined;
for await (const method of supportedMethods) {
	if (method.supports_paypal_login) {
		paypalMethodId = method.id;
		break;
	}
}
if (!paypalMethodId) throw new Error("PayPal login is not enabled for this account");
```

```python Python theme={null}
import os

from whop_sdk import Whop

client = Whop(token=os.environ["WHOP_API_KEY"])

supported_methods = client.payouts.supported_methods.list(
    account_id="biz_xxxxxxxxxxxxx",
    destination_currency="usd",
)

paypal_method_id = next(
    (method.id for method in supported_methods if method.supports_paypal_login),
    None,
)
if paypal_method_id is None:
    raise RuntimeError("PayPal login is not enabled for this account")
```

```ruby Ruby theme={null}
require "whop_sdk"

client = Whop_sdk::Client.new(token: ENV.fetch("WHOP_API_KEY"))

paypal_method = client.payouts.supported_methods
  .list(account_id: "biz_xxxxxxxxxxxxx", destination_currency: "usd")
  .find(&:supports_paypal_login)
raise "PayPal login is not enabled for this account" if paypal_method.nil?

paypal_method_id = paypal_method.id
```

```go Go theme={null}
import (
	"context"
	"fmt"
	"log"
	"os"

	whopsdk "github.com/whopio/whopsdk-go/v2"
	"github.com/whopio/whopsdk-go/v2/client"
	"github.com/whopio/whopsdk-go/v2/option"
	"github.com/whopio/whopsdk-go/v2/payouts"
)

ctx := context.TODO()
client := client.NewWhop(option.WithToken(os.Getenv("WHOP_API_KEY")))

page, err := client.Payouts.SupportedMethods.List(ctx, &payouts.ListSupportedMethodsRequest{
	AccountID:           whopsdk.String("biz_xxxxxxxxxxxxx"),
	DestinationCurrency: whopsdk.String("usd"),
})
if err != nil {
	log.Fatal(err)
}

var paypalMethodID string
methods := page.Iterator()
for methods.Next(ctx) {
	method := methods.Current()
	if method.SupportsPaypalLogin != nil && *method.SupportsPaypalLogin {
		paypalMethodID = method.ID
		break
	}
}
if err := methods.Err(); err != nil {
	log.Fatal(err)
}
if paypalMethodID == "" {
	log.Fatal("PayPal login is not enabled for this account")
}
```

```bash cURL theme={null}
curl "https://api.whop.com/api/v1/payouts/supported_methods?account_id=biz_xxxxxxxxxxxxx&destination_currency=usd" \
  -H "Authorization: Bearer $WHOP_API_KEY"
```

## Inicia el inicio de sesión

[Crea una sesión de vinculación de PayPal](https://docs.whop.com/es/api-reference/payouts/create-paypal-link-session.md) y redirige al titular a su `authorize_url`. La sesión caduca en 15 minutos, en `expires_at`.

```typescript TypeScript theme={null}
const session = await client.payouts.paypalLinkSessions.create({
	account_id: "biz_xxxxxxxxxxxxx",
	supported_payout_method_id: paypalMethodId,
	destination_currency: "usd",
	return_url: "https://yourapp.example/settings/payouts",
});

// Redirect the holder's browser to this URL
console.log(session.authorize_url);
```

```python Python theme={null}
session = client.payouts.paypal_link_sessions.create(
    account_id="biz_xxxxxxxxxxxxx",
    supported_payout_method_id=paypal_method_id,
    destination_currency="usd",
    return_url="https://yourapp.example/settings/payouts",
)

# Redirect the holder's browser to this URL
print(session.authorize_url)
```

```ruby Ruby theme={null}
session = client.payouts.paypal_link_sessions.create(
  account_id: "biz_xxxxxxxxxxxxx",
  supported_payout_method_id: paypal_method_id,
  destination_currency: "usd",
  return_url: "https://yourapp.example/settings/payouts",
)

# Redirect the holder's browser to this URL
puts session.authorize_url
```

```go Go theme={null}
session, err := client.Payouts.PaypalLinkSessions.Create(ctx, &payouts.CreatePaypalLinkSessionsRequest{
	AccountID:               whopsdk.String("biz_xxxxxxxxxxxxx"),
	SupportedPayoutMethodID: paypalMethodID,
	DestinationCurrency:     whopsdk.String("usd"),
	ReturnURL:               "https://yourapp.example/settings/payouts",
})
if err != nil {
	log.Fatal(err)
}

// Redirect the holder's browser to this URL
fmt.Println(session.AuthorizeURL)
```

```bash cURL theme={null}
curl "https://api.whop.com/api/v1/payouts/paypal_link_sessions" \
  -H "Authorization: Bearer $WHOP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "biz_xxxxxxxxxxxxx",
    "supported_payout_method_id": "podst_xxxxxxxxxxxxx",
    "destination_currency": "usd",
    "return_url": "https://yourapp.example/settings/payouts"
  }'
```

El navegador vuelve a tu `return_url` con uno de estos:

| Cadena de consulta | Significado | Siguiente paso |
| - | - | - |
| `?paypal_link_token=…` | El titular inició sesión | Guarda el método en 15 minutos |
| `?error=paypal_login_canceled` | El titular se echó atrás | Ofrece volver a empezar |
| `?error=paypal_login_failed` | PayPal lo rechazó, el enlace se reutilizó o el intercambio falló | Inicia una sesión nueva |

Si el titular termina después de `expires_at`, o después de que el dominio de `return_url` se elimine de la cuenta, Whop no puede devolverlo. Verá una página de "Invalid or expired link".

## Guarda el método de pago saliente

En tu servidor, [crea el método de pago saliente guardado](https://docs.whop.com/es/api-reference/payouts/create-saved-payout-method.md) con `paypal_link_token` en lugar de `fields`. Usa los mismos `account_id`, `supported_payout_method_id` y `destination_currency` que en la sesión, ya que el token solo funciona con ellos. Whop guarda el correo electrónico de PayPal y le da al método un nombre basado en él.

```typescript TypeScript theme={null}
// paypalLinkToken is the paypal_link_token from your return_url's query string
const method = await client.payouts.methods.create({
	account_id: "biz_xxxxxxxxxxxxx",
	supported_payout_method_id: paypalMethodId,
	destination_currency: "usd",
	paypal_link_token: paypalLinkToken,
});

console.log(method.id);
```

```python Python theme={null}
# paypal_link_token is the value from your return_url's query string
method = client.payouts.methods.create(
    account_id="biz_xxxxxxxxxxxxx",
    supported_payout_method_id=paypal_method_id,
    destination_currency="usd",
    paypal_link_token=paypal_link_token,
)

print(method.id)
```

```ruby Ruby theme={null}
# paypal_link_token is the value from your return_url's query string
method = client.payouts.methods.create(
  account_id: "biz_xxxxxxxxxxxxx",
  supported_payout_method_id: paypal_method_id,
  destination_currency: "usd",
  paypal_link_token: paypal_link_token,
)

puts method.id
```

```go Go theme={null}
// paypalLinkToken is the paypal_link_token from your return_url's query string
method, err := client.Payouts.Methods.Create(ctx, &payouts.CreateMethodsRequest{
	AccountID:               whopsdk.String("biz_xxxxxxxxxxxxx"),
	SupportedPayoutMethodID: paypalMethodID,
	DestinationCurrency:     whopsdk.String("usd"),
	PaypalLinkToken:         whopsdk.String(paypalLinkToken),
})
if err != nil {
	log.Fatal(err)
}

fmt.Println(method.ID)
```

```bash cURL theme={null}
curl "https://api.whop.com/api/v1/payouts/methods" \
  -H "Authorization: Bearer $WHOP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "biz_xxxxxxxxxxxxx",
    "supported_payout_method_id": "podst_xxxxxxxxxxxxx",
    "destination_currency": "usd",
    "paypal_link_token": "'"$PAYPAL_LINK_TOKEN"'"
  }'
```

La respuesta es el nuevo método de pago saliente, abreviado:

```json theme={null}
{
	"object": "payout_method",
	"id": "potk_xxxxxxxxxxxxx",
	"nickname": "PayPal j•••@example.com",
	"institution_name": "PayPal",
	"destination_currency": "usd"
}
```

Ya puedes [enviarle un pago saliente](https://docs.whop.com/es/developer/platforms/manual-payouts.md).

### Si Whop rechaza la cuenta

Whop responde con un `400` con un `message` para el titular, como una discrepancia en el nombre. Muéstralo tal cual.

* **El token sobrevive a un rechazo**, así que reintenta un error temporal con el mismo token.
* **Si el mensaje indica que se vuelva a conectar PayPal**, inicia una sesión nueva cuando el titular haya resuelto el problema.
* **Una cuenta de PayPal no verificada o un correo electrónico no confirmado se guardan igualmente.**

## Lo que ve el titular

La pantalla de consentimiento de PayPal muestra a Whop como la app que solicita su correo electrónico, su nombre y su estado de verificación. Todas las redirecciones se mantienen en la pestaña que abrió PayPal, así que si usas una ventana emergente, tu página de retorno debe notificar a la ventana que la abrió y cerrarse.

## Próximos pasos

> [card] [Enviar un pago saliente](https://docs.whop.com/es/developer/platforms/manual-payouts.md)
>
> Paga al método de PayPal que acabas de guardar

> [card] [Referencia de la API de pagos salientes](https://docs.whop.com/es/api-reference/payouts/payout)
>
> Todos los endpoints de pagos salientes y métodos de pago saliente
