@reeboot/strapi-payment-plugin 0.0.0

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 (54) hide show
  1. package/README.md +112 -0
  2. package/dist/_chunks/App-BGle38NN.js +1149 -0
  3. package/dist/_chunks/App-DoUUpjp-.mjs +1149 -0
  4. package/dist/_chunks/en-B4KWt_jN.js +4 -0
  5. package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
  6. package/dist/admin/index.js +64 -0
  7. package/dist/admin/index.mjs +65 -0
  8. package/dist/admin/src/components/Header.d.ts +2 -0
  9. package/dist/admin/src/components/Initializer.d.ts +5 -0
  10. package/dist/admin/src/components/NavigationMenu.d.ts +2 -0
  11. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  12. package/dist/admin/src/components/Sidebar.d.ts +2 -0
  13. package/dist/admin/src/components/TransactionDetailsModal.d.ts +18 -0
  14. package/dist/admin/src/components/TransactionList.d.ts +18 -0
  15. package/dist/admin/src/index.d.ts +10 -0
  16. package/dist/admin/src/pages/App.d.ts +2 -0
  17. package/dist/admin/src/pages/ConfigurationPage.d.ts +2 -0
  18. package/dist/admin/src/pages/DashboardPage.d.ts +2 -0
  19. package/dist/admin/src/pages/HomePage.d.ts +2 -0
  20. package/dist/admin/src/pages/ProductsPage.d.ts +2 -0
  21. package/dist/admin/src/pages/SubscriptionsPage.d.ts +2 -0
  22. package/dist/admin/src/pages/TransactionsPage.d.ts +2 -0
  23. package/dist/admin/src/pluginId.d.ts +1 -0
  24. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  25. package/dist/server/controllers/product.d.ts +12 -0
  26. package/dist/server/controllers/subscription.d.ts +12 -0
  27. package/dist/server/index.js +7287 -0
  28. package/dist/server/index.mjs +7286 -0
  29. package/dist/server/services/product.d.ts +7 -0
  30. package/dist/server/services/subscription.d.ts +7 -0
  31. package/dist/server/src/bootstrap.d.ts +5 -0
  32. package/dist/server/src/config/index.d.ts +13 -0
  33. package/dist/server/src/content-types/index.d.ts +2 -0
  34. package/dist/server/src/controllers/controller.d.ts +10 -0
  35. package/dist/server/src/controllers/index.d.ts +41 -0
  36. package/dist/server/src/controllers/productController.d.ts +9 -0
  37. package/dist/server/src/controllers/subscriptionController.d.ts +9 -0
  38. package/dist/server/src/destroy.d.ts +5 -0
  39. package/dist/server/src/index.d.ts +159 -0
  40. package/dist/server/src/middlewares/index.d.ts +2 -0
  41. package/dist/server/src/policies/index.d.ts +2 -0
  42. package/dist/server/src/register.d.ts +5 -0
  43. package/dist/server/src/routes/admin-routes.d.ts +13 -0
  44. package/dist/server/src/routes/content-api.d.ts +12 -0
  45. package/dist/server/src/routes/index.d.ts +51 -0
  46. package/dist/server/src/routes/product-routes.d.ts +13 -0
  47. package/dist/server/src/routes/refund-routes.d.ts +13 -0
  48. package/dist/server/src/routes/subscription-routes.d.ts +13 -0
  49. package/dist/server/src/services/index.d.ts +41 -0
  50. package/dist/server/src/services/paypalDriver.d.ts +7 -0
  51. package/dist/server/src/services/service.d.ts +33 -0
  52. package/dist/server/src/services/stripeDriver.d.ts +290 -0
  53. package/jest.config.js +13 -0
  54. package/package.json +75 -0
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # Strapi v5 Payment Plugin (Stripe & PayPal)
2
+
3
+ This plugin provides a unified interface for processing payments through Stripe and PayPal in Strapi v5.
4
+
5
+ ## Features
6
+
7
+ - Payment initiation (Stripe Payment Intents, PayPal Orders)
8
+ - Webhook handling for payment status updates
9
+ - Refund processing
10
+ - Payment details retrieval
11
+ - Admin panel configuration interface
12
+
13
+ ## Installation
14
+
15
+ 1. Install the plugin:
16
+ ```bash
17
+ npm install @reeboot/payment-plugin
18
+ ```
19
+
20
+ 2. Add the plugin to your Strapi configuration:
21
+ ```javascript
22
+ // config/plugins.js
23
+ module.exports = {
24
+ 'payment-plugin': {
25
+ enabled: true,
26
+ },
27
+ };
28
+ ```
29
+
30
+ ## Configuration
31
+
32
+ 1. Set up environment variables:
33
+ ```
34
+ STRIPE_SECRET_KEY=your_stripe_secret_key
35
+ STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
36
+ STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
37
+ PAYPAL_CLIENT_ID=your_paypal_client_id
38
+ PAYPAL_CLIENT_SECRET=your_paypal_client_secret
39
+ PAYPAL_WEBHOOK_ID=your_paypal_webhook_id
40
+ ```
41
+
42
+ 2. Configure the plugin through the admin panel:
43
+ - Go to the "Payment Plugin Configuration" page
44
+ - Enter your API keys and secrets
45
+ - Save the configuration
46
+
47
+ ## API Usage
48
+
49
+ ### Initiate Payment
50
+
51
+ ```javascript
52
+ // POST /payment-plugin/initiate-payment
53
+ const response = await fetch('/payment-plugin/initiate-payment', {
54
+ method: 'POST',
55
+ headers: {
56
+ 'Content-Type': 'application/json',
57
+ },
58
+ body: JSON.stringify({
59
+ gateway: 'stripe', // or 'paypal'
60
+ amount: 1000, // in cents
61
+ currency: 'usd',
62
+ orderId: 'order_123',
63
+ options: {
64
+ // gateway-specific options
65
+ },
66
+ }),
67
+ });
68
+ const payment = await response.json();
69
+ ```
70
+
71
+ ### Process Webhook
72
+
73
+ ```javascript
74
+ // POST /payment-plugin/webhook/:gateway
75
+ // The webhook URL should be configured in your Stripe/PayPal dashboard
76
+ ```
77
+
78
+ ### Refund Payment
79
+
80
+ ```javascript
81
+ // POST /payment-plugin/refund
82
+ const response = await fetch('/payment-plugin/refund', {
83
+ method: 'POST',
84
+ headers: {
85
+ 'Content-Type': 'application/json',
86
+ },
87
+ body: JSON.stringify({
88
+ gateway: 'stripe', // or 'paypal'
89
+ transactionId: 'pi_123', // or PayPal transaction ID
90
+ amount: 500, // refund amount in cents
91
+ options: {
92
+ // gateway-specific options
93
+ },
94
+ }),
95
+ });
96
+ const refund = await response.json();
97
+ ```
98
+
99
+ ### Get Payment Details
100
+
101
+ ```javascript
102
+ // GET /payment-plugin/payments/:id
103
+ const response = await fetch('/payment-plugin/payments/pi_123');
104
+ const paymentDetails = await response.json();
105
+ ```
106
+
107
+ ## Development
108
+
109
+ 1. Clone the repository
110
+ 2. Install dependencies: `npm install`
111
+ 3. Build the plugin: `npm run build`
112
+ 4. Link the plugin to your Strapi project: `npm link`