@easypayment/medusa-paypal 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +7 -7
- package/.medusa/server/src/admin/index.mjs +7 -7
- package/README.md +60 -142
- package/package.json +73 -73
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +200 -200
- package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +183 -183
- package/src/admin/routes/settings/paypal/connection/page.tsx +4 -4
- package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +376 -376
|
@@ -154,7 +154,7 @@ function AdditionalSettingsTab() {
|
|
|
154
154
|
title: "Additional Settings",
|
|
155
155
|
description: "These settings control checkout behavior and PayPal experience.",
|
|
156
156
|
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
157
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "rounded-md bg-ui-button-neutral
|
|
157
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
158
158
|
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
159
159
|
] }),
|
|
160
160
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
@@ -304,7 +304,7 @@ function AdvancedCardPaymentsTab() {
|
|
|
304
304
|
title: "Advanced Card Payments",
|
|
305
305
|
description: "Control card checkout settings and 3D Secure behavior.",
|
|
306
306
|
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
307
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "rounded-md bg-ui-button-neutral
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
308
308
|
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
309
309
|
] }),
|
|
310
310
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
@@ -730,7 +730,7 @@ function PayPalConnectionPage() {
|
|
|
730
730
|
type: "button",
|
|
731
731
|
onClick: handleDisconnect,
|
|
732
732
|
disabled: onboardingInProgress,
|
|
733
|
-
className: "rounded-md
|
|
733
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
734
734
|
children: "Disconnect"
|
|
735
735
|
}
|
|
736
736
|
) })
|
|
@@ -760,7 +760,7 @@ function PayPalConnectionPage() {
|
|
|
760
760
|
href: finalUrl || "#",
|
|
761
761
|
"data-paypal-onboard-complete": "onboardingCallback",
|
|
762
762
|
onClick: handleConnectClick,
|
|
763
|
-
className: "inline-flex items-center justify-center rounded-md
|
|
763
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none no-underline shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
764
764
|
style: {
|
|
765
765
|
cursor: onboardingInProgress ? "not-allowed" : "pointer",
|
|
766
766
|
opacity: onboardingInProgress ? 0.6 : 1,
|
|
@@ -883,7 +883,7 @@ function PayPalConnectionPage() {
|
|
|
883
883
|
"button",
|
|
884
884
|
{
|
|
885
885
|
type: "button",
|
|
886
|
-
className: "rounded-md
|
|
886
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
887
887
|
onClick: () => setShowManual(false),
|
|
888
888
|
disabled: onboardingInProgress,
|
|
889
889
|
children: "Cancel"
|
|
@@ -893,7 +893,7 @@ function PayPalConnectionPage() {
|
|
|
893
893
|
"button",
|
|
894
894
|
{
|
|
895
895
|
type: "button",
|
|
896
|
-
className: "rounded-md
|
|
896
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
897
897
|
disabled: !canSaveManual || onboardingInProgress,
|
|
898
898
|
onClick: handleSaveManual,
|
|
899
899
|
children: "Save credentials"
|
|
@@ -1108,7 +1108,7 @@ function PayPalSettingsTab() {
|
|
|
1108
1108
|
type: "button",
|
|
1109
1109
|
onClick: onSave,
|
|
1110
1110
|
disabled: saving || loading,
|
|
1111
|
-
className: "rounded-md bg-ui-button-neutral
|
|
1111
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
1112
1112
|
children: saving ? "Saving..." : "Save settings"
|
|
1113
1113
|
}
|
|
1114
1114
|
),
|
|
@@ -153,7 +153,7 @@ function AdditionalSettingsTab() {
|
|
|
153
153
|
title: "Additional Settings",
|
|
154
154
|
description: "These settings control checkout behavior and PayPal experience.",
|
|
155
155
|
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
156
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "rounded-md bg-ui-button-neutral
|
|
156
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
157
157
|
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
158
158
|
] }),
|
|
159
159
|
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
@@ -303,7 +303,7 @@ function AdvancedCardPaymentsTab() {
|
|
|
303
303
|
title: "Advanced Card Payments",
|
|
304
304
|
description: "Control card checkout settings and 3D Secure behavior.",
|
|
305
305
|
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
306
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "rounded-md bg-ui-button-neutral
|
|
306
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
307
307
|
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading..." }) : null
|
|
308
308
|
] }),
|
|
309
309
|
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
@@ -729,7 +729,7 @@ function PayPalConnectionPage() {
|
|
|
729
729
|
type: "button",
|
|
730
730
|
onClick: handleDisconnect,
|
|
731
731
|
disabled: onboardingInProgress,
|
|
732
|
-
className: "rounded-md
|
|
732
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
733
733
|
children: "Disconnect"
|
|
734
734
|
}
|
|
735
735
|
) })
|
|
@@ -759,7 +759,7 @@ function PayPalConnectionPage() {
|
|
|
759
759
|
href: finalUrl || "#",
|
|
760
760
|
"data-paypal-onboard-complete": "onboardingCallback",
|
|
761
761
|
onClick: handleConnectClick,
|
|
762
|
-
className: "inline-flex items-center justify-center rounded-md
|
|
762
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none no-underline shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
763
763
|
style: {
|
|
764
764
|
cursor: onboardingInProgress ? "not-allowed" : "pointer",
|
|
765
765
|
opacity: onboardingInProgress ? 0.6 : 1,
|
|
@@ -882,7 +882,7 @@ function PayPalConnectionPage() {
|
|
|
882
882
|
"button",
|
|
883
883
|
{
|
|
884
884
|
type: "button",
|
|
885
|
-
className: "rounded-md
|
|
885
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
886
886
|
onClick: () => setShowManual(false),
|
|
887
887
|
disabled: onboardingInProgress,
|
|
888
888
|
children: "Cancel"
|
|
@@ -892,7 +892,7 @@ function PayPalConnectionPage() {
|
|
|
892
892
|
"button",
|
|
893
893
|
{
|
|
894
894
|
type: "button",
|
|
895
|
-
className: "rounded-md
|
|
895
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
896
896
|
disabled: !canSaveManual || onboardingInProgress,
|
|
897
897
|
onClick: handleSaveManual,
|
|
898
898
|
children: "Save credentials"
|
|
@@ -1107,7 +1107,7 @@ function PayPalSettingsTab() {
|
|
|
1107
1107
|
type: "button",
|
|
1108
1108
|
onClick: onSave,
|
|
1109
1109
|
disabled: saving || loading,
|
|
1110
|
-
className: "rounded-md bg-ui-button-neutral
|
|
1110
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
1111
1111
|
children: saving ? "Saving..." : "Save settings"
|
|
1112
1112
|
}
|
|
1113
1113
|
),
|
package/README.md
CHANGED
|
@@ -1,53 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<h1>🅿 medusa-paypal-backend</h1>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- PayPal Wallet (Smart Buttons)
|
|
10
|
-
- PayPal Advanced Card Payments
|
|
11
|
-
- Admin configuration UI for PayPal settings
|
|
12
|
-
- Store API support for storefront integrations
|
|
13
|
-
- Configurable checkout behavior
|
|
5
|
+
<p><strong>Production-ready PayPal payment plugin for Medusa v2</strong></p>
|
|
14
6
|
|
|
15
|
-
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@easypayment/medusa-paypal-backend"><img src="https://img.shields.io/npm/v/@easypayment/medusa-paypal-backend?color=blue&label=npm" alt="npm version" /></a>
|
|
9
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT" /></a>
|
|
10
|
+
<a href="https://medusajs.com"><img src="https://img.shields.io/badge/Medusa-v2-9b59b6" alt="Medusa v2" /></a>
|
|
11
|
+
<a href="https://developer.paypal.com"><img src="https://img.shields.io/badge/PayPal-PPCP-003087" alt="PayPal PPCP" /></a>
|
|
12
|
+
</p>
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
<p>Smart Buttons · Advanced Card Fields · Webhooks · Reconciliation · Credential Encryption</p>
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|-----------|---------|
|
|
21
|
-
| Medusa | `^2.12.0` |
|
|
22
|
-
| Node.js | `>=20` |
|
|
16
|
+
</div>
|
|
23
17
|
|
|
24
18
|
---
|
|
25
19
|
|
|
26
|
-
##
|
|
20
|
+
## Requirements
|
|
27
21
|
|
|
28
|
-
|
|
22
|
+
- Medusa v2
|
|
23
|
+
- Node.js 18+
|
|
24
|
+
- PostgreSQL
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
npm install @easypayment/medusa-paypal
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Or with pnpm:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
pnpm add @easypayment/medusa-paypal
|
|
38
|
-
```
|
|
26
|
+
---
|
|
39
27
|
|
|
40
|
-
|
|
28
|
+
## Step 1 — Install
|
|
41
29
|
|
|
42
30
|
```bash
|
|
43
|
-
|
|
31
|
+
npm install @easypayment/medusa-paypal-backend
|
|
44
32
|
```
|
|
45
33
|
|
|
46
34
|
---
|
|
47
35
|
|
|
48
|
-
##
|
|
36
|
+
## Step 2 — Configure medusa-config.ts
|
|
49
37
|
|
|
50
|
-
|
|
38
|
+
Add the plugin and both payment providers to your existing `medusa-config.ts`:
|
|
51
39
|
|
|
52
40
|
```ts
|
|
53
41
|
import { loadEnv, defineConfig } from "@medusajs/framework/utils"
|
|
@@ -79,13 +67,17 @@ export default defineConfig({
|
|
|
79
67
|
options: {
|
|
80
68
|
providers: [
|
|
81
69
|
{
|
|
70
|
+
// PayPal Smart Buttons (wallet checkout)
|
|
82
71
|
resolve: "@easypayment/medusa-paypal/providers/paypal",
|
|
83
72
|
id: "paypal",
|
|
73
|
+
options: {},
|
|
84
74
|
dependencies: ["paypal_onboarding"],
|
|
85
75
|
},
|
|
86
76
|
{
|
|
77
|
+
// Advanced Card Fields (hosted card inputs)
|
|
87
78
|
resolve: "@easypayment/medusa-paypal/providers/paypal_card",
|
|
88
79
|
id: "paypal_card",
|
|
80
|
+
options: {},
|
|
89
81
|
dependencies: ["paypal_onboarding"],
|
|
90
82
|
},
|
|
91
83
|
],
|
|
@@ -97,146 +89,72 @@ export default defineConfig({
|
|
|
97
89
|
|
|
98
90
|
---
|
|
99
91
|
|
|
100
|
-
##
|
|
92
|
+
## Step 3 — Set environment variables
|
|
101
93
|
|
|
102
|
-
Add
|
|
94
|
+
Add these to your Medusa server `.env`:
|
|
103
95
|
|
|
104
96
|
```env
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
REDIS_URL=redis://localhost:6379
|
|
110
|
-
JWT_SECRET=supersecret
|
|
111
|
-
COOKIE_SECRET=supersecret
|
|
112
|
-
DATABASE_URL=postgres://postgres:root@localhost/medusa-medusa-backend
|
|
113
|
-
|
|
114
|
-
MEDUSA_ADMIN_ONBOARDING_TYPE=nextjs
|
|
115
|
-
MEDUSA_ADMIN_ONBOARDING_NEXTJS_DIRECTORY=medusa-backend-storefront
|
|
97
|
+
# Required
|
|
98
|
+
MEDUSA_BACKEND_URL=https://your-medusa-server.com
|
|
99
|
+
STOREFRONT_URL=https://your-storefront.com
|
|
116
100
|
|
|
101
|
+
# Recommended for production
|
|
102
|
+
PAYPAL_CREDENTIALS_ENCRYPTION_KEY=your-64-char-hex-key
|
|
117
103
|
PAYPAL_CURRENCY=EUR
|
|
118
104
|
```
|
|
119
105
|
|
|
120
|
-
|
|
106
|
+
> Generate an encryption key with: `openssl rand -hex 32`
|
|
121
107
|
|
|
122
|
-
|
|
108
|
+
---
|
|
123
109
|
|
|
124
|
-
Run
|
|
110
|
+
## Step 4 — Run database migrations
|
|
125
111
|
|
|
126
112
|
```bash
|
|
127
|
-
|
|
113
|
+
npx medusa db:migrate
|
|
128
114
|
```
|
|
129
115
|
|
|
130
|
-
Then open Medusa Admin.
|
|
131
|
-
|
|
132
116
|
---
|
|
133
117
|
|
|
134
|
-
##
|
|
135
|
-
|
|
136
|
-
After installation, configure PayPal from the Medusa Admin PayPal settings pages.
|
|
137
|
-
|
|
138
|
-
### PayPal Wallet
|
|
139
|
-
|
|
140
|
-
Available settings include:
|
|
141
|
-
|
|
142
|
-
- `enabled`
|
|
143
|
-
- `title`
|
|
144
|
-
- `disableButtons`
|
|
145
|
-
- `buttonColor`
|
|
146
|
-
- `buttonShape`
|
|
147
|
-
- `buttonWidth`
|
|
148
|
-
- `buttonHeight`
|
|
149
|
-
- `buttonLabel`
|
|
150
|
-
|
|
151
|
-
### Advanced Card Payments
|
|
152
|
-
|
|
153
|
-
Available settings include:
|
|
118
|
+
## Step 5 — Connect your PayPal account
|
|
154
119
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
120
|
+
1. Start your Medusa server
|
|
121
|
+
2. Open Medusa Admin → **Settings → PayPal → PayPal Connection**
|
|
122
|
+
3. Choose **Sandbox** (testing) or **Live** (production)
|
|
123
|
+
4. Click **Connect to PayPal** and complete the PayPal onboarding flow
|
|
158
124
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
Available settings include:
|
|
162
|
-
|
|
163
|
-
- `paymentAction` (`capture` or `authorize`)
|
|
164
|
-
- `brandName`
|
|
165
|
-
- `landingPage`
|
|
166
|
-
- `requireInstantPayment`
|
|
167
|
-
- `sendItemDetails`
|
|
168
|
-
- `invoicePrefix`
|
|
169
|
-
- `creditCardStatementName`
|
|
125
|
+
Credentials are saved automatically. To connect manually instead, click **Insert credentials manually** and paste your Client ID and Secret from [developer.paypal.com](https://developer.paypal.com).
|
|
170
126
|
|
|
171
127
|
---
|
|
172
128
|
|
|
173
|
-
##
|
|
174
|
-
|
|
175
|
-
With the default configuration shown above, the generated Medusa provider IDs are:
|
|
129
|
+
## Step 6 — Enable providers in your region
|
|
176
130
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
Use these exact provider IDs in your storefront unless you change the provider `id` values in `medusa-config.ts`.
|
|
131
|
+
1. Medusa Admin → **Settings → Regions → [your region]**
|
|
132
|
+
2. Under **Payment Providers**, enable:
|
|
133
|
+
- `pp_paypal_paypal` — PayPal Smart Buttons
|
|
134
|
+
- `pp_paypal_card_paypal_card` — Advanced Card Fields
|
|
183
135
|
|
|
184
136
|
---
|
|
185
137
|
|
|
186
|
-
##
|
|
187
|
-
|
|
188
|
-
When creating a payment session, use one of the generated provider IDs.
|
|
138
|
+
## Step 7 — Configure settings (optional)
|
|
189
139
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
```json
|
|
193
|
-
{
|
|
194
|
-
"provider_id": "pp_paypal_paypal"
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
Example for PayPal Card:
|
|
199
|
-
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"provider_id": "pp_paypal_card_paypal_card"
|
|
203
|
-
}
|
|
204
|
-
```
|
|
140
|
+
All settings are in Medusa Admin → **Settings → PayPal** and take effect immediately with no server restart.
|
|
205
141
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
Example endpoint:
|
|
213
|
-
|
|
214
|
-
```http
|
|
215
|
-
POST /store/payment-collections/{id}/payment-sessions
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
Example body:
|
|
219
|
-
|
|
220
|
-
```json
|
|
221
|
-
{
|
|
222
|
-
"provider_id": "pp_paypal_paypal"
|
|
223
|
-
}
|
|
224
|
-
```
|
|
142
|
+
| Tab | What you can configure |
|
|
143
|
+
|---|---|
|
|
144
|
+
| **PayPal Settings** | Enable/disable, button color, shape, label |
|
|
145
|
+
| **Advanced Card Payments** | Enable/disable, 3D Secure mode |
|
|
146
|
+
| **Additional Settings** | Payment action (capture / authorize), brand name, invoice prefix |
|
|
225
147
|
|
|
226
148
|
---
|
|
227
149
|
|
|
228
|
-
##
|
|
150
|
+
## Step 8 — Connect the frontend package
|
|
229
151
|
|
|
230
|
-
|
|
231
|
-
- Register the plugin in `medusa-config.ts`
|
|
232
|
-
- Register both payment providers
|
|
233
|
-
- Add required environment variables
|
|
234
|
-
- Start the Medusa backend
|
|
235
|
-
- Configure PayPal in Admin
|
|
236
|
-
- Use the correct provider IDs in the storefront
|
|
152
|
+
Install the storefront UI package to render PayPal at checkout:
|
|
237
153
|
|
|
238
|
-
|
|
154
|
+
```bash
|
|
155
|
+
npm install @easypayment/medusa-paypal-ui
|
|
156
|
+
```
|
|
239
157
|
|
|
240
|
-
|
|
158
|
+
See the [medusa-paypal-frontend README](../medusa-paypal-frontend/README.md) for integration steps.
|
|
241
159
|
|
|
242
|
-
|
|
160
|
+
---
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@easypayment/medusa-paypal",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "Industry-standard PayPal integration for Medusa v2",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"main": "./.medusa/server/src/index.js",
|
|
7
|
-
"types": "./.medusa/server/src/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
".medusa/server",
|
|
10
|
-
"src",
|
|
11
|
-
"scripts",
|
|
12
|
-
"package.json",
|
|
13
|
-
"README.md",
|
|
14
|
-
"LICENSE",
|
|
15
|
-
"tsconfig.json"
|
|
16
|
-
],
|
|
17
|
-
"exports": {
|
|
18
|
-
"./package.json": "./package.json",
|
|
19
|
-
"./admin": "./.medusa/server/src/admin/index.mjs",
|
|
20
|
-
"./workflows": "./.medusa/server/src/workflows/index.js",
|
|
21
|
-
"./providers/paypal": "./.medusa/server/src/providers/paypal/index.js",
|
|
22
|
-
"./providers/paypal_card": "./.medusa/server/src/providers/paypal_card/index.js",
|
|
23
|
-
"./modules/paypal": "./.medusa/server/src/modules/paypal/index.js",
|
|
24
|
-
".": "./.medusa/server/src/index.js",
|
|
25
|
-
"./.medusa/server/src/modules/*": "./.medusa/server/src/modules/*/index.js",
|
|
26
|
-
"./.medusa/server/src/modules/paypal": "./.medusa/server/src/modules/paypal/index.js",
|
|
27
|
-
"./.medusa/server/src/providers/*": "./.medusa/server/src/providers/*/index.js",
|
|
28
|
-
"./.medusa/server/src/providers/paypal": "./.medusa/server/src/providers/paypal/index.js",
|
|
29
|
-
"./.medusa/server/src/providers/paypal_card": "./.medusa/server/src/providers/paypal_card/index.js",
|
|
30
|
-
"./.medusa/server/src/admin": "./.medusa/server/src/admin/index.mjs",
|
|
31
|
-
"./.medusa/server/src/workflows": "./.medusa/server/src/workflows/index.js",
|
|
32
|
-
"./.medusa/server/src/*": "./.medusa/server/src/*.js",
|
|
33
|
-
"./.medusa/*": "./.medusa/*"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "medusa plugin:build",
|
|
37
|
-
"develop": "medusa plugin:develop",
|
|
38
|
-
"prepublishOnly": "npm run build"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@medusajs/admin-sdk": "2.12.5",
|
|
42
|
-
"@medusajs/cli": "2.12.5",
|
|
43
|
-
"@medusajs/framework": "2.12.5",
|
|
44
|
-
"@medusajs/medusa": "2.12.5",
|
|
45
|
-
"@medusajs/test-utils": "2.12.5",
|
|
46
|
-
"@medusajs/ui": "^4.0.0",
|
|
47
|
-
"@medusajs/icons": "2.12.5",
|
|
48
|
-
"@swc/core": "^1.5.7",
|
|
49
|
-
"typescript": "^5.6.2"
|
|
50
|
-
},
|
|
51
|
-
"peerDependencies": {
|
|
52
|
-
"@medusajs/admin-sdk": "^2.12.0",
|
|
53
|
-
"@medusajs/framework": "^2.12.0",
|
|
54
|
-
"@medusajs/medusa": "^2.12.0",
|
|
55
|
-
"@medusajs/ui": "^4.0.0",
|
|
56
|
-
"@medusajs/icons": "^2.12.0"
|
|
57
|
-
},
|
|
58
|
-
"publishConfig": {
|
|
59
|
-
"access": "public"
|
|
60
|
-
},
|
|
61
|
-
"engines": {
|
|
62
|
-
"node": ">=20"
|
|
63
|
-
},
|
|
64
|
-
"repository": {
|
|
65
|
-
"type": "git",
|
|
66
|
-
"url": "https://github.com/easypayment/medusa-paypal.git"
|
|
67
|
-
},
|
|
68
|
-
"keywords": [
|
|
69
|
-
"medusa-plugin-integration",
|
|
70
|
-
"medusa-v2",
|
|
71
|
-
"medusa-plugin-payment"
|
|
72
|
-
]
|
|
73
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@easypayment/medusa-paypal",
|
|
3
|
+
"version": "0.6.2",
|
|
4
|
+
"description": "Industry-standard PayPal integration for Medusa v2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./.medusa/server/src/index.js",
|
|
7
|
+
"types": "./.medusa/server/src/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
".medusa/server",
|
|
10
|
+
"src",
|
|
11
|
+
"scripts",
|
|
12
|
+
"package.json",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"tsconfig.json"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": "./package.json",
|
|
19
|
+
"./admin": "./.medusa/server/src/admin/index.mjs",
|
|
20
|
+
"./workflows": "./.medusa/server/src/workflows/index.js",
|
|
21
|
+
"./providers/paypal": "./.medusa/server/src/providers/paypal/index.js",
|
|
22
|
+
"./providers/paypal_card": "./.medusa/server/src/providers/paypal_card/index.js",
|
|
23
|
+
"./modules/paypal": "./.medusa/server/src/modules/paypal/index.js",
|
|
24
|
+
".": "./.medusa/server/src/index.js",
|
|
25
|
+
"./.medusa/server/src/modules/*": "./.medusa/server/src/modules/*/index.js",
|
|
26
|
+
"./.medusa/server/src/modules/paypal": "./.medusa/server/src/modules/paypal/index.js",
|
|
27
|
+
"./.medusa/server/src/providers/*": "./.medusa/server/src/providers/*/index.js",
|
|
28
|
+
"./.medusa/server/src/providers/paypal": "./.medusa/server/src/providers/paypal/index.js",
|
|
29
|
+
"./.medusa/server/src/providers/paypal_card": "./.medusa/server/src/providers/paypal_card/index.js",
|
|
30
|
+
"./.medusa/server/src/admin": "./.medusa/server/src/admin/index.mjs",
|
|
31
|
+
"./.medusa/server/src/workflows": "./.medusa/server/src/workflows/index.js",
|
|
32
|
+
"./.medusa/server/src/*": "./.medusa/server/src/*.js",
|
|
33
|
+
"./.medusa/*": "./.medusa/*"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "medusa plugin:build",
|
|
37
|
+
"develop": "medusa plugin:develop",
|
|
38
|
+
"prepublishOnly": "npm run build"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@medusajs/admin-sdk": "2.12.5",
|
|
42
|
+
"@medusajs/cli": "2.12.5",
|
|
43
|
+
"@medusajs/framework": "2.12.5",
|
|
44
|
+
"@medusajs/medusa": "2.12.5",
|
|
45
|
+
"@medusajs/test-utils": "2.12.5",
|
|
46
|
+
"@medusajs/ui": "^4.0.0",
|
|
47
|
+
"@medusajs/icons": "2.12.5",
|
|
48
|
+
"@swc/core": "^1.5.7",
|
|
49
|
+
"typescript": "^5.6.2"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@medusajs/admin-sdk": "^2.12.0",
|
|
53
|
+
"@medusajs/framework": "^2.12.0",
|
|
54
|
+
"@medusajs/medusa": "^2.12.0",
|
|
55
|
+
"@medusajs/ui": "^4.0.0",
|
|
56
|
+
"@medusajs/icons": "^2.12.0"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=20"
|
|
63
|
+
},
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "https://github.com/easypayment/medusa-paypal.git"
|
|
67
|
+
},
|
|
68
|
+
"keywords": [
|
|
69
|
+
"medusa-plugin-integration",
|
|
70
|
+
"medusa-v2",
|
|
71
|
+
"medusa-plugin-payment"
|
|
72
|
+
]
|
|
73
|
+
}
|