> The full documentation index: https://palbase.studio/llms.txt

# Stripe

Connect your environment's own Stripe account to accept international cards, 3D Secure payments, Apple Pay / Google Pay through Checkout, saved cards, recurring subscriptions, refunds, disputes, and the Stripe Customer Portal — as well as web checkouts for [In-App Purchases](/docs/iap/web).

## Connecting Stripe

### Option 1: One-click Palbase Stripe App (recommended)

Install Palbase's Stripe App with OAuth — no API key is created or pasted manually.

- **In Studio**: Open **Payments › Channels**, click **Connect Stripe App**, choose where to install it — a **Sandbox**, an account's **Test mode**, or **Live** — and open the one-time install link. Choose the same place on Stripe's page: select the account, then at the end of the page click its mode next to its name and pick the sandbox (or test mode) the link was made for. A link for a sandbox does not connect test mode.
- **In the CLI**:

```sh
# Test mode (default)
palbase payments:stripe:install

# A sandbox
palbase payments:stripe:install --sandbox --channel stripe_sandbox

# Live mode (real payments)
palbase payments:stripe:install --live --channel stripe_global
```

Under the hood, Palbase calls `POST /payments/stripe/app/grants`, mints a single-use 30-minute link, and receives the connected account's events once Stripe completes OAuth.

While the App is in Stripe's review, a live install answers `409 stripe_app_in_review`: connect a live account with a restricted key (below). Sandboxes and test mode connect through the App meanwhile.

A Stripe account the App is already installed for in another Palbase project is refused. A member of that project is told which one — its name, its environment, the channel — and the command that disconnects it there (`palbase payments:channels:disconnect <channel> -P <ref>`); anyone else is told it belongs to a project they are not a member of, and that the account's owner can remove the Palbase app in the Stripe Dashboard (**Settings › Installed apps**).

The App asks for invoice write access, so that a channel it connects makes [invoices](/docs/payments/invoices): an account that installed an earlier version of the App accepts the new permission in its Stripe Dashboard (**Settings › Installed apps**, where Stripe asks it), and until then the channel answers an invoice with `409 invoice_permission_required`.

The App calls Stripe through Stripe Connect, which [Managed Payments](https://docs.stripe.com/payments/managed-payments) does not support: to sell In-App Purchases' web checkouts with `web_tax` managed ([Tax](/docs/iap/web#tax)), connect the account with a restricted key (Option 2). While `web_tax` is managed, an App channel is not made the default, a routing rule's or installed where web checkouts would go to it (`409 managed_payments_needs_key`); behind a rule that sends them to a key's channel, it may.

### Option 2: Restricted API key

If you prefer a restricted key (`rk_test_...` or `rk_live_...`), grant it access to Customers, Checkout Sessions, PaymentIntents, Charges, Subscriptions, Invoices, SetupIntents, and Webhook Endpoints (write access to Invoices for a channel that makes [invoices](/docs/payments/invoices): with read access alone an invoice answers `409 invoice_permission_required`), then hand it directly to the Payments module:

```sh
palbase payments:stripe:grant --channel stripe_global
```

`POST /payments/channels/grants` returns a single-use browser form (`GET /payments/connect`) hosted directly by your environment's Payments module so your key never passes through Studio. The page asks for its provider's fields alone — a Stripe link for the restricted key (test or live is read from the key), an iyzico link (`kind: iyzico_key`) for its API and secret keys and the mode — and answers with a page naming the channel it connected and its mode, or why nothing was, with its code and a way back while the link lasts; a program that posts the form with `Accept: application/json` is answered the channel as JSON. The link names its channel. One made with an [environment token](/docs/getting-started/access-tokens) sets up a project's first channel only: where a channel was connected before — still connected or not — it answers `409 channel_exists`, and a person signed in to Studio adds the next one or changes a channel's keys.

## Webhooks & authoritative verification

Palbase registers a dedicated webhook endpoint at `POST /payments/webhooks/stripe` (or `POST /payments/webhooks/stripe-app` for Stripe App installations) and verifies every delivery's `Stripe-Signature` header.

Before mutating any PaymentIntent, refund, subscription, or dispute, Palbase records the webhook in an idempotent inbox and verifies authoritative state directly against Stripe's API — preventing spoofing and out-of-order race conditions.

## Capabilities on Stripe channels

- **Checkout & 3DS**: Automatic hosted Checkout redirect or off-session saved-card confirmation with 3DS fallback.
- **Saved cards**: Customer card vaulting (`save_method: true` or `POST /payments/me/methods`) without handling PANs on your servers.
- **Manual capture**: Set `capture_method: "manual"` on `POST /payments/intents`, then call `POST /payments/intents/{intent_id}/capture` or `POST /payments/intents/{intent_id}/cancel`.
- **Self-service Billing Portal**: Call `pb.payments.portal(returnUrl)` (`POST /payments/me/portal`) to send signed-in subscribers to Stripe's Customer Portal.
- **Refunds & Disputes**: Full/partial card refunds (`destination: "original"`) or instant closed-loop wallet refunds (`destination: "wallet"`), plus automatic dispute ingestion.

## Live sandbox verification

Run an end-to-end test-mode check against your Stripe test channel using the built-in CLI probe:

```sh
palbase payments:sandbox:verify
```

## Related

- [Channels & Routing](/docs/payments/channels)
- [Checkout & PaymentSheet](/docs/payments/checkout)
- [Refunds & Disputes](/docs/payments/refunds-disputes)
