Интеграция PayPal для Medusa v2
Accept PayPal and credit card payments in your Medusa v2 store — built by an official PayPal Partner.
| 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 |
In your Medusa backend folder, run:
npx medusa db:migrateThat'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.
Go to Medusa Admin → Settings → Regions → your region and enable:
| Payment provider | What it is |
|---|---|
| PayPal Buttons | |
| Card payments |
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.
Everything is managed in Medusa Admin → Settings → PayPal — changes apply instantly, no restart needed:
| Variable | Default | What it does |
|---|---|---|
| (unset) | Storefront address used for PayPal return/cancel pages (can also be set in Admin) | |
| = refuse to save credentials unencrypted | ||
| (auto) | Set a fixed random string when running multiple server instances | |
| first entry | Restricts the onboarding popup to your admin URL | |
| Safety net that finishes an order when the payment succeeded but the buyer's browser closed. disables it | ||
| / | (off) / | Optional request limit for the public checkout routes |
| / | (off) / | Optional request limit for the webhook endpoint (separate from the above) |
| Rejects webhook deliveries older than this | ||
| When the retry job re-picks-up interrupted webhook events | ||
| / | (auto) | Manual webhook-id override (normally automatic) |
| Timeout for calls to PayPal | ||
| Fallback currency if none is configured | ||
| (unset) | Comma-separated URLs that receive operational alert notifications |
Monitoring: operational counters live in the table; every webhook is recorded in with automatic retries; audit events are logged as JSON lines tagged (secrets redacted).
MIT © Easy Payment
npm install @easypayment/medusa-payment-paypal1import { loadEnv, defineConfig } from "@medusajs/framework/utils"2
3loadEnv(process.env.NODE_ENV || "development", process.cwd())4
5export default defineConfig({6 projectConfig: {7 databaseUrl: process.env.DATABASE_URL,8 http: {9 storeCors: process.env.STORE_CORS!,10 adminCors: process.env.ADMIN_CORS!,11 authCors: process.env.AUTH_CORS!,12 jwtSecret: process.env.JWT_SECRET || "supersecret",13 cookieSecret: process.env.COOKIE_SECRET || "supersecret",14 },15 },16
17 plugins: [18 {19 resolve: "@easypayment/medusa-payment-paypal",20 options: {},21 },22 ],23
24 modules: [25 {26 resolve: "@medusajs/medusa/payment",27 options: {28 providers: [29 {30 // PayPal Buttons31 resolve: "@easypayment/medusa-payment-paypal/providers/paypal",32 id: "paypal",33 options: {},34 dependencies: ["paypal_onboarding"],35 },36 {37 // Card payments38 resolve: "@easypayment/medusa-payment-paypal/providers/paypal_card",39 id: "paypal_card",40 options: {},41 dependencies: ["paypal_onboarding"],42 },43 ],44 },45 },46 ],47})