@easypayment/medusa-payment-paypal 1.2.3 → 1.2.5
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 +392 -138
- package/.medusa/server/src/admin/index.mjs +392 -138
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts +1 -0
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js +5 -1
- package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts +1 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/disconnect/route.js +1 -0
- package/.medusa/server/src/api/admin/paypal/disconnect/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/environment/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/environment/route.js +2 -0
- package/.medusa/server/src/api/admin/paypal/environment/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts +9 -0
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js +9 -4
- package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts +7 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js +9 -2
- package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js +1 -0
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts +1 -0
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.js +10 -3
- package/.medusa/server/src/api/admin/paypal/save-credentials/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/settings/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/paypal/settings/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/settings/route.js +9 -2
- package/.medusa/server/src/api/admin/paypal/settings/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/status/route.d.ts +4 -0
- package/.medusa/server/src/api/admin/paypal/status/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/status/route.js +9 -1
- package/.medusa/server/src/api/admin/paypal/status/route.js.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts +4 -0
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js +11 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts +8 -0
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/capture-order/route.js +23 -3
- package/.medusa/server/src/api/store/paypal/capture-order/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.d.ts +5 -0
- package/.medusa/server/src/api/store/paypal/config/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.js +12 -5
- package/.medusa/server/src/api/store/paypal/config/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts +8 -0
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.js +80 -26
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/onboard-return/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/onboard-return/route.js +19 -19
- package/.medusa/server/src/api/store/paypal/onboard-return/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/settings/route.d.ts +1 -0
- package/.medusa/server/src/api/store/paypal/settings/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/settings/route.js +4 -1
- package/.medusa/server/src/api/store/paypal/settings/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/webhook/route.d.ts +7 -0
- package/.medusa/server/src/api/store/paypal/webhook/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/webhook/route.js +34 -3
- package/.medusa/server/src/api/store/paypal/webhook/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.d.ts +8 -0
- package/.medusa/server/src/api/store/paypal-complete/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.js +55 -8
- package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -1
- package/.medusa/server/src/api/utils/rate-limit.d.ts +4 -0
- package/.medusa/server/src/api/utils/rate-limit.d.ts.map +1 -1
- package/.medusa/server/src/api/utils/rate-limit.js +9 -4
- package/.medusa/server/src/api/utils/rate-limit.js.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts +5 -0
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.js +13 -2
- package/.medusa/server/src/jobs/paypal-webhook-retry.js.map +1 -1
- package/.medusa/server/src/modules/paypal/index.d.ts +1 -0
- package/.medusa/server/src/modules/paypal/index.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/index.js +1 -0
- package/.medusa/server/src/modules/paypal/index.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20260115120000_create_paypal_connection.js +22 -22
- package/.medusa/server/src/modules/paypal/migrations/20260123090000_create_paypal_settings.js +11 -11
- package/.medusa/server/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.js +18 -18
- package/.medusa/server/src/modules/paypal/migrations/20260401090000_create_paypal_metric.js +16 -16
- package/.medusa/server/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.js +20 -20
- package/.medusa/server/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.js +14 -14
- package/.medusa/server/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.js +15 -15
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.js +6 -6
- package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_connection.js +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_connection.js.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts +4 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_metric.js +4 -0
- package/.medusa/server/src/modules/paypal/models/paypal_metric.js.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_settings.js +5 -0
- package/.medusa/server/src/modules/paypal/models/paypal_settings.js.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts +7 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js +7 -0
- package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts +24 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js +296 -0
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts +14 -7
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +40 -198
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts +6 -1
- package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/index.js +6 -4
- package/.medusa/server/src/modules/paypal/payment-provider/index.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts +9 -2
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +29 -181
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.d.ts +21 -0
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.js +54 -0
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.js.map +1 -1
- package/.medusa/server/src/modules/paypal/service.d.ts +72 -2
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +159 -33
- package/.medusa/server/src/modules/paypal/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.d.ts +2 -0
- package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.js +5 -2
- package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/amounts.d.ts +1 -0
- package/.medusa/server/src/modules/paypal/utils/amounts.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/amounts.js +15 -5
- package/.medusa/server/src/modules/paypal/utils/amounts.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts +10 -0
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js +45 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/currencies.d.ts +9 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/currencies.js +13 -0
- package/.medusa/server/src/modules/paypal/utils/currencies.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/payment-session.d.ts +12 -0
- package/.medusa/server/src/modules/paypal/utils/payment-session.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/payment-session.js +4 -3
- package/.medusa/server/src/modules/paypal/utils/payment-session.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts +1 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.js +1 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-auth.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts +11 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js +17 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js +6 -0
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.d.ts +2 -0
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.js +6 -1
- package/.medusa/server/src/modules/paypal/utils/secret-crypto.js.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +43 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.js +57 -5
- package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -1
- package/.medusa/server/src/providers/paypal/index.d.ts +1 -0
- package/.medusa/server/src/providers/paypal/index.d.ts.map +1 -1
- package/.medusa/server/src/providers/paypal/index.js +1 -0
- package/.medusa/server/src/providers/paypal/index.js.map +1 -1
- package/.medusa/server/src/providers/paypal_card/index.d.ts +1 -0
- package/.medusa/server/src/providers/paypal_card/index.d.ts.map +1 -1
- package/.medusa/server/src/providers/paypal_card/index.js +1 -0
- package/.medusa/server/src/providers/paypal_card/index.js.map +1 -1
- package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts +6 -0
- package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts.map +1 -1
- package/.medusa/server/src/subscribers/paypal-order-invoice.js +9 -1
- package/.medusa/server/src/subscribers/paypal-order-invoice.js.map +1 -1
- package/.medusa/server/src/subscribers/paypal-webhook-process.d.ts +1 -0
- package/.medusa/server/src/subscribers/paypal-webhook-process.d.ts.map +1 -1
- package/.medusa/server/src/subscribers/paypal-webhook-process.js +17 -4
- package/.medusa/server/src/subscribers/paypal-webhook-process.js.map +1 -1
- package/CHANGELOG.md +65 -0
- package/README.md +184 -184
- package/package.json +7 -4
- package/src/admin/index.ts +1 -1
- package/src/admin/routes/settings/paypal/_components/FieldRow.tsx +38 -29
- package/src/admin/routes/settings/paypal/_components/SectionCard.tsx +29 -26
- package/src/admin/routes/settings/paypal/_components/Tabs.tsx +49 -48
- package/src/admin/routes/settings/paypal/_components/Toast.tsx +63 -52
- package/src/admin/routes/settings/paypal/_utils/adminFetch.ts +52 -32
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +246 -139
- package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +208 -123
- package/src/admin/routes/settings/paypal/apple-pay/page.tsx +9 -5
- package/src/admin/routes/settings/paypal/connection/page.tsx +974 -908
- package/src/admin/routes/settings/paypal/google-pay/page.tsx +9 -5
- package/src/admin/routes/settings/paypal/page.tsx +14 -13
- package/src/admin/routes/settings/paypal/pay-later-messaging/page.tsx +9 -5
- package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +304 -273
- package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +48 -39
- package/src/api/admin/paypal/disconnect/route.ts +15 -14
- package/src/api/admin/paypal/environment/route.ts +34 -32
- package/src/api/admin/paypal/onboard-complete/route.ts +61 -50
- package/src/api/admin/paypal/onboarding-link/route.ts +91 -76
- package/src/api/admin/paypal/onboarding-status/route.ts +21 -20
- package/src/api/admin/paypal/save-credentials/route.ts +48 -37
- package/src/api/admin/paypal/settings/route.ts +63 -45
- package/src/api/admin/paypal/status/route.ts +29 -17
- package/src/api/hooks/paypal/onboard-return/route.ts +15 -15
- package/src/api/hooks/paypal/webhook/route.ts +17 -17
- package/src/api/middlewares.ts +61 -61
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +69 -54
- package/src/api/store/paypal/capture-order/route.ts +416 -370
- package/src/api/store/paypal/config/route.ts +121 -115
- package/src/api/store/paypal/create-order/route.ts +611 -539
- package/src/api/store/paypal/onboard-return/route.ts +116 -113
- package/src/api/store/paypal/settings/route.ts +29 -19
- package/src/api/store/paypal/webhook/route.ts +380 -314
- package/src/api/store/paypal-complete/route.ts +184 -128
- package/src/api/utils/rate-limit.ts +143 -129
- package/src/index.ts +1 -1
- package/src/jobs/paypal-webhook-retry.ts +257 -241
- package/src/modules/paypal/index.ts +9 -8
- package/src/modules/paypal/migrations/20260115120000_create_paypal_connection.ts +33 -33
- package/src/modules/paypal/migrations/20260123090000_create_paypal_settings.ts +22 -22
- package/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.ts +29 -29
- package/src/modules/paypal/migrations/20260401090000_create_paypal_metric.ts +27 -27
- package/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.ts +31 -31
- package/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.ts +25 -25
- package/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.ts +26 -26
- package/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.ts +15 -11
- package/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.ts +15 -11
- package/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.ts +15 -11
- package/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.ts +17 -17
- package/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.ts +44 -44
- package/src/modules/paypal/migrations/20270301000000_add_webhook_transmission_id_index.ts +15 -15
- package/src/modules/paypal/models/paypal_connection.ts +28 -23
- package/src/modules/paypal/models/paypal_metric.ts +13 -9
- package/src/modules/paypal/models/paypal_settings.ts +13 -8
- package/src/modules/paypal/models/paypal_webhook_event.ts +26 -19
- package/src/modules/paypal/payment-provider/base-provider.ts +700 -275
- package/src/modules/paypal/payment-provider/card-service.ts +693 -855
- package/src/modules/paypal/payment-provider/index.ts +14 -15
- package/src/modules/paypal/payment-provider/service.ts +673 -836
- package/src/modules/paypal/payment-provider/status-utils.ts +116 -59
- package/src/modules/paypal/payment-provider/webhook-utils.ts +109 -109
- package/src/modules/paypal/service.ts +362 -115
- package/src/modules/paypal/types/config.ts +70 -65
- package/src/modules/paypal/utils/amounts.ts +123 -107
- package/src/modules/paypal/utils/core-workflow.ts +46 -46
- package/src/modules/paypal/utils/credential-resolver.ts +315 -271
- package/src/modules/paypal/utils/currencies.ts +97 -84
- package/src/modules/paypal/utils/partner.ts +8 -8
- package/src/modules/paypal/utils/payment-session.ts +144 -138
- package/src/modules/paypal/utils/paypal-auth.ts +6 -5
- package/src/modules/paypal/utils/paypal-fetch.ts +197 -181
- package/src/modules/paypal/utils/provider-ids.ts +21 -15
- package/src/modules/paypal/utils/secret-crypto.ts +226 -197
- package/src/modules/paypal/utils/webhook-verify.ts +61 -61
- package/src/modules/paypal/webhook-processor.ts +641 -573
- package/src/providers/paypal/index.ts +9 -8
- package/src/providers/paypal_card/index.ts +9 -8
- package/src/subscribers/paypal-order-invoice.ts +180 -173
- package/src/subscribers/paypal-webhook-process.ts +147 -131
- package/tsconfig.json +21 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/providers/paypal_card/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oDAAoD,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/providers/paypal_card/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oDAAoD,CAAA;AAE/F,kFAAkF;;AAClF,wBAEE;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAA"}
|
|
@@ -4,6 +4,7 @@ exports.PayPalAdvancedCardProvider = void 0;
|
|
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
const card_service_1 = require("../../modules/paypal/payment-provider/card-service");
|
|
6
6
|
Object.defineProperty(exports, "PayPalAdvancedCardProvider", { enumerable: true, get: function () { return card_service_1.PayPalAdvancedCardProvider; } });
|
|
7
|
+
/** Payment-module provider entry for the PayPal Advanced Card Fields provider. */
|
|
7
8
|
exports.default = (0, utils_1.ModuleProvider)(utils_1.Modules.PAYMENT, {
|
|
8
9
|
services: [card_service_1.PayPalAdvancedCardProvider],
|
|
9
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/providers/paypal_card/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AACnE,qFAA+F;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/providers/paypal_card/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmE;AACnE,qFAA+F;AAOtF,2GAPA,yCAA0B,OAOA;AALnC,kFAAkF;AAClF,kBAAe,IAAA,sBAAc,EAAC,eAAO,CAAC,OAAO,EAAE;IAC7C,QAAQ,EAAE,CAAC,yCAA0B,CAAC;CACvC,CAAC,CAAA"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { SubscriberArgs, SubscriberConfig } from "@medusajs/framework";
|
|
2
|
+
/**
|
|
3
|
+
* On `order.placed`, stamp the Medusa order's display id (with the configured
|
|
4
|
+
* invoice prefix) onto the PayPal order as `invoice_id`, so the two are easy
|
|
5
|
+
* to reconcile from the PayPal dashboard. Best-effort: a captured order is
|
|
6
|
+
* immutable at PayPal, in which case the mapping is logged instead.
|
|
7
|
+
*/
|
|
2
8
|
export default function paypalOrderInvoiceHandler({ event, container, }: SubscriberArgs<{
|
|
3
9
|
id: string;
|
|
4
10
|
}>): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paypal-order-invoice.d.ts","sourceRoot":"","sources":["../../../../src/subscribers/paypal-order-invoice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"paypal-order-invoice.d.ts","sourceRoot":"","sources":["../../../../src/subscribers/paypal-order-invoice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAS3E;;;;;GAKG;AACH,wBAA8B,yBAAyB,CAAC,EACtD,KAAK,EACL,SAAS,GACV,EAAE,cAAc,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,iBA6JhC;AAED,eAAO,MAAM,MAAM,EAAE,gBAEpB,CAAA"}
|
|
@@ -5,7 +5,14 @@ exports.default = paypalOrderInvoiceHandler;
|
|
|
5
5
|
const paypal_auth_1 = require("../modules/paypal/utils/paypal-auth");
|
|
6
6
|
const paypal_fetch_1 = require("../modules/paypal/utils/paypal-fetch");
|
|
7
7
|
const provider_ids_1 = require("../modules/paypal/utils/provider-ids");
|
|
8
|
+
/** PayPal order statuses that still accept a `purchase_units` PATCH. */
|
|
8
9
|
const PATCHABLE_STATUSES = new Set(["CREATED", "APPROVED", "SAVED"]);
|
|
10
|
+
/**
|
|
11
|
+
* On `order.placed`, stamp the Medusa order's display id (with the configured
|
|
12
|
+
* invoice prefix) onto the PayPal order as `invoice_id`, so the two are easy
|
|
13
|
+
* to reconcile from the PayPal dashboard. Best-effort: a captured order is
|
|
14
|
+
* immutable at PayPal, in which case the mapping is logged instead.
|
|
15
|
+
*/
|
|
9
16
|
async function paypalOrderInvoiceHandler({ event, container, }) {
|
|
10
17
|
const orderId = event?.data?.id;
|
|
11
18
|
if (!orderId)
|
|
@@ -48,7 +55,8 @@ async function paypalOrderInvoiceHandler({ event, container, }) {
|
|
|
48
55
|
const settingsData = settings && typeof settings === "object" && "data" in settings
|
|
49
56
|
? (settings.data ?? {})
|
|
50
57
|
: {};
|
|
51
|
-
const additionalSettings = (settingsData.additional_settings ||
|
|
58
|
+
const additionalSettings = (settingsData.additional_settings ||
|
|
59
|
+
{});
|
|
52
60
|
const invoicePrefix = typeof additionalSettings.invoicePrefix === "string"
|
|
53
61
|
? additionalSettings.invoicePrefix
|
|
54
62
|
: "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paypal-order-invoice.js","sourceRoot":"","sources":["../../../../src/subscribers/paypal-order-invoice.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"paypal-order-invoice.js","sourceRoot":"","sources":["../../../../src/subscribers/paypal-order-invoice.ts"],"names":[],"mappings":";;;AAeA,4CAgKC;AA7KD,qEAAsE;AACtE,uEAAkE;AAClE,uEAAyE;AAEzE,wEAAwE;AACxE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;AAEpE;;;;;GAKG;AACY,KAAK,UAAU,yBAAyB,CAAC,EACtD,KAAK,EACL,SAAS,GACsB;IAC/B,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,CAAA;IAC/B,IAAI,CAAC,OAAO;QAAE,OAAM;IAEpB,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAQ,CAAA;QAC/C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;QAE1E,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;YACzC,MAAM,EAAE,OAAO;YACf,MAAM,EAAE;gBACN,IAAI;gBACJ,YAAY;gBACZ,yCAAyC;gBACzC,2CAA2C;gBAC3C,kDAAkD;gBAClD,6CAA6C;gBAC7C,iDAAiD;aAClD;YACD,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;SACzB,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;QACzB,IAAI,CAAC,KAAK;YAAE,OAAM;QAElB,MAAM,QAAQ,GA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G,CACzD,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;YACtD,OAAO,CAAC,IAAI,CAAC,kCAAkC,EAAE;gBAC/C,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,aAAa;gBACb,SAAS;gBACT,iBAAiB;gBACjB,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,2CAA2C,EAAE,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,CAAA;IAC5E,CAAC;AACH,CAAC;AAEY,QAAA,MAAM,GAAqB;IACtC,KAAK,EAAE,cAAc;CACtB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SubscriberArgs, SubscriberConfig } from "@medusajs/framework";
|
|
2
|
+
/** Emitted by the webhook route once an event is verified and persisted. */
|
|
2
3
|
export declare const PAYPAL_WEBHOOK_RECEIVED_EVENT = "paypal.webhook.received";
|
|
3
4
|
/**
|
|
4
5
|
* Asynchronous PayPal webhook processing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paypal-webhook-process.d.ts","sourceRoot":"","sources":["../../../../src/subscribers/paypal-webhook-process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAS3E,eAAO,MAAM,6BAA6B,4BAA4B,CAAA;AAEtE;;;;;;;;;;;GAWG;AACH,wBAA8B,2BAA2B,CAAC,EACxD,KAAK,EACL,SAAS,GACV,EAAE,cAAc,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"paypal-webhook-process.d.ts","sourceRoot":"","sources":["../../../../src/subscribers/paypal-webhook-process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAS3E,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,4BAA4B,CAAA;AAEtE;;;;;;;;;;;GAWG;AACH,wBAA8B,2BAA2B,CAAC,EACxD,KAAK,EACL,SAAS,GACV,EAAE,cAAc,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,iBAmHhC;AAED,eAAO,MAAM,MAAM,EAAE,gBAEpB,CAAA"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.config = exports.PAYPAL_WEBHOOK_RECEIVED_EVENT = void 0;
|
|
4
4
|
exports.default = paypalWebhookProcessHandler;
|
|
5
5
|
const webhook_processor_1 = require("../modules/paypal/webhook-processor");
|
|
6
|
+
/** Emitted by the webhook route once an event is verified and persisted. */
|
|
6
7
|
exports.PAYPAL_WEBHOOK_RECEIVED_EVENT = "paypal.webhook.received";
|
|
7
8
|
/**
|
|
8
9
|
* Asynchronous PayPal webhook processing.
|
|
@@ -34,7 +35,9 @@ async function paypalWebhookProcessHandler({ event, container, }) {
|
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
if (!record) {
|
|
37
|
-
console.warn("[PayPal] webhook subscriber: event not found", {
|
|
38
|
+
console.warn("[PayPal] webhook subscriber: event not found", {
|
|
39
|
+
id: recordId,
|
|
40
|
+
});
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
43
|
// Only process events still queued for the first attempt. Anything already
|
|
@@ -46,19 +49,29 @@ async function paypalWebhookProcessHandler({ event, container, }) {
|
|
|
46
49
|
const eventType = String(record.event_type || "");
|
|
47
50
|
if (!(0, webhook_processor_1.isAllowedEventType)(eventType)) {
|
|
48
51
|
await paypal
|
|
49
|
-
.updateWebhookEventRecord({
|
|
52
|
+
.updateWebhookEventRecord({
|
|
53
|
+
id: recordId,
|
|
54
|
+
status: "ignored",
|
|
55
|
+
processed_at: new Date(),
|
|
56
|
+
})
|
|
50
57
|
.catch(() => { });
|
|
51
58
|
return;
|
|
52
59
|
}
|
|
53
60
|
try {
|
|
54
61
|
const payload = (record.payload || {});
|
|
55
|
-
const processed = await (0, webhook_processor_1.processPayPalWebhookEvent)(container, {
|
|
62
|
+
const processed = await (0, webhook_processor_1.processPayPalWebhookEvent)(container, {
|
|
63
|
+
eventType,
|
|
64
|
+
payload,
|
|
65
|
+
});
|
|
56
66
|
await paypal
|
|
57
67
|
.updateWebhookEventRecord({
|
|
58
68
|
id: recordId,
|
|
59
69
|
status: "processed",
|
|
60
70
|
processed_at: new Date(),
|
|
61
|
-
resource_id: processed.refundId ||
|
|
71
|
+
resource_id: processed.refundId ||
|
|
72
|
+
processed.captureId ||
|
|
73
|
+
processed.orderId ||
|
|
74
|
+
null,
|
|
62
75
|
})
|
|
63
76
|
.catch(() => { });
|
|
64
77
|
console.info("[PayPal] webhook: processed (async)", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paypal-webhook-process.js","sourceRoot":"","sources":["../../../../src/subscribers/paypal-webhook-process.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"paypal-webhook-process.js","sourceRoot":"","sources":["../../../../src/subscribers/paypal-webhook-process.ts"],"names":[],"mappings":";;;AAwBA,8CAsHC;AA5ID,2EAK4C;AAE5C,4EAA4E;AAC/D,QAAA,6BAA6B,GAAG,yBAAyB,CAAA;AAEtE;;;;;;;;;;;GAWG;AACY,KAAK,UAAU,2BAA2B,CAAC,EACxD,KAAK,EACL,SAAS,GACsB;IAC/B,MAAM,QAAQ,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,CAAA;IAChC,IAAI,CAAC,QAAQ;QAAE,OAAM;IAErB,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;IAE1E,IAAI,MAAW,CAAA;IACf,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,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,CAAC,CAAC,IAAI;YACvD,UAAU,EAAE,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC;SACpC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAElB,MAAM,MAAM;aACT,gBAAgB,CAAC,2BAA2B,EAAE;YAC7C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,UAAU,EAAE,SAAS;YACrB,SAAS;YACT,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC;SACjC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAElB,MAAM,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAE3D,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE;YAC3D,EAAE,EAAE,QAAQ;YACZ,UAAU,EAAE,SAAS;YACrB,SAAS;YACT,KAAK,EAAE,CAAC,EAAE,OAAO;SAClB,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAEY,QAAA,MAAM,GAAqB;IACtC,KAAK,EAAE,qCAA6B;CACrC,CAAA"}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@easypayment/medusa-payment-paypal` are documented here.
|
|
4
4
|
|
|
5
|
+
## 1.2.5 — 2026-09-14
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Partial captures after the first one were never sent to PayPal.** Both
|
|
9
|
+
providers' `capturePayment` short-circuited whenever the session already
|
|
10
|
+
carried a `capture_id` — which is always the case after a first partial
|
|
11
|
+
capture — and reported success without calling PayPal. Medusa then showed
|
|
12
|
+
the full amount as captured while PayPal had only taken the first slice
|
|
13
|
+
(reproduced: 20 + 30 on a 50 EUR authorization → Medusa 50 captured, PayPal
|
|
14
|
+
20). Capture decisions are now driven by what PayPal actually holds for the
|
|
15
|
+
order, reconciled against Medusa's own capture ledger: the remaining amount
|
|
16
|
+
is captured, a request above what remains is refused (not silently
|
|
17
|
+
clamped), a fully-captured order is an idempotent success, and funds that
|
|
18
|
+
are still PENDING are never booked as captured. Money PayPal holds that
|
|
19
|
+
Medusa has not booked — a capture whose Medusa write failed and is being
|
|
20
|
+
retried with a fresh capture row (fresh `PayPal-Request-Id`), or a
|
|
21
|
+
storefront capture the session never recorded — is treated as the capture
|
|
22
|
+
being booked instead of being taken from the buyer a second time. The
|
|
23
|
+
capture that exhausts the session amount now closes the authorization
|
|
24
|
+
(`final_capture`). The logic lives once in the shared base provider instead
|
|
25
|
+
of two diverging copies.
|
|
26
|
+
|
|
27
|
+
> **Upgrade note:** if you used partial captures on 1.2.4 or earlier, Medusa
|
|
28
|
+
> may show more captured than PayPal actually took. Check PayPal for
|
|
29
|
+
> authorizations still in `PARTIALLY_CAPTURED` state and capture the
|
|
30
|
+
> remainder from the PayPal dashboard; the plugin cannot repair those
|
|
31
|
+
> retroactively because Medusa already considers them fully captured.
|
|
32
|
+
- **Line items sent to PayPal no longer include a bogus "Line Item Amount
|
|
33
|
+
Offset" or a fabricated `shipping_discount`.** Medusa v2's `cart.subtotal`
|
|
34
|
+
includes shipping and `shipping_total` includes the tax on shipping (which
|
|
35
|
+
`tax_total` also carries), so with **Send Item Details** on every cart with
|
|
36
|
+
a shipping charge got an offset item worth the shipping fee plus a fake
|
|
37
|
+
discount to make the totals balance. The breakdown now uses `item_subtotal`,
|
|
38
|
+
the pre-tax `shipping_subtotal` and `discount_subtotal` — the figures
|
|
39
|
+
Medusa's own total is built from — so `item_total + shipping + tax_total −
|
|
40
|
+
discount` equals the order total exactly (verified with tax, promotion and
|
|
41
|
+
shipping combined). The previous drift reconciliation is kept as a safety
|
|
42
|
+
net.
|
|
43
|
+
- **`POST /store/paypal-complete` no longer claims "Payment was processed"
|
|
44
|
+
for a payment that was never approved.** When the provider rejects the
|
|
45
|
+
session (buyer never approved, capture declined) the route now answers
|
|
46
|
+
`402` with the real reason and `payment_authorized: false`, so a storefront
|
|
47
|
+
does not tell the buyer "do not pay again" for money that was never taken.
|
|
48
|
+
Transient errors keep the retryable 5xx. The check uses
|
|
49
|
+
`MedusaError.isMedusaError` rather than `instanceof`, which is false across
|
|
50
|
+
the payment-module boundary.
|
|
51
|
+
- `POST /store/payment-collections/:id/payment-sessions` surfaces the core
|
|
52
|
+
workflow's real error message instead of `[object Object]`.
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
- Capture and refund calls send `Prefer: return=representation`, so the
|
|
56
|
+
capture/refund entries stored on the session carry amount, status and
|
|
57
|
+
`final_capture` instead of the id/status/links stub.
|
|
58
|
+
|
|
59
|
+
## 1.2.4 — 2026-09-11
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- **Code formatting & documentation only — no behavior changes.** The whole
|
|
63
|
+
source tree is now formatted with Prettier (`npm run format` /
|
|
64
|
+
`npm run format:check`; config in `.prettierrc`, plus `.editorconfig`), and
|
|
65
|
+
every module, provider, model, API route, and admin component carries JSDoc.
|
|
66
|
+
Two misplaced doc blocks were re-attached to the code they describe, empty
|
|
67
|
+
`catch {}` blocks now state their intent, and a few naming/unused-parameter
|
|
68
|
+
inconsistencies were tidied (`_input` → `input` in the card provider).
|
|
69
|
+
|
|
5
70
|
## 1.2.3 — 2026-09-08
|
|
6
71
|
|
|
7
72
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
# PayPal for Medusa
|
|
2
|
-
|
|
3
|
-
**Accept PayPal and credit card payments in your Medusa v2 store — built by an official PayPal Partner.**
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
|
|
6
|
-
[](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
|
|
7
|
-
[](LICENSE)
|
|
8
|
-
[](https://medusajs.com)
|
|
9
|
-
[](https://developer.paypal.com)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## ✨ What you get
|
|
14
|
-
|
|
15
|
-
| Feature | Details |
|
|
16
|
-
|---|---|
|
|
17
|
-
| 🔵 **PayPal Buttons** | One-click PayPal checkout for your customers |
|
|
18
|
-
| 💳 **Card Payments** | Secure credit & debit card fields, hosted by PayPal (PCI compliant) |
|
|
19
|
-
| 🛠 **Admin Dashboard** | Connect your PayPal account and manage everything from Medusa Admin |
|
|
20
|
-
| 🌍 **Test & Live modes** | Try everything safely in Sandbox before going live |
|
|
21
|
-
| 🔐 **3D Secure** | Extra card security, configurable in one click |
|
|
22
|
-
| 🔄 **Reliable by design** | Payments are verified with PayPal at every step — webhooks, retries, and safety nets are handled for you |
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## ✅ Requirements
|
|
27
|
-
|
|
28
|
-
- Medusa **v2.12+**
|
|
29
|
-
- Node.js **20+**
|
|
30
|
-
- PostgreSQL
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 🚀 Installation
|
|
35
|
-
|
|
36
|
-
In your Medusa backend folder, run:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install @easypayment/medusa-payment-paypal
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## ⚙️ Setup — 5 steps
|
|
45
|
-
|
|
46
|
-
### 1. Add the plugin to `medusa-config.ts`
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { loadEnv, defineConfig } from "@medusajs/framework/utils"
|
|
50
|
-
|
|
51
|
-
loadEnv(process.env.NODE_ENV || "development", process.cwd())
|
|
52
|
-
|
|
53
|
-
export default defineConfig({
|
|
54
|
-
projectConfig: {
|
|
55
|
-
databaseUrl: process.env.DATABASE_URL,
|
|
56
|
-
http: {
|
|
57
|
-
storeCors: process.env.STORE_CORS!,
|
|
58
|
-
adminCors: process.env.ADMIN_CORS!,
|
|
59
|
-
authCors: process.env.AUTH_CORS!,
|
|
60
|
-
jwtSecret: process.env.JWT_SECRET || "supersecret",
|
|
61
|
-
cookieSecret: process.env.COOKIE_SECRET || "supersecret",
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
plugins: [
|
|
66
|
-
{
|
|
67
|
-
resolve: "@easypayment/medusa-payment-paypal",
|
|
68
|
-
options: {},
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
|
|
72
|
-
modules: [
|
|
73
|
-
{
|
|
74
|
-
resolve: "@medusajs/medusa/payment",
|
|
75
|
-
options: {
|
|
76
|
-
providers: [
|
|
77
|
-
{
|
|
78
|
-
// PayPal Buttons
|
|
79
|
-
resolve: "@easypayment/medusa-payment-paypal/providers/paypal",
|
|
80
|
-
id: "paypal",
|
|
81
|
-
options: {},
|
|
82
|
-
dependencies: ["paypal_onboarding"],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
// Card payments
|
|
86
|
-
resolve: "@easypayment/medusa-payment-paypal/providers/paypal_card",
|
|
87
|
-
id: "paypal_card",
|
|
88
|
-
options: {},
|
|
89
|
-
dependencies: ["paypal_onboarding"],
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
})
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 2. Run database migrations
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
npx medusa db:migrate
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### 3. Connect your PayPal account
|
|
105
|
-
|
|
106
|
-
1. Start your Medusa server
|
|
107
|
-
2. Open **Medusa Admin → Settings → PayPal**
|
|
108
|
-
3. Choose **Sandbox** (testing) or **Live** (real payments)
|
|
109
|
-
4. Click **Connect to PayPal** and follow the steps
|
|
110
|
-
|
|
111
|
-
That's it — your credentials are saved automatically. Webhooks are registered for you too.
|
|
112
|
-
|
|
113
|
-
> 💡 Prefer manual setup? Click **Insert credentials manually** and paste your Client ID and Secret from [developer.paypal.com](https://developer.paypal.com/dashboard/).
|
|
114
|
-
|
|
115
|
-
### 4. Turn PayPal on in your region
|
|
116
|
-
|
|
117
|
-
Go to **Medusa Admin → Settings → Regions → your region** and enable:
|
|
118
|
-
|
|
119
|
-
| Payment provider | What it is |
|
|
120
|
-
|---|---|
|
|
121
|
-
| `pp_paypal_paypal` | PayPal Buttons |
|
|
122
|
-
| `pp_paypal_card_paypal_card` | Card payments |
|
|
123
|
-
|
|
124
|
-
### 5. Add PayPal to your storefront
|
|
125
|
-
|
|
126
|
-
The checkout UI comes as a separate package — install it in your **storefront** project:
|
|
127
|
-
|
|
128
|
-
📦 **[@easypayment/medusa-paypal-ui](https://www.npmjs.com/package/@easypayment/medusa-paypal-ui)** — ready-made PayPal components for Next.js storefronts, with a step-by-step guide.
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## 🎨 Customize (optional)
|
|
133
|
-
|
|
134
|
-
Everything is managed in **Medusa Admin → Settings → PayPal** — changes apply instantly, no restart needed:
|
|
135
|
-
|
|
136
|
-
- **PayPal Settings** — turn PayPal on/off, button color, shape, and label
|
|
137
|
-
- **Advanced Card Payments** — turn card payments on/off, 3D Secure mode
|
|
138
|
-
- **Additional Settings** — capture vs. authorize, brand name shown at PayPal, invoice prefix
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## 🔐 Going live — two things we recommend
|
|
143
|
-
|
|
144
|
-
1. **`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.
|
|
145
|
-
2. **`MEDUSA_BACKEND_URL`** — set this to your backend's public address (e.g. `https://api.mystore.com`) so PayPal can reach your store for payment notifications.
|
|
146
|
-
|
|
147
|
-
<details>
|
|
148
|
-
<summary><b>Advanced options</b> (for developers — everything works without these)</summary>
|
|
149
|
-
|
|
150
|
-
<br>
|
|
151
|
-
|
|
152
|
-
| Variable | Default | What it does |
|
|
153
|
-
|---|---|---|
|
|
154
|
-
| `STOREFRONT_URL` | *(unset)* | Storefront address used for PayPal return/cancel pages (can also be set in Admin) |
|
|
155
|
-
| `PAYPAL_ENCRYPTION_STRICT` | `false` | `true` = refuse to save credentials unencrypted |
|
|
156
|
-
| `PAYPAL_SELLER_NONCE` | *(auto)* | Set a fixed random string when running multiple server instances |
|
|
157
|
-
| `PAYPAL_ADMIN_ORIGIN` | first `ADMIN_CORS` entry | Restricts the onboarding popup to your admin URL |
|
|
158
|
-
| `PAYPAL_WEBHOOK_COMPLETE_CART` | `true` | Safety net that finishes an order when the payment succeeded but the buyer's browser closed. `false` disables it |
|
|
159
|
-
| `PAYPAL_RATE_LIMIT_MAX` / `PAYPAL_RATE_LIMIT_WINDOW_MS` | *(off)* / `60000` | Optional request limit for the public checkout routes |
|
|
160
|
-
| `PAYPAL_WEBHOOK_RATE_LIMIT_MAX` / `PAYPAL_WEBHOOK_RATE_LIMIT_WINDOW_MS` | *(off)* / `60000` | Optional request limit for the webhook endpoint (separate from the above) |
|
|
161
|
-
| `PAYPAL_WEBHOOK_REPLAY_WINDOW_MINUTES` | `60` | Rejects webhook deliveries older than this |
|
|
162
|
-
| `PAYPAL_WEBHOOK_STALE_PROCESSING_MS` | `300000` | When the retry job re-picks-up interrupted webhook events |
|
|
163
|
-
| `PAYPAL_WEBHOOK_ID_LIVE` / `PAYPAL_WEBHOOK_ID_SANDBOX` | *(auto)* | Manual webhook-id override (normally automatic) |
|
|
164
|
-
| `PAYPAL_HTTP_TIMEOUT_MS` | `30000` | Timeout for calls to PayPal |
|
|
165
|
-
| `PAYPAL_CURRENCY` | `EUR` | Fallback currency if none is configured |
|
|
166
|
-
| `PAYPAL_ALERT_WEBHOOK_URLS` | *(unset)* | Comma-separated URLs that receive operational alert notifications |
|
|
167
|
-
|
|
168
|
-
**Monitoring:** operational counters live in the `paypal_metric` table; every webhook is recorded in `paypal_webhook_event` with automatic retries; audit events are logged as JSON lines tagged `"log":"paypal_audit"` (secrets redacted).
|
|
169
|
-
|
|
170
|
-
</details>
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## 💬 Support
|
|
175
|
-
|
|
176
|
-
- 🐛 **Found a bug?** [Open an issue](https://github.com/easypaymentplugins/medusa-paypal/issues)
|
|
177
|
-
- 💡 **Questions or feature requests?** [Start a discussion](https://github.com/easypaymentplugins/medusa-paypal/discussions)
|
|
178
|
-
- 🛍 **Storefront UI package:** [@easypayment/medusa-paypal-ui](https://www.npmjs.com/package/@easypayment/medusa-paypal-ui)
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## 📄 License
|
|
183
|
-
|
|
184
|
-
MIT © [Easy Payment](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
|
|
1
|
+
# PayPal for Medusa
|
|
2
|
+
|
|
3
|
+
**Accept PayPal and credit card payments in your Medusa v2 store — built by an official PayPal Partner.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
|
|
6
|
+
[](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://medusajs.com)
|
|
9
|
+
[](https://developer.paypal.com)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ✨ What you get
|
|
14
|
+
|
|
15
|
+
| Feature | Details |
|
|
16
|
+
|---|---|
|
|
17
|
+
| 🔵 **PayPal Buttons** | One-click PayPal checkout for your customers |
|
|
18
|
+
| 💳 **Card Payments** | Secure credit & debit card fields, hosted by PayPal (PCI compliant) |
|
|
19
|
+
| 🛠 **Admin Dashboard** | Connect your PayPal account and manage everything from Medusa Admin |
|
|
20
|
+
| 🌍 **Test & Live modes** | Try everything safely in Sandbox before going live |
|
|
21
|
+
| 🔐 **3D Secure** | Extra card security, configurable in one click |
|
|
22
|
+
| 🔄 **Reliable by design** | Payments are verified with PayPal at every step — webhooks, retries, and safety nets are handled for you |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ✅ Requirements
|
|
27
|
+
|
|
28
|
+
- Medusa **v2.12+**
|
|
29
|
+
- Node.js **20+**
|
|
30
|
+
- PostgreSQL
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🚀 Installation
|
|
35
|
+
|
|
36
|
+
In your Medusa backend folder, run:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install @easypayment/medusa-payment-paypal
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ⚙️ Setup — 5 steps
|
|
45
|
+
|
|
46
|
+
### 1. Add the plugin to `medusa-config.ts`
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { loadEnv, defineConfig } from "@medusajs/framework/utils"
|
|
50
|
+
|
|
51
|
+
loadEnv(process.env.NODE_ENV || "development", process.cwd())
|
|
52
|
+
|
|
53
|
+
export default defineConfig({
|
|
54
|
+
projectConfig: {
|
|
55
|
+
databaseUrl: process.env.DATABASE_URL,
|
|
56
|
+
http: {
|
|
57
|
+
storeCors: process.env.STORE_CORS!,
|
|
58
|
+
adminCors: process.env.ADMIN_CORS!,
|
|
59
|
+
authCors: process.env.AUTH_CORS!,
|
|
60
|
+
jwtSecret: process.env.JWT_SECRET || "supersecret",
|
|
61
|
+
cookieSecret: process.env.COOKIE_SECRET || "supersecret",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
plugins: [
|
|
66
|
+
{
|
|
67
|
+
resolve: "@easypayment/medusa-payment-paypal",
|
|
68
|
+
options: {},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
|
|
72
|
+
modules: [
|
|
73
|
+
{
|
|
74
|
+
resolve: "@medusajs/medusa/payment",
|
|
75
|
+
options: {
|
|
76
|
+
providers: [
|
|
77
|
+
{
|
|
78
|
+
// PayPal Buttons
|
|
79
|
+
resolve: "@easypayment/medusa-payment-paypal/providers/paypal",
|
|
80
|
+
id: "paypal",
|
|
81
|
+
options: {},
|
|
82
|
+
dependencies: ["paypal_onboarding"],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
// Card payments
|
|
86
|
+
resolve: "@easypayment/medusa-payment-paypal/providers/paypal_card",
|
|
87
|
+
id: "paypal_card",
|
|
88
|
+
options: {},
|
|
89
|
+
dependencies: ["paypal_onboarding"],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. Run database migrations
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx medusa db:migrate
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 3. Connect your PayPal account
|
|
105
|
+
|
|
106
|
+
1. Start your Medusa server
|
|
107
|
+
2. Open **Medusa Admin → Settings → PayPal**
|
|
108
|
+
3. Choose **Sandbox** (testing) or **Live** (real payments)
|
|
109
|
+
4. Click **Connect to PayPal** and follow the steps
|
|
110
|
+
|
|
111
|
+
That's it — your credentials are saved automatically. Webhooks are registered for you too.
|
|
112
|
+
|
|
113
|
+
> 💡 Prefer manual setup? Click **Insert credentials manually** and paste your Client ID and Secret from [developer.paypal.com](https://developer.paypal.com/dashboard/).
|
|
114
|
+
|
|
115
|
+
### 4. Turn PayPal on in your region
|
|
116
|
+
|
|
117
|
+
Go to **Medusa Admin → Settings → Regions → your region** and enable:
|
|
118
|
+
|
|
119
|
+
| Payment provider | What it is |
|
|
120
|
+
|---|---|
|
|
121
|
+
| `pp_paypal_paypal` | PayPal Buttons |
|
|
122
|
+
| `pp_paypal_card_paypal_card` | Card payments |
|
|
123
|
+
|
|
124
|
+
### 5. Add PayPal to your storefront
|
|
125
|
+
|
|
126
|
+
The checkout UI comes as a separate package — install it in your **storefront** project:
|
|
127
|
+
|
|
128
|
+
📦 **[@easypayment/medusa-paypal-ui](https://www.npmjs.com/package/@easypayment/medusa-paypal-ui)** — ready-made PayPal components for Next.js storefronts, with a step-by-step guide.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🎨 Customize (optional)
|
|
133
|
+
|
|
134
|
+
Everything is managed in **Medusa Admin → Settings → PayPal** — changes apply instantly, no restart needed:
|
|
135
|
+
|
|
136
|
+
- **PayPal Settings** — turn PayPal on/off, button color, shape, and label
|
|
137
|
+
- **Advanced Card Payments** — turn card payments on/off, 3D Secure mode
|
|
138
|
+
- **Additional Settings** — capture vs. authorize, brand name shown at PayPal, invoice prefix
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 🔐 Going live — two things we recommend
|
|
143
|
+
|
|
144
|
+
1. **`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.
|
|
145
|
+
2. **`MEDUSA_BACKEND_URL`** — set this to your backend's public address (e.g. `https://api.mystore.com`) so PayPal can reach your store for payment notifications.
|
|
146
|
+
|
|
147
|
+
<details>
|
|
148
|
+
<summary><b>Advanced options</b> (for developers — everything works without these)</summary>
|
|
149
|
+
|
|
150
|
+
<br>
|
|
151
|
+
|
|
152
|
+
| Variable | Default | What it does |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| `STOREFRONT_URL` | *(unset)* | Storefront address used for PayPal return/cancel pages (can also be set in Admin) |
|
|
155
|
+
| `PAYPAL_ENCRYPTION_STRICT` | `false` | `true` = refuse to save credentials unencrypted |
|
|
156
|
+
| `PAYPAL_SELLER_NONCE` | *(auto)* | Set a fixed random string when running multiple server instances |
|
|
157
|
+
| `PAYPAL_ADMIN_ORIGIN` | first `ADMIN_CORS` entry | Restricts the onboarding popup to your admin URL |
|
|
158
|
+
| `PAYPAL_WEBHOOK_COMPLETE_CART` | `true` | Safety net that finishes an order when the payment succeeded but the buyer's browser closed. `false` disables it |
|
|
159
|
+
| `PAYPAL_RATE_LIMIT_MAX` / `PAYPAL_RATE_LIMIT_WINDOW_MS` | *(off)* / `60000` | Optional request limit for the public checkout routes |
|
|
160
|
+
| `PAYPAL_WEBHOOK_RATE_LIMIT_MAX` / `PAYPAL_WEBHOOK_RATE_LIMIT_WINDOW_MS` | *(off)* / `60000` | Optional request limit for the webhook endpoint (separate from the above) |
|
|
161
|
+
| `PAYPAL_WEBHOOK_REPLAY_WINDOW_MINUTES` | `60` | Rejects webhook deliveries older than this |
|
|
162
|
+
| `PAYPAL_WEBHOOK_STALE_PROCESSING_MS` | `300000` | When the retry job re-picks-up interrupted webhook events |
|
|
163
|
+
| `PAYPAL_WEBHOOK_ID_LIVE` / `PAYPAL_WEBHOOK_ID_SANDBOX` | *(auto)* | Manual webhook-id override (normally automatic) |
|
|
164
|
+
| `PAYPAL_HTTP_TIMEOUT_MS` | `30000` | Timeout for calls to PayPal |
|
|
165
|
+
| `PAYPAL_CURRENCY` | `EUR` | Fallback currency if none is configured |
|
|
166
|
+
| `PAYPAL_ALERT_WEBHOOK_URLS` | *(unset)* | Comma-separated URLs that receive operational alert notifications |
|
|
167
|
+
|
|
168
|
+
**Monitoring:** operational counters live in the `paypal_metric` table; every webhook is recorded in `paypal_webhook_event` with automatic retries; audit events are logged as JSON lines tagged `"log":"paypal_audit"` (secrets redacted).
|
|
169
|
+
|
|
170
|
+
</details>
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 💬 Support
|
|
175
|
+
|
|
176
|
+
- 🐛 **Found a bug?** [Open an issue](https://github.com/easypaymentplugins/medusa-paypal/issues)
|
|
177
|
+
- 💡 **Questions or feature requests?** [Start a discussion](https://github.com/easypaymentplugins/medusa-paypal/discussions)
|
|
178
|
+
- 🛍 **Storefront UI package:** [@easypayment/medusa-paypal-ui](https://www.npmjs.com/package/@easypayment/medusa-paypal-ui)
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 📄 License
|
|
183
|
+
|
|
184
|
+
MIT © [Easy Payment](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easypayment/medusa-payment-paypal",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "PayPal & credit card payments for Medusa v2
|
|
3
|
+
"version": "1.2.5",
|
|
4
|
+
"description": "PayPal & credit card payments for Medusa v2 — PayPal Buttons, hosted card fields, 3D Secure, and an admin dashboard. Built by a PayPal Partner.",
|
|
5
5
|
"author": "EasyPayment Plugins",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./.medusa/server/src/index.js",
|
|
@@ -37,8 +37,10 @@
|
|
|
37
37
|
"develop": "medusa plugin:develop",
|
|
38
38
|
"test": "vitest run",
|
|
39
39
|
"test:watch": "vitest",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"format": "prettier --write .",
|
|
42
|
+
"format:check": "prettier --check .",
|
|
43
|
+
"prepublishOnly": "npm run build"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@medusajs/admin-sdk": "2.12.5",
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
"@medusajs/ui": "^4.0.0",
|
|
51
53
|
"@swc/core": "^1.5.7",
|
|
52
54
|
"@types/react": "^18.3.31",
|
|
55
|
+
"prettier": "3.6.2",
|
|
53
56
|
"react": "^18.3.1",
|
|
54
57
|
"ts-node": "^10.9.2",
|
|
55
58
|
"typescript": "^5.6.2",
|