@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.
- package/README.md +112 -0
- package/dist/_chunks/App-BGle38NN.js +1149 -0
- package/dist/_chunks/App-DoUUpjp-.mjs +1149 -0
- package/dist/_chunks/en-B4KWt_jN.js +4 -0
- package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
- package/dist/admin/index.js +64 -0
- package/dist/admin/index.mjs +65 -0
- package/dist/admin/src/components/Header.d.ts +2 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/NavigationMenu.d.ts +2 -0
- package/dist/admin/src/components/PluginIcon.d.ts +2 -0
- package/dist/admin/src/components/Sidebar.d.ts +2 -0
- package/dist/admin/src/components/TransactionDetailsModal.d.ts +18 -0
- package/dist/admin/src/components/TransactionList.d.ts +18 -0
- package/dist/admin/src/index.d.ts +10 -0
- package/dist/admin/src/pages/App.d.ts +2 -0
- package/dist/admin/src/pages/ConfigurationPage.d.ts +2 -0
- package/dist/admin/src/pages/DashboardPage.d.ts +2 -0
- package/dist/admin/src/pages/HomePage.d.ts +2 -0
- package/dist/admin/src/pages/ProductsPage.d.ts +2 -0
- package/dist/admin/src/pages/SubscriptionsPage.d.ts +2 -0
- package/dist/admin/src/pages/TransactionsPage.d.ts +2 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/utils/getTranslation.d.ts +2 -0
- package/dist/server/controllers/product.d.ts +12 -0
- package/dist/server/controllers/subscription.d.ts +12 -0
- package/dist/server/index.js +7287 -0
- package/dist/server/index.mjs +7286 -0
- package/dist/server/services/product.d.ts +7 -0
- package/dist/server/services/subscription.d.ts +7 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/index.d.ts +13 -0
- package/dist/server/src/content-types/index.d.ts +2 -0
- package/dist/server/src/controllers/controller.d.ts +10 -0
- package/dist/server/src/controllers/index.d.ts +41 -0
- package/dist/server/src/controllers/productController.d.ts +9 -0
- package/dist/server/src/controllers/subscriptionController.d.ts +9 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/index.d.ts +159 -0
- package/dist/server/src/middlewares/index.d.ts +2 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/admin-routes.d.ts +13 -0
- package/dist/server/src/routes/content-api.d.ts +12 -0
- package/dist/server/src/routes/index.d.ts +51 -0
- package/dist/server/src/routes/product-routes.d.ts +13 -0
- package/dist/server/src/routes/refund-routes.d.ts +13 -0
- package/dist/server/src/routes/subscription-routes.d.ts +13 -0
- package/dist/server/src/services/index.d.ts +41 -0
- package/dist/server/src/services/paypalDriver.d.ts +7 -0
- package/dist/server/src/services/service.d.ts +33 -0
- package/dist/server/src/services/stripeDriver.d.ts +290 -0
- package/jest.config.js +13 -0
- 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`
|