PayPal integration for Medusa v2
Accept PayPal and advanced credit card payments in your Medusa v2 store β built by an official PayPal Partner.
| Feature | Details |
|---|---|
| π΅ PayPal Smart Buttons | One-click wallet checkout via PayPal |
| π³ Advanced Card Fields | Hosted, PCI-compliant advanced credit card inputs |
| π Admin Dashboard | Connect, configure, and switch environments from Medusa Admin |
| π Sandbox & Live | Toggle between test and production without restarting |
| β‘ Webhooks | Automatically registered and verified with built-in retry support |
| π 3D Secure | Configurable SCA/3DS per transaction |
In your Medusa backend directory, run:
npm install @easypayment/medusa-payment-paypal
Add the plugin and both payment providers to your existing :
1import { loadEnv, defineConfig } from "@medusajs/framework/utils"23loadEnv(process.env.NODE_ENV || "development", process.cwd())45export 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 },1617 plugins: [18 {19 resolve: "@easypayment/medusa-payment-paypal",20 options: {},21 },22 ],2324 modules: [25 {26 resolve: "@medusajs/medusa/payment",27 options: {28 providers: [29 {30 // PayPal Smart Buttons (wallet checkout)31 resolve: "@easypayment/medusa-payment-paypal/providers/paypal",32 id: "paypal",33 options: {},34 dependencies: ["paypal_onboarding"],35 },36 {37 // Advanced Card Fields (hosted card inputs)38 resolve: "@easypayment/medusa-payment-paypal/providers/paypal_card",39 id: "paypal_card",40 options: {},41 dependencies: ["paypal_onboarding"],42 },43 ],44 },45 },46 ],47})
npx medusa db:migrate
Credentials are saved automatically. Prefer manual setup? Click Insert credentials manually and paste your Client ID and Secret from developer.paypal.com.
π Encrypt secrets at rest (recommended for production). Set to any strong random string. The seller client secret and PayPal app access token are then stored AESβ256βGCMβencrypted in the database; without it they are stored in plaintext (the previous default). Encryption is transparent β existing plaintext credentials keep working and are upgraded to ciphertext the next time they are saved/refreshed.
Keep this key safe and backed up: if it is lost, stored credentials cannot be decrypted and you must reconnect PayPal. Rotating the key requires reβsaving credentials.
| Provider ID | Description |
|---|---|
| PayPal Smart Buttons (wallet) | |
| Advanced Card Fields (card) |
All settings live in Medusa Admin β Settings β PayPal and apply immediately β no server restart needed.
| Tab | What you can configure |
|---|---|
| PayPal Settings | Enable/disable, button color, shape, label |
| Advanced Card Payments | Enable/disable, 3D Secure mode |
| Additional Settings | Payment action (capture / authorize), brand name, invoice prefix |
The checkout UI is shipped as a separate package β install it inside your storefront project, not in this backend.
π¦ @easypayment/medusa-paypal-ui β React components, hooks, and a drop-in payment step adapter for Next.js App Router storefronts.
See the storefront integration & testing guide β
MIT Β© Easy Payment