@easypayment/medusa-payment-paypal 1.2.2 → 1.2.4

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.
Files changed (267) hide show
  1. package/.medusa/server/src/admin/index.js +390 -136
  2. package/.medusa/server/src/admin/index.mjs +390 -136
  3. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts +1 -0
  4. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
  5. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js +5 -1
  6. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -1
  7. package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts +1 -0
  8. package/.medusa/server/src/api/admin/paypal/disconnect/route.d.ts.map +1 -1
  9. package/.medusa/server/src/api/admin/paypal/disconnect/route.js +1 -0
  10. package/.medusa/server/src/api/admin/paypal/disconnect/route.js.map +1 -1
  11. package/.medusa/server/src/api/admin/paypal/environment/route.d.ts +2 -0
  12. package/.medusa/server/src/api/admin/paypal/environment/route.d.ts.map +1 -1
  13. package/.medusa/server/src/api/admin/paypal/environment/route.js +2 -0
  14. package/.medusa/server/src/api/admin/paypal/environment/route.js.map +1 -1
  15. package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts +9 -0
  16. package/.medusa/server/src/api/admin/paypal/onboard-complete/route.d.ts.map +1 -1
  17. package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js +9 -4
  18. package/.medusa/server/src/api/admin/paypal/onboard-complete/route.js.map +1 -1
  19. package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts +7 -1
  20. package/.medusa/server/src/api/admin/paypal/onboarding-link/route.d.ts.map +1 -1
  21. package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js +9 -2
  22. package/.medusa/server/src/api/admin/paypal/onboarding-link/route.js.map +1 -1
  23. package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts +1 -0
  24. package/.medusa/server/src/api/admin/paypal/onboarding-status/route.d.ts.map +1 -1
  25. package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js +1 -0
  26. package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js.map +1 -1
  27. package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts +1 -0
  28. package/.medusa/server/src/api/admin/paypal/save-credentials/route.d.ts.map +1 -1
  29. package/.medusa/server/src/api/admin/paypal/save-credentials/route.js +10 -3
  30. package/.medusa/server/src/api/admin/paypal/save-credentials/route.js.map +1 -1
  31. package/.medusa/server/src/api/admin/paypal/settings/route.d.ts +2 -0
  32. package/.medusa/server/src/api/admin/paypal/settings/route.d.ts.map +1 -1
  33. package/.medusa/server/src/api/admin/paypal/settings/route.js +9 -2
  34. package/.medusa/server/src/api/admin/paypal/settings/route.js.map +1 -1
  35. package/.medusa/server/src/api/admin/paypal/status/route.d.ts +4 -0
  36. package/.medusa/server/src/api/admin/paypal/status/route.d.ts.map +1 -1
  37. package/.medusa/server/src/api/admin/paypal/status/route.js +9 -1
  38. package/.medusa/server/src/api/admin/paypal/status/route.js.map +1 -1
  39. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts +4 -0
  40. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
  41. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js +5 -0
  42. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -1
  43. package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts +8 -0
  44. package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts.map +1 -1
  45. package/.medusa/server/src/api/store/paypal/capture-order/route.js +23 -3
  46. package/.medusa/server/src/api/store/paypal/capture-order/route.js.map +1 -1
  47. package/.medusa/server/src/api/store/paypal/config/route.d.ts +5 -0
  48. package/.medusa/server/src/api/store/paypal/config/route.d.ts.map +1 -1
  49. package/.medusa/server/src/api/store/paypal/config/route.js +12 -5
  50. package/.medusa/server/src/api/store/paypal/config/route.js.map +1 -1
  51. package/.medusa/server/src/api/store/paypal/create-order/route.d.ts +8 -0
  52. package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
  53. package/.medusa/server/src/api/store/paypal/create-order/route.js +54 -20
  54. package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
  55. package/.medusa/server/src/api/store/paypal/onboard-return/route.d.ts.map +1 -1
  56. package/.medusa/server/src/api/store/paypal/onboard-return/route.js +19 -19
  57. package/.medusa/server/src/api/store/paypal/onboard-return/route.js.map +1 -1
  58. package/.medusa/server/src/api/store/paypal/settings/route.d.ts +1 -0
  59. package/.medusa/server/src/api/store/paypal/settings/route.d.ts.map +1 -1
  60. package/.medusa/server/src/api/store/paypal/settings/route.js +4 -1
  61. package/.medusa/server/src/api/store/paypal/settings/route.js.map +1 -1
  62. package/.medusa/server/src/api/store/paypal/webhook/route.d.ts +7 -0
  63. package/.medusa/server/src/api/store/paypal/webhook/route.d.ts.map +1 -1
  64. package/.medusa/server/src/api/store/paypal/webhook/route.js +34 -3
  65. package/.medusa/server/src/api/store/paypal/webhook/route.js.map +1 -1
  66. package/.medusa/server/src/api/store/paypal-complete/route.d.ts +8 -0
  67. package/.medusa/server/src/api/store/paypal-complete/route.d.ts.map +1 -1
  68. package/.medusa/server/src/api/store/paypal-complete/route.js +33 -6
  69. package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -1
  70. package/.medusa/server/src/api/utils/rate-limit.d.ts +4 -0
  71. package/.medusa/server/src/api/utils/rate-limit.d.ts.map +1 -1
  72. package/.medusa/server/src/api/utils/rate-limit.js +9 -4
  73. package/.medusa/server/src/api/utils/rate-limit.js.map +1 -1
  74. package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts +5 -0
  75. package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts.map +1 -1
  76. package/.medusa/server/src/jobs/paypal-webhook-retry.js +13 -2
  77. package/.medusa/server/src/jobs/paypal-webhook-retry.js.map +1 -1
  78. package/.medusa/server/src/modules/paypal/index.d.ts +1 -0
  79. package/.medusa/server/src/modules/paypal/index.d.ts.map +1 -1
  80. package/.medusa/server/src/modules/paypal/index.js +1 -0
  81. package/.medusa/server/src/modules/paypal/index.js.map +1 -1
  82. package/.medusa/server/src/modules/paypal/migrations/20260115120000_create_paypal_connection.js +22 -22
  83. package/.medusa/server/src/modules/paypal/migrations/20260123090000_create_paypal_settings.js +11 -11
  84. package/.medusa/server/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.js +18 -18
  85. package/.medusa/server/src/modules/paypal/migrations/20260401090000_create_paypal_metric.js +16 -16
  86. package/.medusa/server/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.js +20 -20
  87. package/.medusa/server/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.js +14 -14
  88. package/.medusa/server/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.js +15 -15
  89. package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts.map +1 -1
  90. package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js.map +1 -1
  91. package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.d.ts.map +1 -1
  92. package/.medusa/server/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.js.map +1 -1
  93. package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.d.ts.map +1 -1
  94. package/.medusa/server/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.js.map +1 -1
  95. package/.medusa/server/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.js +6 -6
  96. package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts +5 -0
  97. package/.medusa/server/src/modules/paypal/models/paypal_connection.d.ts.map +1 -1
  98. package/.medusa/server/src/modules/paypal/models/paypal_connection.js +5 -0
  99. package/.medusa/server/src/modules/paypal/models/paypal_connection.js.map +1 -1
  100. package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts +4 -0
  101. package/.medusa/server/src/modules/paypal/models/paypal_metric.d.ts.map +1 -1
  102. package/.medusa/server/src/modules/paypal/models/paypal_metric.js +4 -0
  103. package/.medusa/server/src/modules/paypal/models/paypal_metric.js.map +1 -1
  104. package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts +5 -0
  105. package/.medusa/server/src/modules/paypal/models/paypal_settings.d.ts.map +1 -1
  106. package/.medusa/server/src/modules/paypal/models/paypal_settings.js +5 -0
  107. package/.medusa/server/src/modules/paypal/models/paypal_settings.js.map +1 -1
  108. package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts +7 -0
  109. package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.d.ts.map +1 -1
  110. package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js +7 -0
  111. package/.medusa/server/src/modules/paypal/models/paypal_webhook_event.js.map +1 -1
  112. package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts.map +1 -1
  113. package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js.map +1 -1
  114. package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts +14 -6
  115. package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts.map +1 -1
  116. package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +55 -32
  117. package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -1
  118. package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts +6 -1
  119. package/.medusa/server/src/modules/paypal/payment-provider/index.d.ts.map +1 -1
  120. package/.medusa/server/src/modules/paypal/payment-provider/index.js +6 -4
  121. package/.medusa/server/src/modules/paypal/payment-provider/index.js.map +1 -1
  122. package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts +8 -0
  123. package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
  124. package/.medusa/server/src/modules/paypal/payment-provider/service.js +39 -12
  125. package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
  126. package/.medusa/server/src/modules/paypal/service.d.ts +72 -2
  127. package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
  128. package/.medusa/server/src/modules/paypal/service.js +159 -33
  129. package/.medusa/server/src/modules/paypal/service.js.map +1 -1
  130. package/.medusa/server/src/modules/paypal/types/config.d.ts +2 -0
  131. package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -1
  132. package/.medusa/server/src/modules/paypal/types/config.js +5 -2
  133. package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
  134. package/.medusa/server/src/modules/paypal/utils/amounts.d.ts +1 -0
  135. package/.medusa/server/src/modules/paypal/utils/amounts.d.ts.map +1 -1
  136. package/.medusa/server/src/modules/paypal/utils/amounts.js +15 -5
  137. package/.medusa/server/src/modules/paypal/utils/amounts.js.map +1 -1
  138. package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts.map +1 -1
  139. package/.medusa/server/src/modules/paypal/utils/credential-resolver.js +3 -1
  140. package/.medusa/server/src/modules/paypal/utils/credential-resolver.js.map +1 -1
  141. package/.medusa/server/src/modules/paypal/utils/currencies.d.ts +9 -0
  142. package/.medusa/server/src/modules/paypal/utils/currencies.d.ts.map +1 -1
  143. package/.medusa/server/src/modules/paypal/utils/currencies.js +13 -0
  144. package/.medusa/server/src/modules/paypal/utils/currencies.js.map +1 -1
  145. package/.medusa/server/src/modules/paypal/utils/payment-session.d.ts +12 -0
  146. package/.medusa/server/src/modules/paypal/utils/payment-session.d.ts.map +1 -1
  147. package/.medusa/server/src/modules/paypal/utils/payment-session.js +4 -3
  148. package/.medusa/server/src/modules/paypal/utils/payment-session.js.map +1 -1
  149. package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts +1 -0
  150. package/.medusa/server/src/modules/paypal/utils/paypal-auth.d.ts.map +1 -1
  151. package/.medusa/server/src/modules/paypal/utils/paypal-auth.js +1 -0
  152. package/.medusa/server/src/modules/paypal/utils/paypal-auth.js.map +1 -1
  153. package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts +11 -0
  154. package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts.map +1 -1
  155. package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js +17 -1
  156. package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js.map +1 -1
  157. package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +6 -0
  158. package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts.map +1 -1
  159. package/.medusa/server/src/modules/paypal/utils/provider-ids.js +6 -0
  160. package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -1
  161. package/.medusa/server/src/modules/paypal/utils/secret-crypto.d.ts +2 -0
  162. package/.medusa/server/src/modules/paypal/utils/secret-crypto.d.ts.map +1 -1
  163. package/.medusa/server/src/modules/paypal/utils/secret-crypto.js +6 -1
  164. package/.medusa/server/src/modules/paypal/utils/secret-crypto.js.map +1 -1
  165. package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +43 -0
  166. package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -1
  167. package/.medusa/server/src/modules/paypal/webhook-processor.js +57 -5
  168. package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -1
  169. package/.medusa/server/src/providers/paypal/index.d.ts +1 -0
  170. package/.medusa/server/src/providers/paypal/index.d.ts.map +1 -1
  171. package/.medusa/server/src/providers/paypal/index.js +1 -0
  172. package/.medusa/server/src/providers/paypal/index.js.map +1 -1
  173. package/.medusa/server/src/providers/paypal_card/index.d.ts +1 -0
  174. package/.medusa/server/src/providers/paypal_card/index.d.ts.map +1 -1
  175. package/.medusa/server/src/providers/paypal_card/index.js +1 -0
  176. package/.medusa/server/src/providers/paypal_card/index.js.map +1 -1
  177. package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts +6 -0
  178. package/.medusa/server/src/subscribers/paypal-order-invoice.d.ts.map +1 -1
  179. package/.medusa/server/src/subscribers/paypal-order-invoice.js +9 -1
  180. package/.medusa/server/src/subscribers/paypal-order-invoice.js.map +1 -1
  181. package/.medusa/server/src/subscribers/paypal-webhook-process.d.ts +1 -0
  182. package/.medusa/server/src/subscribers/paypal-webhook-process.d.ts.map +1 -1
  183. package/.medusa/server/src/subscribers/paypal-webhook-process.js +17 -4
  184. package/.medusa/server/src/subscribers/paypal-webhook-process.js.map +1 -1
  185. package/CHANGELOG.md +19 -0
  186. package/README.md +184 -175
  187. package/package.json +24 -5
  188. package/src/admin/index.ts +1 -1
  189. package/src/admin/routes/settings/paypal/_components/FieldRow.tsx +38 -29
  190. package/src/admin/routes/settings/paypal/_components/SectionCard.tsx +29 -26
  191. package/src/admin/routes/settings/paypal/_components/Tabs.tsx +49 -48
  192. package/src/admin/routes/settings/paypal/_components/Toast.tsx +63 -52
  193. package/src/admin/routes/settings/paypal/_utils/adminFetch.ts +52 -32
  194. package/src/admin/routes/settings/paypal/additional-settings/page.tsx +246 -139
  195. package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +208 -123
  196. package/src/admin/routes/settings/paypal/apple-pay/page.tsx +9 -5
  197. package/src/admin/routes/settings/paypal/connection/page.tsx +974 -908
  198. package/src/admin/routes/settings/paypal/google-pay/page.tsx +9 -5
  199. package/src/admin/routes/settings/paypal/page.tsx +14 -13
  200. package/src/admin/routes/settings/paypal/pay-later-messaging/page.tsx +9 -5
  201. package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +304 -273
  202. package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +48 -39
  203. package/src/api/admin/paypal/disconnect/route.ts +15 -14
  204. package/src/api/admin/paypal/environment/route.ts +34 -32
  205. package/src/api/admin/paypal/onboard-complete/route.ts +61 -50
  206. package/src/api/admin/paypal/onboarding-link/route.ts +91 -76
  207. package/src/api/admin/paypal/onboarding-status/route.ts +21 -20
  208. package/src/api/admin/paypal/save-credentials/route.ts +48 -37
  209. package/src/api/admin/paypal/settings/route.ts +63 -45
  210. package/src/api/admin/paypal/status/route.ts +29 -17
  211. package/src/api/hooks/paypal/onboard-return/route.ts +15 -15
  212. package/src/api/hooks/paypal/webhook/route.ts +17 -17
  213. package/src/api/middlewares.ts +61 -61
  214. package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +63 -54
  215. package/src/api/store/paypal/capture-order/route.ts +416 -370
  216. package/src/api/store/paypal/config/route.ts +121 -115
  217. package/src/api/store/paypal/create-order/route.ts +586 -539
  218. package/src/api/store/paypal/onboard-return/route.ts +116 -113
  219. package/src/api/store/paypal/settings/route.ts +29 -19
  220. package/src/api/store/paypal/webhook/route.ts +380 -314
  221. package/src/api/store/paypal-complete/route.ts +157 -128
  222. package/src/api/utils/rate-limit.ts +143 -129
  223. package/src/index.ts +1 -1
  224. package/src/jobs/paypal-webhook-retry.ts +257 -241
  225. package/src/modules/paypal/index.ts +9 -8
  226. package/src/modules/paypal/migrations/20260115120000_create_paypal_connection.ts +33 -33
  227. package/src/modules/paypal/migrations/20260123090000_create_paypal_settings.ts +22 -22
  228. package/src/modules/paypal/migrations/20260201090000_create_paypal_webhook_event.ts +29 -29
  229. package/src/modules/paypal/migrations/20260401090000_create_paypal_metric.ts +27 -27
  230. package/src/modules/paypal/migrations/20260701090000_add_paypal_webhook_event_processing.ts +31 -31
  231. package/src/modules/paypal/migrations/20261101090000_remove_paypal_reconciliation_status.ts +25 -25
  232. package/src/modules/paypal/migrations/20261201090000_remove_paypal_audit_log.ts +26 -26
  233. package/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.ts +15 -11
  234. package/src/modules/paypal/migrations/20270102090000_add_paypal_seller_email.ts +15 -11
  235. package/src/modules/paypal/migrations/20270103090000_add_paypal_seller_merchant_id.ts +15 -11
  236. package/src/modules/paypal/migrations/20270201000000_add_webhook_dead_letter.ts +17 -17
  237. package/src/modules/paypal/migrations/20270202000000_align_nullable_defaults.ts +44 -44
  238. package/src/modules/paypal/migrations/20270301000000_add_webhook_transmission_id_index.ts +15 -15
  239. package/src/modules/paypal/models/paypal_connection.ts +28 -23
  240. package/src/modules/paypal/models/paypal_metric.ts +13 -9
  241. package/src/modules/paypal/models/paypal_settings.ts +13 -8
  242. package/src/modules/paypal/models/paypal_webhook_event.ts +26 -19
  243. package/src/modules/paypal/payment-provider/base-provider.ts +287 -275
  244. package/src/modules/paypal/payment-provider/card-service.ts +927 -855
  245. package/src/modules/paypal/payment-provider/index.ts +14 -15
  246. package/src/modules/paypal/payment-provider/service.ts +906 -836
  247. package/src/modules/paypal/payment-provider/status-utils.ts +59 -59
  248. package/src/modules/paypal/payment-provider/webhook-utils.ts +109 -109
  249. package/src/modules/paypal/service.ts +362 -115
  250. package/src/modules/paypal/types/config.ts +70 -65
  251. package/src/modules/paypal/utils/amounts.ts +123 -107
  252. package/src/modules/paypal/utils/core-workflow.ts +46 -46
  253. package/src/modules/paypal/utils/credential-resolver.ts +275 -271
  254. package/src/modules/paypal/utils/currencies.ts +97 -84
  255. package/src/modules/paypal/utils/partner.ts +8 -8
  256. package/src/modules/paypal/utils/payment-session.ts +144 -138
  257. package/src/modules/paypal/utils/paypal-auth.ts +6 -5
  258. package/src/modules/paypal/utils/paypal-fetch.ts +197 -181
  259. package/src/modules/paypal/utils/provider-ids.ts +21 -15
  260. package/src/modules/paypal/utils/secret-crypto.ts +226 -197
  261. package/src/modules/paypal/utils/webhook-verify.ts +61 -61
  262. package/src/modules/paypal/webhook-processor.ts +641 -573
  263. package/src/providers/paypal/index.ts +9 -8
  264. package/src/providers/paypal_card/index.ts +9 -8
  265. package/src/subscribers/paypal-order-invoice.ts +180 -173
  266. package/src/subscribers/paypal-webhook-process.ts +147 -131
  267. package/tsconfig.json +21 -31
@@ -1 +1 @@
1
- {"version":3,"file":"paypal-order-invoice.js","sourceRoot":"","sources":["../../../../src/subscribers/paypal-order-invoice.ts"],"names":[],"mappings":";;;AAQA,4CAgKC;AAtKD,qEAAsE;AACtE,uEAAkE;AAClE,uEAAyE;AAEzE,MAAM,kBAAkB,GAAG,IAAI,GAAG,C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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,iBAoGhC;AAED,eAAO,MAAM,MAAM,EAAE,gBAEpB,CAAA"}
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", { id: recordId });
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({ id: recordId, status: "ignored", processed_at: new Date() })
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, { eventType, payload });
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 || processed.captureId || processed.orderId || null,
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":";;;AAuBA,8CAuGC;AA5HD,2EAK4C;AAE/B,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,MAAM,MAAM,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;QAClF,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,mDAAmD,EAAE;YACjE,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,CAAC,EAAE,OAAO;SAClB,CAAC,CAAA;QACF,OAAM;IACR,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC9E,OAAM;IACR,CAAC;IAED,2EAA2E;IAC3E,8EAA8E;IAC9E,2EAA2E;IAC3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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"}
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,MAAM,MAAM,CAAC,uBAAuB,CAC/C,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAClB,EAAE,IAAI,EAAE,CAAC,EAAE,CACZ,CAAA;QACD,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,mDAAmD,EAAE;YACjE,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,CAAC,EAAE,OAAO;SAClB,CAAC,CAAA;QACF,OAAM;IACR,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE;YAC3D,EAAE,EAAE,QAAQ;SACb,CAAC,CAAA;QACF,OAAM;IACR,CAAC;IAED,2EAA2E;IA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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,25 @@
2
2
 
3
3
  All notable changes to `@easypayment/medusa-payment-paypal` are documented here.
4
4
 
5
+ ## 1.2.4 — 2026-09-11
6
+
7
+ ### Changed
8
+ - **Code formatting & documentation only — no behavior changes.** The whole
9
+ source tree is now formatted with Prettier (`npm run format` /
10
+ `npm run format:check`; config in `.prettierrc`, plus `.editorconfig`), and
11
+ every module, provider, model, API route, and admin component carries JSDoc.
12
+ Two misplaced doc blocks were re-attached to the code they describe, empty
13
+ `catch {}` blocks now state their intent, and a few naming/unused-parameter
14
+ inconsistencies were tidied (`_input` → `input` in the card provider).
15
+
16
+ ## 1.2.3 — 2026-09-08
17
+
18
+ ### Changed
19
+ - **Docs & metadata only — no code changes.** Expanded npm keywords and
20
+ sharpened the package description for discoverability; added `homepage` and
21
+ `bugs` links to the npm page; README now shows the correct requirements
22
+ (Node 20+, Medusa v2.12+), a monthly-downloads badge, and a Support section.
23
+
5
24
  ## 1.2.0 — 2026-09-02
6
25
 
7
26
  ### Fixed
package/README.md CHANGED
@@ -1,175 +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
- [![npm version](https://img.shields.io/npm/v/@easypayment/medusa-payment-paypal?color=blue&label=npm)](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
7
- [![Medusa v2](https://img.shields.io/badge/Medusa-v2-9b59b6)](https://medusajs.com)
8
- [![PayPal PPCP](https://img.shields.io/badge/PayPal-PPCP-003087)](https://developer.paypal.com)
9
-
10
- ---
11
-
12
- ## ✨ What you get
13
-
14
- | Feature | Details |
15
- |---|---|
16
- | 🔵 **PayPal Buttons** | One-click PayPal checkout for your customers |
17
- | 💳 **Card Payments** | Secure credit & debit card fields, hosted by PayPal (PCI compliant) |
18
- | 🛠 **Admin Dashboard** | Connect your PayPal account and manage everything from Medusa Admin |
19
- | 🌍 **Test & Live modes** | Try everything safely in Sandbox before going live |
20
- | 🔐 **3D Secure** | Extra card security, configurable in one click |
21
- | 🔄 **Reliable by design** | Payments are verified with PayPal at every step — webhooks, retries, and safety nets are handled for you |
22
-
23
- ---
24
-
25
- ## ✅ Requirements
26
-
27
- - Medusa **v2**
28
- - Node.js **18+**
29
- - PostgreSQL
30
-
31
- ---
32
-
33
- ## 🚀 Installation
34
-
35
- In your Medusa backend folder, run:
36
-
37
- ```bash
38
- npm install @easypayment/medusa-payment-paypal
39
- ```
40
-
41
- ---
42
-
43
- ## ⚙️ Setup — 5 steps
44
-
45
- ### 1. Add the plugin to `medusa-config.ts`
46
-
47
- ```ts
48
- import { loadEnv, defineConfig } from "@medusajs/framework/utils"
49
-
50
- loadEnv(process.env.NODE_ENV || "development", process.cwd())
51
-
52
- export default defineConfig({
53
- projectConfig: {
54
- databaseUrl: process.env.DATABASE_URL,
55
- http: {
56
- storeCors: process.env.STORE_CORS!,
57
- adminCors: process.env.ADMIN_CORS!,
58
- authCors: process.env.AUTH_CORS!,
59
- jwtSecret: process.env.JWT_SECRET || "supersecret",
60
- cookieSecret: process.env.COOKIE_SECRET || "supersecret",
61
- },
62
- },
63
-
64
- plugins: [
65
- {
66
- resolve: "@easypayment/medusa-payment-paypal",
67
- options: {},
68
- },
69
- ],
70
-
71
- modules: [
72
- {
73
- resolve: "@medusajs/medusa/payment",
74
- options: {
75
- providers: [
76
- {
77
- // PayPal Buttons
78
- resolve: "@easypayment/medusa-payment-paypal/providers/paypal",
79
- id: "paypal",
80
- options: {},
81
- dependencies: ["paypal_onboarding"],
82
- },
83
- {
84
- // Card payments
85
- resolve: "@easypayment/medusa-payment-paypal/providers/paypal_card",
86
- id: "paypal_card",
87
- options: {},
88
- dependencies: ["paypal_onboarding"],
89
- },
90
- ],
91
- },
92
- },
93
- ],
94
- })
95
- ```
96
-
97
- ### 2. Run database migrations
98
-
99
- ```bash
100
- npx medusa db:migrate
101
- ```
102
-
103
- ### 3. Connect your PayPal account
104
-
105
- 1. Start your Medusa server
106
- 2. Open **Medusa Admin → Settings → PayPal**
107
- 3. Choose **Sandbox** (testing) or **Live** (real payments)
108
- 4. Click **Connect to PayPal** and follow the steps
109
-
110
- That's it — your credentials are saved automatically. Webhooks are registered for you too.
111
-
112
- > 💡 Prefer manual setup? Click **Insert credentials manually** and paste your Client ID and Secret from [developer.paypal.com](https://developer.paypal.com/dashboard/).
113
-
114
- ### 4. Turn PayPal on in your region
115
-
116
- Go to **Medusa Admin → Settings → Regions → your region** and enable:
117
-
118
- | Payment provider | What it is |
119
- |---|---|
120
- | `pp_paypal_paypal` | PayPal Buttons |
121
- | `pp_paypal_card_paypal_card` | Card payments |
122
-
123
- ### 5. Add PayPal to your storefront
124
-
125
- The checkout UI comes as a separate package — install it in your **storefront** project:
126
-
127
- 📦 **[@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.
128
-
129
- ---
130
-
131
- ## 🎨 Customize (optional)
132
-
133
- Everything is managed in **Medusa Admin → Settings → PayPal** — changes apply instantly, no restart needed:
134
-
135
- - **PayPal Settings** — turn PayPal on/off, button color, shape, and label
136
- - **Advanced Card Payments** — turn card payments on/off, 3D Secure mode
137
- - **Additional Settings** — capture vs. authorize, brand name shown at PayPal, invoice prefix
138
-
139
- ---
140
-
141
- ## 🔐 Going live — two things we recommend
142
-
143
- 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.
144
- 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.
145
-
146
- <details>
147
- <summary><b>Advanced options</b> (for developers — everything works without these)</summary>
148
-
149
- <br>
150
-
151
- | Variable | Default | What it does |
152
- |---|---|---|
153
- | `STOREFRONT_URL` | *(unset)* | Storefront address used for PayPal return/cancel pages (can also be set in Admin) |
154
- | `PAYPAL_ENCRYPTION_STRICT` | `false` | `true` = refuse to save credentials unencrypted |
155
- | `PAYPAL_SELLER_NONCE` | *(auto)* | Set a fixed random string when running multiple server instances |
156
- | `PAYPAL_ADMIN_ORIGIN` | first `ADMIN_CORS` entry | Restricts the onboarding popup to your admin URL |
157
- | `PAYPAL_WEBHOOK_COMPLETE_CART` | `true` | Safety net that finishes an order when the payment succeeded but the buyer's browser closed. `false` disables it |
158
- | `PAYPAL_RATE_LIMIT_MAX` / `PAYPAL_RATE_LIMIT_WINDOW_MS` | *(off)* / `60000` | Optional request limit for the public checkout routes |
159
- | `PAYPAL_WEBHOOK_RATE_LIMIT_MAX` / `PAYPAL_WEBHOOK_RATE_LIMIT_WINDOW_MS` | *(off)* / `60000` | Optional request limit for the webhook endpoint (separate from the above) |
160
- | `PAYPAL_WEBHOOK_REPLAY_WINDOW_MINUTES` | `60` | Rejects webhook deliveries older than this |
161
- | `PAYPAL_WEBHOOK_STALE_PROCESSING_MS` | `300000` | When the retry job re-picks-up interrupted webhook events |
162
- | `PAYPAL_WEBHOOK_ID_LIVE` / `PAYPAL_WEBHOOK_ID_SANDBOX` | *(auto)* | Manual webhook-id override (normally automatic) |
163
- | `PAYPAL_HTTP_TIMEOUT_MS` | `30000` | Timeout for calls to PayPal |
164
- | `PAYPAL_CURRENCY` | `EUR` | Fallback currency if none is configured |
165
- | `PAYPAL_ALERT_WEBHOOK_URLS` | *(unset)* | Comma-separated URLs that receive operational alert notifications |
166
-
167
- **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).
168
-
169
- </details>
170
-
171
- ---
172
-
173
- ## 📄 License
174
-
175
- 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
+ [![npm version](https://img.shields.io/npm/v/@easypayment/medusa-payment-paypal?color=blue&label=npm)](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@easypayment/medusa-payment-paypal?color=blue&label=downloads)](https://www.npmjs.com/package/@easypayment/medusa-payment-paypal)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
8
+ [![Medusa v2](https://img.shields.io/badge/Medusa-v2-9b59b6)](https://medusajs.com)
9
+ [![PayPal PPCP](https://img.shields.io/badge/PayPal-PPCP-003087)](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.2",
4
- "description": "PayPal for Medusa v2 \u2014 Built by a PayPal Partner.",
3
+ "version": "1.2.4",
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
- "prepublishOnly": "npm run build",
41
- "typecheck": "tsc --noEmit"
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",
@@ -83,9 +86,25 @@
83
86
  "type": "git",
84
87
  "url": "https://github.com/easypaymentplugins/medusa-paypal.git"
85
88
  },
89
+ "homepage": "https://github.com/easypaymentplugins/medusa-paypal#readme",
90
+ "bugs": {
91
+ "url": "https://github.com/easypaymentplugins/medusa-paypal/issues"
92
+ },
86
93
  "keywords": [
87
94
  "medusa-v2",
88
95
  "medusa-plugin-integration",
89
- "medusa-plugin-payment"
96
+ "medusa-plugin-payment",
97
+ "medusa",
98
+ "medusajs",
99
+ "medusa-plugin",
100
+ "paypal",
101
+ "paypal-checkout",
102
+ "payment",
103
+ "payments",
104
+ "payment-provider",
105
+ "checkout",
106
+ "ecommerce",
107
+ "credit-card",
108
+ "3d-secure"
90
109
  ]
91
110
  }
@@ -1 +1 @@
1
- export {}
1
+ export {}
@@ -1,29 +1,38 @@
1
- import React from "react"
2
-
3
- export default function FieldRow({
4
- label,
5
- hint,
6
- htmlFor,
7
- children,
8
- }: {
9
- label: string
10
- hint?: React.ReactNode
11
- htmlFor?: string
12
- children: React.ReactNode
13
- }) {
14
- return (
15
- <div className="grid grid-cols-12 items-start gap-4 py-3">
16
- <div className="col-span-12 md:col-span-4">
17
- {htmlFor ? (
18
- <label htmlFor={htmlFor} className="text-sm font-medium text-ui-fg-base">
19
- {label}
20
- </label>
21
- ) : (
22
- <div className="text-sm font-medium text-ui-fg-base">{label}</div>
23
- )}
24
- {hint ? <div className="mt-1 text-xs text-ui-fg-subtle">{hint}</div> : null}
25
- </div>
26
- <div className="col-span-12 md:col-span-8">{children}</div>
27
- </div>
28
- )
29
- }
1
+ import React from "react"
2
+
3
+ /**
4
+ * Label + optional hint on the left, control on the right. Pass `htmlFor` to
5
+ * render the label as a real `<label>` bound to the control's id.
6
+ */
7
+ export default function FieldRow({
8
+ label,
9
+ hint,
10
+ htmlFor,
11
+ children,
12
+ }: {
13
+ label: string
14
+ hint?: React.ReactNode
15
+ htmlFor?: string
16
+ children: React.ReactNode
17
+ }) {
18
+ return (
19
+ <div className="grid grid-cols-12 items-start gap-4 py-3">
20
+ <div className="col-span-12 md:col-span-4">
21
+ {htmlFor ? (
22
+ <label
23
+ htmlFor={htmlFor}
24
+ className="text-sm font-medium text-ui-fg-base"
25
+ >
26
+ {label}
27
+ </label>
28
+ ) : (
29
+ <div className="text-sm font-medium text-ui-fg-base">{label}</div>
30
+ )}
31
+ {hint ? (
32
+ <div className="mt-1 text-xs text-ui-fg-subtle">{hint}</div>
33
+ ) : null}
34
+ </div>
35
+ <div className="col-span-12 md:col-span-8">{children}</div>
36
+ </div>
37
+ )
38
+ }