Skip to content

PayPal (Payments)

Set up PayPal as an alternative or additional payment method alongside Stripe.

Prerequisites

How it works

tripplan.ing uses the PayPal REST API v2 with OAuth2 authentication. When an attendee selects PayPal at checkout, an order is created via the API and the attendee is redirected to PayPal to approve payment. After approval, a webhook triggers order capture and updates the payment record.

Create a developer app

  1. Sign in at developer.paypal.com
  2. Navigate to Apps & Credentials
  3. Click Create App
  4. Enter an app name (e.g., "tripplan.ing") and select Merchant as the app type
  5. Click Create App
  6. Copy the Client ID and Secret

TIP

Toggle between Sandbox and Live at the top of the page to get credentials for each environment.

Create a webhook

  1. In the developer app detail page, scroll to Webhooks
  2. Click Add Webhook
  3. Set the webhook URL to https://<your-domain>/api/paypal/webhook
  4. Subscribe to these events:
    • CHECKOUT.ORDER.APPROVED
    • PAYMENT.CAPTURE.COMPLETED
  5. Click Save
  6. Copy the Webhook ID from the webhook list

Configure tripplan.ing

PayPal credentials are typically set per-event in /admin/settings, but global environment variables are available as a fallback.

Per-event settings (primary)

Set these in the event's admin settings page (/admin/settings):

SettingExampleDescription
paypalClientIdAaBb...PayPal app Client ID
paypalClientSecretEeFf...PayPal app Secret
paypalWebhookId1AB23...Webhook ID from developer dashboard
paypalSandboxtrue / falseUse sandbox environment

Global environment variables (fallback)

If you want a default PayPal account for all events, set these as environment variables:

Environment variableDescription
PAYPAL_CLIENT_IDDefault PayPal Client ID
PAYPAL_CLIENT_SECRETDefault PayPal Secret
PAYPAL_WEBHOOK_IDDefault Webhook ID
PAYPAL_SANDBOXDefault sandbox mode (true / false)

Per-event settings take priority over global environment variables.

For local development with global fallback, add to .dev.vars:

bash
PAYPAL_CLIENT_ID=AaBb...
PAYPAL_CLIENT_SECRET=EeFf...
PAYPAL_WEBHOOK_ID=1AB23...
PAYPAL_SANDBOX=true

Enable PayPal for an event

PayPal must be explicitly enabled in the event's payment method configuration. In /admin/settings, update the paymentMethods field:

ConfigurationEffect
["stripe"]Stripe only (default)
["stripe", "paypal"]Both methods available
["paypal"]PayPal only

Attendees see a payment method selector on /pay when multiple methods are enabled.

Sandbox vs live

SandboxLive
Dashboard toggleSandbox modeLive mode
Real chargesNoYes
Test accountsSandbox buyer/seller accountsReal PayPal accounts
SettingpaypalSandbox: truepaypalSandbox: false
Use forDevelopment, stagingProduction

Creating sandbox test accounts

  1. In the PayPal Developer Dashboard, navigate to Testing ToolsSandbox Accounts
  2. Create a Personal account (simulates a buyer)
  3. Note the email and password for test checkouts

Verify it works

  1. Set paypalSandbox to true in event settings
  2. Configure the sandbox Client ID, Secret, and Webhook ID
  3. Enable PayPal in paymentMethods
  4. Visit /pay on the event subdomain
  5. Select an item and choose PayPal as the payment method
  6. Log in with your sandbox buyer account on the PayPal page
  7. Approve the payment
  8. Check /admin/payments — the payment should show as completed

Troubleshooting

SymptomFix
PayPal option not shown on /payConfirm paymentMethods includes "paypal" in event settings
"PayPal not configured" errorVerify paypalClientId, paypalClientSecret, and paypalWebhookId are set
Redirect to PayPal failsCheck server logs for API errors; confirm Client ID and Secret match the correct mode (sandbox/live)
Payment approved but stays pendingWebhook not delivered — verify webhook URL and subscribed events in developer dashboard
Webhook signature verification failsConfirm paypalWebhookId matches the webhook in the developer dashboard; global credentials are used for verification
Sandbox login failsUse the sandbox buyer email/password from Testing ToolsSandbox Accounts

Released under the MIT License.