client_id and its secret
as the key (developer.paypal.com → Apps & Credentials). On a new tenant, set
both: the secret with the usual API-key setup, and the client id in the
account’s client_id field. In code, pass both to the plugin instead:
paypal({ key: secret, clientId, environment: 'sandbox' }). The plugin
trades them for an access token (OAuth client credentials) and reuses it
until it nears expiry. Sandbox and live apps are separate: set
environment to sandbox or live, or leave it empty and the plugin tries
live first and falls back to sandbox when live doesn’t know the client id.
- Money and email go through
destructiveoperations: capturing, authorizing, reauthorizing and voiding payments, refunds, payouts, subscription captures, cancellations, suspensions and revisions, sending, reminding and updating invoices (an update emails the recipient unlesssend_to_recipientis false), recording payments and refunds, tracking numbers that can email the buyer, and every dispute action (accepting a claim refunds the buyer).orders.createisdestructivetoo: with a cardpayment_sourceand intentCAPTURE, PayPal captures in the same call. Without a payment source it only makes a draft order for the buyer to approve. Deletes aredestructive. - Idempotency. Many writes take
paypal_request_id(the PayPal-Request-Id header; check the operation’s inputs). Use a new id for each new action. A retry with the same id returns the first result instead of acting twice, but only while PayPal keeps the id (hours to days, depending on the API); after that, look the result up before retrying.prefer: "return=representation"returns the full resource. - Partial updates (
orders.update,plans.update,subscriptions.update,products.update,disputes.update,webProfiles.update) takepatch, a JSON Patch list such as[{ "op": "add", "path": "/description", "value": "..." }](replaceonly works on a field that is already set), and answer 204 as{ success: true }.invoices.updateandinvoices.templates.updatereplace the whole resource: send every field you want to keep. - Dispute evidence goes as a multipart form: the
inputfield is the JSON part (evidences, notes) and the document fields take a file. - Webhooks. Create one with
webhooks.create(your Corsair webhook URL and the event types) and give the plugin its id aswebhookId(or store it as the account’s webhook signature). Corsair checks each delivery’s signature itself, without PayPal’s verification API, against PayPal’s certificate (PAYPAL-CERT-URL, which must be on paypal.com) and that webhook id. It downloads that certificate over HTTPS the first time it sees it, so the server needs outbound access to PayPal. Deliveries are then routed byevent_typetocheckoutOrder,paymentCapture,paymentAuthorization,sale,subscription,plan,invoice,dispute,payout,vault,catalogProductorother.webhooks.verifySignaturedoes the same check through PayPal’s API.
- 114 typed API operations
- 12 incoming webhook event types
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the PayPal API key before the first call: More: API Key
pnpm corsair setup --plugin=paypal --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
Get an orderWebhooks
This plugin registers 12 webhook event types. Configure the provider to POST to your Corsair HTTP handler, then usewebhookHooks on the plugin factory.
See Webhooks for every event path and payload shape, and Webhooks concept for routing.
What’s next
API reference
Every
paypal.api.* operation with input and output types.Webhooks
Event paths, payloads, and
webhookHooks examples.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.