PayPal
Integrate with PayPal, built by an official PayPal Partner.
PayPal for Medusa
Accept PayPal and credit card payments in your Medusa v2 store β built by an official PayPal Partner.
β¨ What you get
Feature Details π΅ PayPal Buttons One-click PayPal checkout for your customers π³ Card Payments Secure credit & debit card fields, hosted by PayPal (PCI compliant) π Admin Dashboard Connect your PayPal account and manage everything from Medusa Admin π Test & Live modes Try everything safely in Sandbox before going live π 3D Secure Extra card security, configurable in one click π Reliable by design Payments are verified with PayPal at every step β webhooks, retries, and safety nets are handled for you
β Requirements
- Medusa v2.12+
- Node.js 20+
- PostgreSQL
π Installation
In your Medusa backend folder, run:
1npm install @easypayment/medusa-payment-paypal
βοΈ Setup β 5 steps
1. Add the plugin to Copy to clipboardmedusa-config.ts
1234567891011121314151617181920import { loadEnv, defineConfig } from "@medusajs/framework/utils"loadEnv(process.env.NODE_ENV || "development", process.cwd())export default defineConfig({projectConfig: {databaseUrl: process.env.DATABASE_URL,http: {storeCors: process.env.STORE_CORS!,adminCors: process.env.ADMIN_CORS!,authCors: process.env.AUTH_CORS!,jwtSecret: process.env.JWT_SECRET || "supersecret",cookieSecret: process.env.COOKIE_SECRET || "supersecret",},},plugins: [{resolve: "@easypayment/medusa-payment-paypal",options: {},
2. Run database migrations
1npx medusa db:migrate
3. Connect your PayPal account
- Start your Medusa server
- Open Medusa Admin β Settings β PayPal
- Choose Sandbox (testing) or Live (real payments)
- Click Connect to PayPal and follow the steps
That's it β your credentials are saved automatically. Webhooks are registered for you too.
π‘ Prefer manual setup? Click Insert credentials manually and paste your Client ID and Secret from developer.paypal.com.
4. Turn PayPal on in your region
Go to Medusa Admin β Settings β Regions β your region and enable:
Payment provider What it is Copy to clipboardpp_paypal_paypal PayPal Buttons Copy to clipboardpp_paypal_card_paypal_card Card payments
5. Add PayPal to your storefront
The checkout UI comes as a separate package β install it in your storefront project:
π¦ @easypayment/medusa-paypal-ui β ready-made PayPal components for Next.js storefronts, with a step-by-step guide.
π¨ Customize (optional)
Everything is managed in Medusa Admin β Settings β PayPal β changes apply instantly, no restart needed:
- PayPal Settings β turn PayPal on/off, button color, shape, and label
- Advanced Card Payments β turn card payments on/off, 3D Secure mode
- Additional Settings β capture vs. authorize, brand name shown at PayPal, invoice prefix
π Going live β two things we recommend
- Copy to clipboard
PAYPAL_ENCRYPTION_KEYβ set this to any long random text in your server's environment. Your PayPal credentials are then stored encrypted in the database. Keep the key safe: if it's lost, just reconnect PayPal. - Copy to clipboard
MEDUSA_BACKEND_URLβ set this to your backend's public address (e.g. Copy to clipboardhttps://api.mystore.com) so PayPal can reach your store for payment notifications.
Advanced options (for developers β everything works without these)
Variable Default What it does Copy to clipboardSTOREFRONT_URL (unset) Storefront address used for PayPal return/cancel pages (can also be set in Admin) Copy to clipboardPAYPAL_ENCRYPTION_STRICT Copy to clipboardfalse Copy to clipboardtrue = refuse to save credentials unencrypted Copy to clipboardPAYPAL_SELLER_NONCE (auto) Set a fixed random string when running multiple server instances Copy to clipboardPAYPAL_ADMIN_ORIGIN first Copy to clipboardADMIN_CORS entry Restricts the onboarding popup to your admin URL Copy to clipboardPAYPAL_WEBHOOK_COMPLETE_CART Copy to clipboardtrue Safety net that finishes an order when the payment succeeded but the buyer's browser closed. Copy to clipboardfalse disables it Copy to clipboardPAYPAL_RATE_LIMIT_MAX / Copy to clipboardPAYPAL_RATE_LIMIT_WINDOW_MS (off) / Copy to clipboard60000 Optional request limit for the public checkout routes Copy to clipboardPAYPAL_WEBHOOK_RATE_LIMIT_MAX / Copy to clipboardPAYPAL_WEBHOOK_RATE_LIMIT_WINDOW_MS (off) / Copy to clipboard60000 Optional request limit for the webhook endpoint (separate from the above) Copy to clipboardPAYPAL_WEBHOOK_REPLAY_WINDOW_MINUTES Copy to clipboard60 Rejects webhook deliveries older than this Copy to clipboardPAYPAL_WEBHOOK_STALE_PROCESSING_MS Copy to clipboard300000 When the retry job re-picks-up interrupted webhook events Copy to clipboardPAYPAL_WEBHOOK_ID_LIVE / Copy to clipboardPAYPAL_WEBHOOK_ID_SANDBOX (auto) Manual webhook-id override (normally automatic) Copy to clipboardPAYPAL_HTTP_TIMEOUT_MS Copy to clipboard30000 Timeout for calls to PayPal Copy to clipboardPAYPAL_CURRENCY Copy to clipboardEUR Fallback currency if none is configured Copy to clipboardPAYPAL_ALERT_WEBHOOK_URLS (unset) Comma-separated URLs that receive operational alert notifications
Monitoring: operational counters live in the Copy to clipboardpaypal_metric table; every webhook is recorded in Copy to clipboardpaypal_webhook_event with automatic retries; audit events are logged as JSON lines tagged Copy to clipboard"log":"paypal_audit" (secrets redacted).
π¬ Support
- π Found a bug? Open an issue
- π‘ Questions or feature requests? Start a discussion
- π Storefront UI package: @easypayment/medusa-paypal-ui
π License
MIT Β© Easy Payment

