strapi-plugin-payone-provider 1.1.3 → 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 (36) hide show
  1. package/README.md +1041 -377
  2. package/admin/src/index.js +4 -1
  3. package/admin/src/pages/App/components/AppHeader.js +37 -0
  4. package/admin/src/pages/App/components/AppTabs.js +126 -0
  5. package/admin/src/pages/App/components/ConfigurationPanel.js +34 -35
  6. package/admin/src/pages/App/components/GooglePaybutton.js +300 -0
  7. package/admin/src/pages/App/components/HistoryPanel.js +25 -38
  8. package/admin/src/pages/App/components/PaymentActionsPanel.js +95 -280
  9. package/admin/src/pages/App/components/TransactionHistoryItem.js +4 -1
  10. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.js +93 -0
  11. package/admin/src/pages/App/components/paymentActions/CaptureForm.js +64 -0
  12. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.js +52 -0
  13. package/admin/src/pages/App/components/paymentActions/PaymentResult.js +85 -0
  14. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.js +93 -0
  15. package/admin/src/pages/App/components/paymentActions/RefundForm.js +89 -0
  16. package/admin/src/pages/App/index.js +41 -465
  17. package/admin/src/pages/App/styles.css +294 -0
  18. package/admin/src/pages/constants/paymentConstants.js +37 -0
  19. package/admin/src/pages/hooks/usePaymentActions.js +271 -0
  20. package/admin/src/pages/hooks/useSettings.js +111 -0
  21. package/admin/src/pages/hooks/useTransactionHistory.js +87 -0
  22. package/admin/src/pages/utils/api.js +10 -0
  23. package/admin/src/pages/utils/injectGooglePayScript.js +31 -0
  24. package/admin/src/pages/utils/paymentUtils.js +113 -13
  25. package/package.json +1 -1
  26. package/server/controllers/payone.js +71 -64
  27. package/server/routes/index.js +17 -0
  28. package/server/services/paymentService.js +214 -0
  29. package/server/services/payone.js +25 -648
  30. package/server/services/settingsService.js +59 -0
  31. package/server/services/testConnectionService.js +190 -0
  32. package/server/services/transactionService.js +114 -0
  33. package/server/utils/normalize.js +51 -0
  34. package/server/utils/paymentMethodParams.js +126 -0
  35. package/server/utils/requestBuilder.js +110 -0
  36. package/server/utils/responseParser.js +80 -0
package/README.md CHANGED
@@ -10,13 +10,8 @@ A comprehensive Strapi plugin that integrates the Payone payment gateway into yo
10
10
  - [Configuration](#configuration)
11
11
  - [Getting Started](#getting-started)
12
12
  - [Usage](#usage)
13
- - [Admin Panel](#admin-panel)
14
- - [API Endpoints](#api-endpoints)
13
+ - [Payment Methods & Operations](#-payment-methods--operations)
15
14
  - [Supported Payment Methods](#supported-payment-methods)
16
- - [Payment Operations](#payment-operations)
17
- - [Transaction History](#transaction-history)
18
- - [Troubleshooting](#troubleshooting)
19
- - [License](#license)
20
15
 
21
16
  ## ✨ Features
22
17
 
@@ -24,8 +19,8 @@ A comprehensive Strapi plugin that integrates the Payone payment gateway into yo
24
19
  - **Payment Operations**:
25
20
  - Preauthorization (reserve funds)
26
21
  - Authorization (immediate charge)
27
- - Capture (complete preauthorized transactions) — currently Credit Card only
28
- - Refund (return funds to customers) — currently Credit Card only
22
+ - Capture (complete preauthorized transactions)
23
+ - Refund (return funds to customers)
29
24
  - **Admin Panel**:
30
25
  - Easy configuration interface
31
26
  - Transaction history viewer with filtering
@@ -57,7 +52,7 @@ You will need the following credentials from your Payone account:
57
52
 
58
53
  ## 📦 Installation
59
54
 
60
- ### Option 1: Install from npm
55
+ ### Install from npm
61
56
 
62
57
  ```bash
63
58
  # Using npm
@@ -70,80 +65,6 @@ yarn add strapi-plugin-payone-provider
70
65
  pnpm add strapi-plugin-payone-provider
71
66
  ```
72
67
 
73
- ### Option 2: Install from Git
74
-
75
- ```bash
76
- # Using npm
77
- npm install git+https://github.com/your-repo/strapi-plugin-payone-provider.git
78
-
79
- # Using yarn
80
- yarn add git+https://github.com/your-repo/strapi-plugin-payone-provider.git
81
-
82
- # Using pnpm
83
- pnpm add git+https://github.com/your-repo/strapi-plugin-payone-provider.git
84
- ```
85
-
86
- ### Option 3: Manual Installation (Local Development)
87
-
88
- 1. Clone or copy the plugin folder to your Strapi project's `src/plugins/` directory:
89
-
90
- ```bash
91
- # From your Strapi project root
92
- mkdir -p src/plugins
93
- cp -r /path/to/strapi-plugin-payone src/plugins/
94
- ```
95
-
96
- 2. Install the plugin dependencies:
97
-
98
- ```bash
99
- # Using npm
100
- npm install
101
-
102
- # Using yarn
103
- yarn install
104
-
105
- # Using pnpm
106
- pnpm install
107
- ```
108
-
109
- 3. Enable the plugin by adding it to your `config/plugins.js` (or `config/plugins.ts`):
110
-
111
- ```javascript
112
- module.exports = {
113
- // ... other plugins
114
- 'strapi-plugin-payone-provider': {
115
- enabled: true,
116
- resolve: './src/plugins/strapi-plugin-payone',
117
- },
118
- };
119
- ```
120
-
121
- 4. Rebuild your Strapi admin panel:
122
-
123
- ```bash
124
- # Using npm
125
- npm run build
126
-
127
- # Using yarn
128
- yarn build
129
-
130
- # Using pnpm
131
- pnpm build
132
- ```
133
-
134
- 5. Restart your Strapi application:
135
-
136
- ```bash
137
- # Using npm
138
- npm run develop
139
-
140
- # Using yarn
141
- yarn develop
142
-
143
- # Using pnpm
144
- pnpm develop
145
- ```
146
-
147
68
  ## ⚙️ Configuration
148
69
 
149
70
  After installation, you need to configure your Payone credentials:
@@ -163,50 +84,6 @@ After installation, you need to configure your Payone credentials:
163
84
  5. Click **"Test Connection"** to verify your credentials
164
85
  6. Click **"Save Configuration"** to store your settings
165
86
 
166
- ### Manual Configuration (Alternative)
167
-
168
- You can also configure the plugin programmatically by adding settings to your `config/plugins.js`:
169
-
170
- ```javascript
171
- module.exports = {
172
- 'strapi-plugin-payone-provider': {
173
- enabled: true,
174
- resolve: './src/plugins/strapi-plugin-payone',
175
- config: {
176
- settings: {
177
- aid: 'YOUR_ACCOUNT_ID',
178
- portalid: 'YOUR_PORTAL_ID',
179
- mid: 'YOUR_MERCHANT_ID',
180
- key: 'YOUR_PORTAL_KEY',
181
- mode: 'test', // or 'live'
182
- api_version: '3.10',
183
- },
184
- },
185
- },
186
- };
187
- ```
188
-
189
- > ⚠️ **Security Warning**: Never commit your production credentials to version control. Use environment variables instead:
190
-
191
- ```javascript
192
- module.exports = {
193
- 'strapi-plugin-payone-provider': {
194
- enabled: true,
195
- resolve: './src/plugins/strapi-plugin-payone',
196
- config: {
197
- settings: {
198
- aid: process.env.PAYONE_AID,
199
- portalid: process.env.PAYONE_PORTAL_ID,
200
- mid: process.env.PAYONE_MID,
201
- key: process.env.PAYONE_KEY,
202
- mode: process.env.PAYONE_MODE || 'test',
203
- api_version: '3.10',
204
- },
205
- },
206
- },
207
- };
208
- ```
209
-
210
87
  ## 🚀 Getting Started
211
88
 
212
89
  ### 1. Test Your Connection
@@ -221,65 +98,62 @@ After configuring your credentials:
221
98
  ### 2. Try a Test Payment
222
99
 
223
100
  1. Go to the **Payment Actions** tab
224
- 2. Try a **Preauthorization** operation (currently test UI supports Credit Card only):
101
+ 2. Try a **Preauthorization** operation:
225
102
  - Amount: 1000 (equals 10.00 EUR in cents)
226
103
  - Reference: Leave empty for auto-generation
227
104
  - Click **"Execute Preauthorization"**
228
105
  3. Check the **Transaction History** tab to see the logged transaction
229
106
 
230
- ### 3. Review Transaction History
231
-
232
- 1. Navigate to the **Transaction History** tab
233
- 2. View all payment operations
234
- 3. Use filters to search for specific transactions
235
- 4. Click on any transaction to view full details
236
-
237
107
  ## 📖 Usage
238
108
 
239
- ### Admin Panel
109
+ ### Base URL
240
110
 
241
- The plugin adds a new menu item **"Payone Provider"** to your Strapi admin panel with three tabs:
111
+ All API endpoints are available at:
242
112
 
243
- #### 1. Configuration Tab
113
+ **Content API (Frontend)**: `/api/strapi-plugin-payone-provider`
244
114
 
245
- - Configure Payone API credentials
246
- - Test connection to Payone servers
247
- - Switch between test and live modes
115
+ **Admin API**: `/strapi-plugin-payone-provider`
248
116
 
249
- #### 2. Transaction History Tab
117
+ > ⚠️ **Authentication Required**: All endpoints require authentication. Include your Bearer token in the Authorization header.
250
118
 
251
- - View all payment transactions
252
- - Filter by status, type, transaction ID, reference, or date range
253
- - View detailed request/response data for each transaction
254
- - Pagination support for large transaction lists
119
+ ### Common Request Headers
120
+
121
+ ```javascript
122
+ {
123
+ "Content-Type": "application/json",
124
+ "Authorization": "Bearer YOUR_AUTH_TOKEN"
125
+ }
126
+ ```
255
127
 
256
- #### 3. Payment Actions Tab
128
+ ### Common Response Fields
257
129
 
258
- - Test payment operations without writing code
259
- - Execute preauthorizations, authorizations, captures, and refunds
260
- - View real-time results and error messages
130
+ All responses include:
261
131
 
262
- ### API Endpoints
132
+ - `status`: Transaction status (APPROVED, ERROR, REDIRECT, etc.)
133
+ - `txid`: Transaction ID (for successful transactions)
134
+ - `errorcode`: Error code (if status is ERROR)
135
+ - `errormessage`: Error message (if status is ERROR)
263
136
 
264
- The plugin provides REST API endpoints for programmatic access:
137
+ ---
265
138
 
266
- #### Content API Endpoints (Public with Auth Policy)
139
+ ## 💳 Payment Methods & Operations
267
140
 
268
- All content API endpoints require authentication via the `isAuth` policy. These are meant for your frontend application.
141
+ ### Credit Card
269
142
 
270
- Base URL: `/api/strapi-plugin-payone-provider`
143
+ <details>
144
+ <summary><strong>Credit Card Payment Method</strong></summary>
271
145
 
272
- ##### POST `/api/strapi-plugin-payone-provider/preauthorization`
146
+ #### Preauthorization
273
147
 
274
- Reserve funds on a customer's card without immediate charge.
148
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
275
149
 
276
- **Request Body:**
150
+ **Request Body**:
277
151
 
278
152
  ```json
279
153
  {
280
154
  "amount": 1000,
281
155
  "currency": "EUR",
282
- "reference": "ORDER-12345",
156
+ "reference": "PAY1234567890ABCDEF",
283
157
  "clearingtype": "cc",
284
158
  "cardtype": "V",
285
159
  "cardpan": "4111111111111111",
@@ -287,15 +161,24 @@ Reserve funds on a customer's card without immediate charge.
287
161
  "cardcvc2": "123",
288
162
  "firstname": "John",
289
163
  "lastname": "Doe",
164
+ "email": "john.doe@example.com",
165
+ "telephonenumber": "+4917512345678",
290
166
  "street": "Main Street 123",
291
167
  "zip": "12345",
292
168
  "city": "Berlin",
293
169
  "country": "DE",
294
- "email": "john.doe@example.com"
170
+ "successurl": "https://www.example.com/success",
171
+ "errorurl": "https://www.example.com/error",
172
+ "backurl": "https://www.example.com/back",
173
+ "salutation": "Herr",
174
+ "gender": "m",
175
+ "ip": "127.0.0.1",
176
+ "language": "de",
177
+ "customer_is_present": "yes"
295
178
  }
296
179
  ```
297
180
 
298
- **Response:**
181
+ **Response**:
299
182
 
300
183
  ```json
301
184
  {
@@ -307,316 +190,1097 @@ Reserve funds on a customer's card without immediate charge.
307
190
  }
308
191
  ```
309
192
 
310
- ##### POST `/api/strapi-plugin-payone-provider/authorization`
193
+ #### Authorization
311
194
 
312
- Immediately charge a customer's card.
195
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
196
+
197
+ **Request Body**: (Same as Preauthorization)
198
+
199
+ ```json
200
+ {
201
+ "amount": 1000,
202
+ "currency": "EUR",
203
+ "reference": "PAY1234567890ABCDEF",
204
+ "clearingtype": "cc",
205
+ "cardtype": "V",
206
+ "cardpan": "4111111111111111",
207
+ "cardexpiredate": "2512",
208
+ "cardcvc2": "123",
209
+ "firstname": "John",
210
+ "lastname": "Doe",
211
+ "email": "john.doe@example.com",
212
+ "telephonenumber": "+4917512345678",
213
+ "street": "Main Street 123",
214
+ "zip": "12345",
215
+ "city": "Berlin",
216
+ "country": "DE",
217
+ "successurl": "https://www.example.com/success",
218
+ "errorurl": "https://www.example.com/error",
219
+ "backurl": "https://www.example.com/back",
220
+ "salutation": "Herr",
221
+ "gender": "m",
222
+ "ip": "127.0.0.1",
223
+ "language": "de",
224
+ "customer_is_present": "yes"
225
+ }
226
+ ```
313
227
 
314
- **Request Body:** (Same as preauthorization)
228
+ **Response**:
315
229
 
316
- > Note: For redirect-based methods (PayPal, Online Banking) you must provide `successurl`, `errorurl`, and `backurl`. The plugin will auto-fill safe defaults when missing, using `settings.return_base` or `PAYONE_RETURN_BASE`/`FRONTEND_URL`/`NEXT_PUBLIC_SITE_URL`.
230
+ ```json
231
+ {
232
+ "data": {
233
+ "status": "APPROVED",
234
+ "txid": "123456789",
235
+ "userid": "987654321"
236
+ }
237
+ }
238
+ ```
317
239
 
318
- ##### POST `/api/strapi-plugin-payone-provider/capture`
240
+ #### Capture
319
241
 
320
- Complete a preauthorized transaction and capture the funds.
242
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
321
243
 
322
- **Request Body:**
244
+ **Request Body**:
323
245
 
324
246
  ```json
325
247
  {
326
248
  "txid": "123456789",
327
249
  "amount": 1000,
328
- "currency": "EUR"
250
+ "currency": "EUR",
251
+ "sequencenumber": 1
252
+ }
253
+ ```
254
+
255
+ **Response**:
256
+
257
+ ```json
258
+ {
259
+ "data": {
260
+ "status": "APPROVED",
261
+ "txid": "123456789"
262
+ }
329
263
  }
330
264
  ```
331
265
 
332
- ##### POST `/api/strapi-plugin-payone-provider/refund`
266
+ #### Refund
333
267
 
334
- Refund a captured transaction.
268
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
335
269
 
336
- **Request Body:**
270
+ **Request Body**:
337
271
 
338
272
  ```json
339
273
  {
340
274
  "txid": "123456789",
341
275
  "amount": -1000,
342
276
  "currency": "EUR",
343
- "reference": "REFUND-12345",
277
+ "reference": "REF1234567890ABCDEF",
344
278
  "sequencenumber": 2
345
279
  }
346
280
  ```
347
281
 
348
- #### Admin API Endpoints
349
-
350
- These endpoints require admin authentication and are available at `/strapi-plugin-payone-provider/`.
351
-
352
- - `GET /strapi-plugin-payone-provider/settings` - Get current settings
353
- - `PUT /strapi-plugin-payone-provider/settings` - Update settings
354
- - `GET /strapi-plugin-payone-provider/transaction-history` - Get transaction history
355
- - `POST /strapi-plugin-payone-provider/test-connection` - Test Payone connection
356
- - All payment operation endpoints (same as content API)
282
+ **Response**:
357
283
 
358
- ### JavaScript/TypeScript Usage Example
359
-
360
- ```javascript
361
- // In your frontend application
362
- import axios from 'axios';
363
-
364
- const processPayment = async (orderData) => {
365
- try {
366
- // Step 1: Preauthorize the payment
367
- const preauth = await axios.post(
368
- 'http://localhost:1337/api/strapi-plugin-payone-provider/preauthorization',
369
- {
370
- amount: orderData.amount, // in cents, e.g., 1000 = 10.00 EUR
371
- currency: 'EUR',
372
- reference: orderData.orderId,
373
- clearingtype: 'cc',
374
- cardtype: 'V', // Visa
375
- cardpan: orderData.cardNumber,
376
- cardexpiredate: orderData.cardExpiry, // YYMM format
377
- cardcvc2: orderData.cardCvc,
378
- firstname: orderData.firstName,
379
- lastname: orderData.lastName,
380
- street: orderData.street,
381
- zip: orderData.zip,
382
- city: orderData.city,
383
- country: orderData.country,
384
- email: orderData.email,
385
- },
386
- {
387
- headers: {
388
- Authorization: `Bearer ${yourAuthToken}`,
389
- },
390
- }
391
- );
392
-
393
- if (preauth.data.data.status === 'APPROVED') {
394
- const txid = preauth.data.data.txid;
395
-
396
- // Step 2: Capture the preauthorized amount
397
- const capture = await axios.post(
398
- 'http://localhost:1337/api/strapi-plugin-payone-provider/capture',
399
- {
400
- txid: txid,
401
- amount: orderData.amount,
402
- currency: 'EUR',
403
- },
404
- {
405
- headers: {
406
- Authorization: `Bearer ${yourAuthToken}`,
407
- },
408
- }
409
- );
410
-
411
- return {
412
- success: true,
413
- transactionId: txid,
414
- };
415
- }
416
- } catch (error) {
417
- console.error('Payment failed:', error);
418
- return {
419
- success: false,
420
- error: error.message,
421
- };
284
+ ```json
285
+ {
286
+ "data": {
287
+ "status": "APPROVED",
288
+ "txid": "123456789"
422
289
  }
423
- };
290
+ }
424
291
  ```
425
292
 
426
- ## 💳 Payment Operations
427
-
428
- ## ✅ Supported Payment Methods
293
+ </details>
429
294
 
430
- The plugin supports the following Payone clearing types. Required fields are listed per method. All methods also require the common customer and address fields shown below.
295
+ ---
431
296
 
432
- Common required fields (all methods):
297
+ ### PayPal
433
298
 
434
- - `amount` (in cents), `currency`, `reference` (max 20 chars; auto-normalized)
435
- - `firstname`, `lastname`, `email`, `telephonenumber`
436
- - `street`, `zip`, `city`, `country`
299
+ <details>
300
+ <summary><strong>PayPal Payment Method</strong></summary>
437
301
 
438
- Credit Card (`clearingtype = cc`):
302
+ #### Preauthorization
439
303
 
440
- - Required: `cardtype` (V/M/A...), `cardpan`, `cardexpiredate` (MMyy), `cardcvc2`
441
- - Operations: preauthorization, authorization, capture, refund
442
- - Test payment in Admin currently supported for Credit Card only
304
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
443
305
 
444
- PayPal Wallet (`clearingtype = wlt`, `wallettype = PPE`):
306
+ **Request Body**:
445
307
 
446
- - Required: `successurl`, `errorurl`, `backurl` (redirect URLs)
447
- - Recommended shipping fields: `shipping_firstname`, `shipping_lastname`, `shipping_street`, `shipping_zip`, `shipping_city`, `shipping_country`
448
- - Operations: preauthorization, authorization (capture/refund roadmap)
308
+ ```json
309
+ {
310
+ "amount": 1000,
311
+ "currency": "EUR",
312
+ "reference": "PAY1234567890ABCDEF",
313
+ "clearingtype": "wlt",
314
+ "wallettype": "PPE",
315
+ "firstname": "John",
316
+ "lastname": "Doe",
317
+ "email": "john.doe@example.com",
318
+ "telephonenumber": "+4917512345678",
319
+ "street": "Main Street 123",
320
+ "zip": "12345",
321
+ "city": "Berlin",
322
+ "country": "DE",
323
+ "shipping_firstname": "John",
324
+ "shipping_lastname": "Doe",
325
+ "shipping_street": "Main Street 123",
326
+ "shipping_zip": "12345",
327
+ "shipping_city": "Berlin",
328
+ "shipping_country": "DE",
329
+ "successurl": "https://www.example.com/success",
330
+ "errorurl": "https://www.example.com/error",
331
+ "backurl": "https://www.example.com/back",
332
+ "salutation": "Herr",
333
+ "gender": "m",
334
+ "ip": "127.0.0.1",
335
+ "language": "de",
336
+ "customer_is_present": "yes"
337
+ }
338
+ ```
449
339
 
450
- SEPA Direct Debit (`clearingtype = elv`):
340
+ **Response**:
451
341
 
452
- - Required: `iban`, `bic`, `bankaccountholder`, `bankcountry`
453
- - Operations: preauthorization, authorization (capture/refund roadmap)
342
+ ```json
343
+ {
344
+ "data": {
345
+ "status": "REDIRECT",
346
+ "txid": "123456789",
347
+ "redirecturl": "https://secure.pay1.de/redirect/..."
348
+ }
349
+ }
350
+ ```
454
351
 
455
- Online Banking/PNT (`clearingtype = sb`):
352
+ #### Authorization
456
353
 
457
- - Required: `onlinebanktransfertype` (e.g. `PNT`), `bankcountry`, redirect URLs (`successurl`, `errorurl`, `backurl`)
458
- - Operations: authorization (capture/refund roadmap)
354
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
459
355
 
460
- Notes:
356
+ **Request Body**: (Same as Preauthorization)
461
357
 
462
- - The plugin normalizes `reference` server-side to comply with Payone (alphanumeric only, max 20 chars, auto-generated fallback).
463
- - For redirect flows, the plugin auto-fills redirect URLs when missing using a base URL from settings or environment.
358
+ ```json
359
+ {
360
+ "amount": 1000,
361
+ "currency": "EUR",
362
+ "reference": "PAY1234567890ABCDEF",
363
+ "clearingtype": "wlt",
364
+ "wallettype": "PPE",
365
+ "firstname": "John",
366
+ "lastname": "Doe",
367
+ "email": "john.doe@example.com",
368
+ "telephonenumber": "+4917512345678",
369
+ "street": "Main Street 123",
370
+ "zip": "12345",
371
+ "city": "Berlin",
372
+ "country": "DE",
373
+ "shipping_firstname": "John",
374
+ "shipping_lastname": "Doe",
375
+ "shipping_street": "Main Street 123",
376
+ "shipping_zip": "12345",
377
+ "shipping_city": "Berlin",
378
+ "shipping_country": "DE",
379
+ "successurl": "https://www.example.com/success",
380
+ "errorurl": "https://www.example.com/error",
381
+ "backurl": "https://www.example.com/back",
382
+ "salutation": "Herr",
383
+ "gender": "m",
384
+ "ip": "127.0.0.1",
385
+ "language": "de",
386
+ "customer_is_present": "yes"
387
+ }
388
+ ```
464
389
 
465
- ### Preauthorization vs Authorization
390
+ **Response**:
466
391
 
467
- - **Preauthorization**: Reserves funds on the customer's card but doesn't charge it immediately. Use this when you need to verify funds availability before fulfilling an order (e.g., hotel bookings, rentals). You must later call "Capture" to actually charge the card.
392
+ ```json
393
+ {
394
+ "data": {
395
+ "status": "REDIRECT",
396
+ "txid": "123456789",
397
+ "redirecturl": "https://secure.pay1.de/redirect/..."
398
+ }
399
+ }
400
+ ```
468
401
 
469
- - **Authorization**: Immediately charges the customer's card. Use this for instant payments (e.g., e-commerce purchases).
402
+ #### Capture
470
403
 
471
- ### Capture
404
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
472
405
 
473
- After a successful preauthorization, you must capture the transaction to receive the funds. Captures can be:
406
+ **Request Body**:
474
407
 
475
- - **Full capture**: Capture the entire preauthorized amount
476
- - **Partial capture**: Capture less than the preauthorized amount
408
+ ```json
409
+ {
410
+ "txid": "123456789",
411
+ "amount": 1000,
412
+ "currency": "EUR",
413
+ "sequencenumber": 1,
414
+ "capturemode": "full"
415
+ }
416
+ ```
477
417
 
478
- ### Refund
418
+ **Response**:
479
419
 
480
- Refunds return money to the customer. Important notes:
420
+ ```json
421
+ {
422
+ "data": {
423
+ "status": "APPROVED",
424
+ "txid": "123456789"
425
+ }
426
+ }
427
+ ```
481
428
 
482
- - Amount must be negative (e.g., -1000 for 10.00 EUR)
483
- - Requires a valid transaction ID (txid)
484
- - Requires a sequence number (start with 2, increment for each additional refund on same transaction)
429
+ #### Refund
485
430
 
486
- > Current limitation: Capture and Refund are implemented for Credit Card only. Support for PayPal/SEPA/Online Banking will be added in future updates.
431
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
487
432
 
488
- ## 📊 Transaction History
433
+ **Request Body**:
489
434
 
490
- All payment operations are automatically logged to the transaction history. Each entry includes:
435
+ ```json
436
+ {
437
+ "txid": "123456789",
438
+ "amount": -1000,
439
+ "currency": "EUR",
440
+ "reference": "REF1234567890ABCDEF",
441
+ "sequencenumber": 2
442
+ }
443
+ ```
491
444
 
492
- - **Transaction ID (txid)**: Payone's unique transaction identifier
493
- - **Reference**: Your custom order/payment reference
494
- - **Type**: Operation type (authorization, preauthorization, capture, refund)
495
- - **Amount**: Transaction amount in cents
496
- - **Currency**: Currency code (EUR, USD, etc.)
497
- - **Status**: APPROVED, ERROR, REDIRECT, etc.
498
- - **Timestamp**: When the transaction occurred
499
- - **Raw Request/Response**: Complete API request and response data for debugging
445
+ **Response**:
500
446
 
501
- ### Filtering Transactions
447
+ ```json
448
+ {
449
+ "data": {
450
+ "status": "APPROVED",
451
+ "txid": "123456789"
452
+ }
453
+ }
454
+ ```
502
455
 
503
- Use the filters in the Transaction History tab to find specific transactions:
456
+ </details>
504
457
 
505
- - **Status**: Filter by APPROVED, ERROR, etc.
506
- - **Type**: Filter by operation type
507
- - **Transaction ID**: Search by specific txid
508
- - **Reference**: Search by your order reference
509
- - **Date Range**: Filter by date
458
+ ---
510
459
 
511
- ## 🔍 Troubleshooting
460
+ ### Google Pay
512
461
 
513
- ### Connection Test Fails
462
+ <details>
463
+ <summary><strong>Google Pay Payment Method</strong></summary>
514
464
 
515
- **Problem**: "Authentication failed" or "Invalid credentials"
465
+ #### Overview
516
466
 
517
- **Solutions**:
467
+ Google Pay integration requires obtaining an encrypted payment token from Google Pay API and sending it to Payone. The token must be Base64 encoded before sending to Payone.
518
468
 
519
- 1. Verify your AID, Portal ID, Merchant ID, and Portal Key are correct
520
- 2. Ensure you're using the correct mode (test/live)
521
- 3. Check that your Payone account is active and not suspended
522
- 4. Verify the Portal Key is the MD5 hash key from your Payone PMI
469
+ #### Getting Google Pay Token
523
470
 
524
- ### Payment Gets Rejected
471
+ **1. Include Google Pay Script**
525
472
 
526
- **Problem**: Transactions return ERROR status
473
+ ```html
474
+ <script async src="https://pay.google.com/gp/p/js/pay.js"></script>
475
+ ```
527
476
 
528
- **Common Causes**:
477
+ **2. Initialize Google Pay**
529
478
 
530
- 1. **Invalid card data**: Check card number, expiry date, and CVC
531
- 2. **Insufficient funds**: Test cards may have limits
532
- 3. **Duplicate reference**: Each transaction needs a unique reference
533
- 4. **Missing required fields**: Ensure all required customer data is provided
534
- 5. **Test mode restrictions**: Some features may be limited in test mode
479
+ ```javascript
480
+ const paymentsClient = new google.payments.api.PaymentsClient({
481
+ environment: 'TEST', // or "PRODUCTION" for live
482
+ });
535
483
 
536
- **Debug Steps**:
484
+ const baseRequest = {
485
+ apiVersion: 2,
486
+ apiVersionMinor: 0,
487
+ };
537
488
 
538
- 1. Check the Transaction History for error codes and messages
539
- 2. Review the raw response data for detailed error information
540
- 3. Consult the Payone API documentation for error code meanings
541
- 4. Check your Strapi server logs for detailed error traces
489
+ const allowedCardNetworks = ['MASTERCARD', 'VISA'];
490
+ const allowedAuthMethods = ['PAN_ONLY', 'CRYPTOGRAM_3DS'];
542
491
 
543
- ### Plugin Not Appearing in Admin
492
+ const tokenizationSpecification = {
493
+ type: 'PAYMENT_GATEWAY',
494
+ parameters: {
495
+ gateway: 'payonegmbh',
496
+ gatewayMerchantId: 'YOUR_PAYONE_MERCHANT_ID', // Use your Payone MID or Portal ID
497
+ },
498
+ };
544
499
 
545
- **Problem**: Payone Provider menu item doesn't appear
500
+ const cardPaymentMethod = {
501
+ type: 'CARD',
502
+ parameters: {
503
+ allowedCardNetworks,
504
+ allowedAuthMethods,
505
+ },
506
+ tokenizationSpecification,
507
+ };
546
508
 
547
- **Solutions**:
509
+ const isReadyToPayRequest = Object.assign({}, baseRequest);
510
+ isReadyToPayRequest.allowedPaymentMethods = [cardPaymentMethod];
548
511
 
549
- 1. Ensure the plugin is enabled in `config/plugins.js`
550
- 2. Run `npm run build` to rebuild the admin panel
551
- 3. Clear your browser cache and refresh
552
- 4. Restart your Strapi server
553
- 5. Check browser console for JavaScript errors
512
+ paymentsClient.isReadyToPay(isReadyToPayRequest).then(function (response) {
513
+ if (response.result) {
514
+ // Google Pay is available, show button
515
+ }
516
+ });
517
+ ```
554
518
 
555
- ### API Requests Return 403 Forbidden
519
+ **3. Create Payment Button and Get Token**
556
520
 
557
- **Problem**: Content API endpoints return authorization errors
521
+ ```javascript
522
+ const paymentDataRequest = Object.assign({}, baseRequest);
523
+ paymentDataRequest.allowedPaymentMethods = [cardPaymentMethod];
524
+ paymentDataRequest.transactionInfo = {
525
+ totalPriceStatus: 'FINAL',
526
+ totalPrice: '10.00',
527
+ currencyCode: 'EUR',
528
+ };
529
+ paymentDataRequest.merchantInfo = {
530
+ merchantId: 'YOUR_GOOGLE_MERCHANT_ID', // Optional: from Google Console
531
+ merchantName: 'Your Merchant Name',
532
+ };
558
533
 
559
- **Solutions**:
534
+ const button = paymentsClient.createButton({
535
+ onClick: async () => {
536
+ try {
537
+ const paymentData = await paymentsClient.loadPaymentData(paymentDataRequest);
538
+ const token = paymentData.paymentMethodData.tokenizationData.token;
560
539
 
561
- 1. Ensure you're sending a valid authentication token
562
- 2. Check that the `isAuth` policy is properly configured
563
- 3. Verify your user has the necessary permissions
564
- 4. Review Strapi's role and permissions settings
540
+ // Token is a JSON string, encode it to Base64 for Payone
541
+ const base64Token = btoa(unescape(encodeURIComponent(token)));
565
542
 
566
- ### Transactions Not Logging
543
+ // Send to your backend
544
+ await fetch('/api/strapi-plugin-payone-provider/preauthorization', {
545
+ method: 'POST',
546
+ headers: {
547
+ 'Content-Type': 'application/json',
548
+ Authorization: 'Bearer YOUR_TOKEN',
549
+ },
550
+ body: JSON.stringify({
551
+ amount: 1000,
552
+ currency: 'EUR',
553
+ reference: 'PAY1234567890ABCDEF',
554
+ googlePayToken: base64Token,
555
+ }),
556
+ });
557
+ } catch (error) {
558
+ console.error('Google Pay error:', error);
559
+ }
560
+ },
561
+ });
567
562
 
568
- **Problem**: Transaction history is empty
563
+ document.getElementById('google-pay-button').appendChild(button);
564
+ ```
569
565
 
570
- **Solutions**:
566
+ **Token Format**
571
567
 
572
- 1. Check that requests are actually reaching Payone (check server logs)
573
- 2. Verify database write permissions
574
- 3. Check for JavaScript errors in the browser console
575
- 4. Ensure the plugin store is accessible
568
+ The token from Google Pay is a JSON string with the following structure:
576
569
 
577
- ## 🔐 Security Best Practices
570
+ ```json
571
+ {
572
+ "signature": "MEUCIFr4ETGzv0uLZX3sR+i1ScARXnRBrncyYFDX/TI/VSLCAiEAvC/Q4dqXMQhwcSdg/ZvXj8+up0wXsfHja3V/6z48/vk=",
573
+ "intermediateSigningKey": {
574
+ "signedKey": "{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7PWUi+e6WPUhNmTSQ2WN006oWlcWy0FtBWizw9sph1wvX9XcXUNRLcfcsmCBfI5IsKQkjAmYxpCSB+L5sIudLw\\u003d\\u003d\",\"keyExpiration\":\"1722393105282\"}",
575
+ "signatures": ["MEUCIQCpU30A3g2pP93IBE5NxgO9ZcJlGF9YPzCZS7H4/IR1CQIgF6+I5t8olT8YsRDUcj7w3R1bvX4ZCcyFXE2+YXa+3H0="]
576
+ },
577
+ "protocolVersion": "ECv2",
578
+ "signedMessage": "{\"encryptedMessage\":\"...\",\"ephemeralPublicKey\":\"...\",\"tag\":\"...\"}"
579
+ }
580
+ ```
578
581
 
579
- 1. **Never expose your Portal Key**: Keep it secure and never commit it to version control
580
- 2. **Use environment variables**: Store credentials in `.env` files (excluded from git)
581
- 3. **Enable HTTPS**: Always use HTTPS in production for API requests
582
- 4. **Validate user input**: Always validate and sanitize payment data on the server side
583
- 5. **Use test mode**: Test thoroughly in test mode before going live
584
- 6. **Monitor transactions**: Regularly review transaction history for suspicious activity
585
- 7. **PCI Compliance**: If handling card data directly, ensure PCI DSS compliance
582
+ **Important**: The token must be Base64 encoded before sending to Payone.
586
583
 
587
- ## 📝 License
584
+ #### Preauthorization
588
585
 
589
- MIT
586
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
590
587
 
591
- ## 🤝 Support
588
+ **Request Body**:
592
589
 
593
- If you encounter issues or need help:
590
+ ```json
591
+ {
592
+ "amount": 1000,
593
+ "currency": "EUR",
594
+ "reference": "PAY1234567890ABCDEF",
595
+ "clearingtype": "wlt",
596
+ "wallettype": "GGP",
597
+ "firstname": "John",
598
+ "lastname": "Doe",
599
+ "email": "john.doe@example.com",
600
+ "telephonenumber": "+4917512345678",
601
+ "street": "Main Street 123",
602
+ "zip": "12345",
603
+ "city": "Berlin",
604
+ "country": "DE",
605
+ "shipping_firstname": "John",
606
+ "shipping_lastname": "Doe",
607
+ "shipping_street": "Main Street 123",
608
+ "shipping_zip": "12345",
609
+ "shipping_city": "Berlin",
610
+ "shipping_country": "DE",
611
+ "successurl": "https://www.example.com/success",
612
+ "errorurl": "https://www.example.com/error",
613
+ "backurl": "https://www.example.com/back",
614
+ "googlePayToken": "BASE64_ENCODED_TOKEN",
615
+ "salutation": "Herr",
616
+ "gender": "m",
617
+ "ip": "127.0.0.1",
618
+ "language": "de",
619
+ "customer_is_present": "yes"
620
+ }
621
+ ```
594
622
 
595
- 1. Check this README thoroughly
596
- 2. Review your Strapi server logs
597
- 3. Consult the [Payone API Documentation](https://docs.payone.com/)
598
- 4. Check the Transaction History for detailed error messages
623
+ **Payone Request Parameters** (automatically added by plugin):
599
624
 
600
- ## 🔄 Updates
625
+ ```json
626
+ {
627
+ "request": "preauthorization",
628
+ "amount": 1000,
629
+ "currency": "EUR",
630
+ "reference": "PAY1234567890ABCDEF",
631
+ "clearingtype": "wlt",
632
+ "wallettype": "GGP",
633
+ "add_paydata[paymentmethod_token_data]": "BASE64_ENCODED_TOKEN",
634
+ "add_paydata[paymentmethod]": "GGP",
635
+ "add_paydata[paymentmethod_type]": "GOOGLEPAY",
636
+ "add_paydata[gatewayid]": "payonegmbh",
637
+ "add_paydata[gateway_merchantid]": "YOUR_PAYONE_MERCHANT_ID",
638
+ "firstname": "John",
639
+ "lastname": "Doe",
640
+ "email": "john.doe@example.com",
641
+ "street": "Main Street 123",
642
+ "zip": "12345",
643
+ "city": "Berlin",
644
+ "country": "DE",
645
+ "shipping_firstname": "John",
646
+ "shipping_lastname": "Doe",
647
+ "shipping_street": "Main Street 123",
648
+ "shipping_zip": "12345",
649
+ "shipping_city": "Berlin",
650
+ "shipping_country": "DE",
651
+ "successurl": "https://www.example.com/success",
652
+ "errorurl": "https://www.example.com/error",
653
+ "backurl": "https://www.example.com/back"
654
+ }
655
+ ```
601
656
 
602
- To update the plugin:
657
+ **Response**:
603
658
 
604
- ```bash
605
- # Using npm
606
- npm update strapi-plugin-payone-provider
607
- npm run build
659
+ ```json
660
+ {
661
+ "data": {
662
+ "status": "APPROVED",
663
+ "txid": "123456789"
664
+ }
665
+ }
666
+ ```
608
667
 
609
- # Using yarn
610
- yarn upgrade strapi-plugin-payone-provider
611
- yarn build
668
+ #### Authorization
612
669
 
613
- # Using pnpm
614
- pnpm update strapi-plugin-payone-provider
615
- pnpm build
616
- ```
670
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
617
671
 
618
- Then restart your Strapi application.
672
+ **Request Body**: (Same as Preauthorization, include `googlePayToken`)
619
673
 
620
- ---
674
+ ```json
675
+ {
676
+ "amount": 1000,
677
+ "currency": "EUR",
678
+ "reference": "PAY1234567890ABCDEF",
679
+ "clearingtype": "wlt",
680
+ "wallettype": "GGP",
681
+ "googlePayToken": "BASE64_ENCODED_TOKEN",
682
+ "firstname": "John",
683
+ "lastname": "Doe",
684
+ "email": "john.doe@example.com",
685
+ "street": "Main Street 123",
686
+ "zip": "12345",
687
+ "city": "Berlin",
688
+ "country": "DE",
689
+ "shipping_firstname": "John",
690
+ "shipping_lastname": "Doe",
691
+ "shipping_street": "Main Street 123",
692
+ "shipping_zip": "12345",
693
+ "shipping_city": "Berlin",
694
+ "shipping_country": "DE",
695
+ "successurl": "https://www.example.com/success",
696
+ "errorurl": "https://www.example.com/error",
697
+ "backurl": "https://www.example.com/back"
698
+ }
699
+ ```
700
+
701
+ **Response**:
702
+
703
+ ```json
704
+ {
705
+ "data": {
706
+ "status": "APPROVED",
707
+ "txid": "123456789"
708
+ }
709
+ }
710
+ ```
711
+
712
+ #### Capture
713
+
714
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
715
+
716
+ **Request Body**:
717
+
718
+ ```json
719
+ {
720
+ "txid": "123456789",
721
+ "amount": 1000,
722
+ "currency": "EUR",
723
+ "sequencenumber": 1
724
+ }
725
+ ```
726
+
727
+ **Response**:
728
+
729
+ ```json
730
+ {
731
+ "data": {
732
+ "status": "APPROVED",
733
+ "txid": "123456789"
734
+ }
735
+ }
736
+ ```
737
+
738
+ #### Refund
739
+
740
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
741
+
742
+ **Request Body**:
743
+
744
+ ```json
745
+ {
746
+ "txid": "123456789",
747
+ "amount": -1000,
748
+ "currency": "EUR",
749
+ "reference": "REF1234567890ABCDEF",
750
+ "sequencenumber": 2
751
+ }
752
+ ```
753
+
754
+ **Response**:
755
+
756
+ ```json
757
+ {
758
+ "data": {
759
+ "status": "APPROVED",
760
+ "txid": "123456789"
761
+ }
762
+ }
763
+ ```
764
+
765
+ #### Required Parameters for Google Pay
766
+
767
+ - `clearingtype`: Must be `"wlt"` (wallet)
768
+ - `wallettype`: Must be `"GGP"` (Google Pay)
769
+ - `add_paydata[paymentmethod_token_data]`: Base64 encoded Google Pay token (automatically added by plugin)
770
+ - `add_paydata[paymentmethod]`: `"GGP"` (automatically added by plugin)
771
+ - `add_paydata[paymentmethod_type]`: `"GOOGLEPAY"` (automatically added by plugin)
772
+ - `add_paydata[gatewayid]`: `"payonegmbh"` (automatically added by plugin)
773
+ - `add_paydata[gateway_merchantid]`: Your Payone Merchant ID (automatically added by plugin)
774
+ - Shipping address parameters (required for wallet payments)
775
+
776
+ </details>
777
+
778
+ ---
779
+
780
+ ### Apple Pay
781
+
782
+ <details>
783
+ <summary><strong>Apple Pay Payment Method</strong></summary>
784
+
785
+ #### Preauthorization
786
+
787
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
788
+
789
+ **Request Body**:
790
+
791
+ ```json
792
+ {
793
+ "amount": 1000,
794
+ "currency": "EUR",
795
+ "reference": "PAY1234567890ABCDEF",
796
+ "clearingtype": "wlt",
797
+ "wallettype": "APL",
798
+ "firstname": "John",
799
+ "lastname": "Doe",
800
+ "email": "john.doe@example.com",
801
+ "telephonenumber": "+4917512345678",
802
+ "street": "Main Street 123",
803
+ "zip": "12345",
804
+ "city": "Berlin",
805
+ "country": "DE",
806
+ "shipping_firstname": "John",
807
+ "shipping_lastname": "Doe",
808
+ "shipping_street": "Main Street 123",
809
+ "shipping_zip": "12345",
810
+ "shipping_city": "Berlin",
811
+ "shipping_country": "DE",
812
+ "successurl": "https://www.example.com/success",
813
+ "errorurl": "https://www.example.com/error",
814
+ "backurl": "https://www.example.com/back",
815
+ "salutation": "Herr",
816
+ "gender": "m",
817
+ "ip": "127.0.0.1",
818
+ "language": "de",
819
+ "customer_is_present": "yes"
820
+ }
821
+ ```
822
+
823
+ **Response**:
824
+
825
+ ```json
826
+ {
827
+ "data": {
828
+ "status": "REDIRECT",
829
+ "txid": "123456789",
830
+ "redirecturl": "https://secure.pay1.de/redirect/..."
831
+ }
832
+ }
833
+ ```
834
+
835
+ #### Authorization
836
+
837
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
838
+
839
+ **Request Body**: (Same as Preauthorization)
840
+
841
+ ```json
842
+ {
843
+ "amount": 1000,
844
+ "currency": "EUR",
845
+ "reference": "PAY1234567890ABCDEF",
846
+ "clearingtype": "wlt",
847
+ "wallettype": "APL",
848
+ "firstname": "John",
849
+ "lastname": "Doe",
850
+ "email": "john.doe@example.com",
851
+ "telephonenumber": "+4917512345678",
852
+ "street": "Main Street 123",
853
+ "zip": "12345",
854
+ "city": "Berlin",
855
+ "country": "DE",
856
+ "shipping_firstname": "John",
857
+ "shipping_lastname": "Doe",
858
+ "shipping_street": "Main Street 123",
859
+ "shipping_zip": "12345",
860
+ "shipping_city": "Berlin",
861
+ "shipping_country": "DE",
862
+ "successurl": "https://www.example.com/success",
863
+ "errorurl": "https://www.example.com/error",
864
+ "backurl": "https://www.example.com/back",
865
+ "salutation": "Herr",
866
+ "gender": "m",
867
+ "ip": "127.0.0.1",
868
+ "language": "de",
869
+ "customer_is_present": "yes"
870
+ }
871
+ ```
872
+
873
+ **Response**:
874
+
875
+ ```json
876
+ {
877
+ "data": {
878
+ "status": "REDIRECT",
879
+ "txid": "123456789",
880
+ "redirecturl": "https://secure.pay1.de/redirect/..."
881
+ }
882
+ }
883
+ ```
884
+
885
+ #### Capture
886
+
887
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
888
+
889
+ **Request Body**:
890
+
891
+ ```json
892
+ {
893
+ "txid": "123456789",
894
+ "amount": 1000,
895
+ "currency": "EUR",
896
+ "sequencenumber": 1,
897
+ "capturemode": "full"
898
+ }
899
+ ```
900
+
901
+ **Response**:
902
+
903
+ ```json
904
+ {
905
+ "data": {
906
+ "status": "APPROVED",
907
+ "txid": "123456789"
908
+ }
909
+ }
910
+ ```
911
+
912
+ #### Refund
913
+
914
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
915
+
916
+ **Request Body**:
917
+
918
+ ```json
919
+ {
920
+ "txid": "123456789",
921
+ "amount": -1000,
922
+ "currency": "EUR",
923
+ "reference": "REF1234567890ABCDEF",
924
+ "sequencenumber": 2
925
+ }
926
+ ```
927
+
928
+ **Response**:
929
+
930
+ ```json
931
+ {
932
+ "data": {
933
+ "status": "APPROVED",
934
+ "txid": "123456789"
935
+ }
936
+ }
937
+ ```
938
+
939
+ </details>
940
+
941
+ ---
942
+
943
+ ### SEPA Direct Debit
944
+
945
+ <details>
946
+ <summary><strong>SEPA Direct Debit Payment Method</strong></summary>
947
+
948
+ #### Preauthorization
949
+
950
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
951
+
952
+ **Request Body**:
953
+
954
+ ```json
955
+ {
956
+ "amount": 1000,
957
+ "currency": "EUR",
958
+ "reference": "PAY1234567890ABCDEF",
959
+ "clearingtype": "elv",
960
+ "iban": "DE89370400440532013000",
961
+ "bic": "COBADEFFXXX",
962
+ "bankaccountholder": "John Doe",
963
+ "bankcountry": "DE",
964
+ "firstname": "John",
965
+ "lastname": "Doe",
966
+ "email": "john.doe@example.com",
967
+ "telephonenumber": "+4917512345678",
968
+ "street": "Main Street 123",
969
+ "zip": "12345",
970
+ "city": "Berlin",
971
+ "country": "DE",
972
+ "salutation": "Herr",
973
+ "gender": "m",
974
+ "ip": "127.0.0.1",
975
+ "language": "de",
976
+ "customer_is_present": "yes"
977
+ }
978
+ ```
979
+
980
+ **Response**:
981
+
982
+ ```json
983
+ {
984
+ "data": {
985
+ "status": "APPROVED",
986
+ "txid": "123456789",
987
+ "userid": "987654321"
988
+ }
989
+ }
990
+ ```
991
+
992
+ #### Authorization
993
+
994
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
995
+
996
+ **Request Body**: (Same as Preauthorization)
997
+
998
+ ```json
999
+ {
1000
+ "amount": 1000,
1001
+ "currency": "EUR",
1002
+ "reference": "PAY1234567890ABCDEF",
1003
+ "clearingtype": "elv",
1004
+ "iban": "DE89370400440532013000",
1005
+ "bic": "COBADEFFXXX",
1006
+ "bankaccountholder": "John Doe",
1007
+ "bankcountry": "DE",
1008
+ "firstname": "John",
1009
+ "lastname": "Doe",
1010
+ "email": "john.doe@example.com",
1011
+ "telephonenumber": "+4917512345678",
1012
+ "street": "Main Street 123",
1013
+ "zip": "12345",
1014
+ "city": "Berlin",
1015
+ "country": "DE",
1016
+ "salutation": "Herr",
1017
+ "gender": "m",
1018
+ "ip": "127.0.0.1",
1019
+ "language": "de",
1020
+ "customer_is_present": "yes"
1021
+ }
1022
+ ```
1023
+
1024
+ **Response**:
1025
+
1026
+ ```json
1027
+ {
1028
+ "data": {
1029
+ "status": "APPROVED",
1030
+ "txid": "123456789",
1031
+ "userid": "987654321"
1032
+ }
1033
+ }
1034
+ ```
1035
+
1036
+ #### Capture
1037
+
1038
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
1039
+
1040
+ **Request Body**:
1041
+
1042
+ ```json
1043
+ {
1044
+ "txid": "123456789",
1045
+ "amount": 1000,
1046
+ "currency": "EUR",
1047
+ "sequencenumber": 1
1048
+ }
1049
+ ```
1050
+
1051
+ **Response**:
1052
+
1053
+ ```json
1054
+ {
1055
+ "data": {
1056
+ "status": "APPROVED",
1057
+ "txid": "123456789"
1058
+ }
1059
+ }
1060
+ ```
1061
+
1062
+ #### Refund
1063
+
1064
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
1065
+
1066
+ **Request Body**:
1067
+
1068
+ ```json
1069
+ {
1070
+ "txid": "123456789",
1071
+ "amount": -1000,
1072
+ "currency": "EUR",
1073
+ "reference": "REF1234567890ABCDEF",
1074
+ "sequencenumber": 2
1075
+ }
1076
+ ```
1077
+
1078
+ **Response**:
1079
+
1080
+ ```json
1081
+ {
1082
+ "data": {
1083
+ "status": "APPROVED",
1084
+ "txid": "123456789"
1085
+ }
1086
+ }
1087
+ ```
1088
+
1089
+ </details>
1090
+
1091
+ ---
1092
+
1093
+ ### Sofort Banking
1094
+
1095
+ <details>
1096
+ <summary><strong>Sofort Banking Payment Method</strong></summary>
1097
+
1098
+ #### Preauthorization
1099
+
1100
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
1101
+
1102
+ **Request Body**:
1103
+
1104
+ ```json
1105
+ {
1106
+ "amount": 1000,
1107
+ "currency": "EUR",
1108
+ "reference": "PAY1234567890ABCDEF",
1109
+ "clearingtype": "sb",
1110
+ "onlinebanktransfertype": "PNT",
1111
+ "bankcountry": "DE",
1112
+ "firstname": "John",
1113
+ "lastname": "Doe",
1114
+ "email": "john.doe@example.com",
1115
+ "telephonenumber": "+4917512345678",
1116
+ "street": "Main Street 123",
1117
+ "zip": "12345",
1118
+ "city": "Berlin",
1119
+ "country": "DE",
1120
+ "successurl": "https://www.example.com/success",
1121
+ "errorurl": "https://www.example.com/error",
1122
+ "backurl": "https://www.example.com/back",
1123
+ "salutation": "Herr",
1124
+ "gender": "m",
1125
+ "ip": "127.0.0.1",
1126
+ "language": "de",
1127
+ "customer_is_present": "yes"
1128
+ }
1129
+ ```
1130
+
1131
+ **Response**:
1132
+
1133
+ ```json
1134
+ {
1135
+ "data": {
1136
+ "status": "REDIRECT",
1137
+ "txid": "123456789",
1138
+ "redirecturl": "https://secure.pay1.de/redirect/..."
1139
+ }
1140
+ }
1141
+ ```
1142
+
1143
+ #### Authorization
1144
+
1145
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
1146
+
1147
+ **Request Body**: (Same as Preauthorization)
1148
+
1149
+ ```json
1150
+ {
1151
+ "amount": 1000,
1152
+ "currency": "EUR",
1153
+ "reference": "PAY1234567890ABCDEF",
1154
+ "clearingtype": "sb",
1155
+ "onlinebanktransfertype": "PNT",
1156
+ "bankcountry": "DE",
1157
+ "firstname": "John",
1158
+ "lastname": "Doe",
1159
+ "email": "john.doe@example.com",
1160
+ "telephonenumber": "+4917512345678",
1161
+ "street": "Main Street 123",
1162
+ "zip": "12345",
1163
+ "city": "Berlin",
1164
+ "country": "DE",
1165
+ "successurl": "https://www.example.com/success",
1166
+ "errorurl": "https://www.example.com/error",
1167
+ "backurl": "https://www.example.com/back",
1168
+ "salutation": "Herr",
1169
+ "gender": "m",
1170
+ "ip": "127.0.0.1",
1171
+ "language": "de",
1172
+ "customer_is_present": "yes"
1173
+ }
1174
+ ```
1175
+
1176
+ **Response**:
1177
+
1178
+ ```json
1179
+ {
1180
+ "data": {
1181
+ "status": "REDIRECT",
1182
+ "txid": "123456789",
1183
+ "redirecturl": "https://secure.pay1.de/redirect/..."
1184
+ }
1185
+ }
1186
+ ```
1187
+
1188
+ #### Capture
1189
+
1190
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
1191
+
1192
+ **Request Body**:
1193
+
1194
+ ```json
1195
+ {
1196
+ "txid": "123456789",
1197
+ "amount": 1000,
1198
+ "currency": "EUR",
1199
+ "sequencenumber": 1
1200
+ }
1201
+ ```
1202
+
1203
+ **Response**:
1204
+
1205
+ ```json
1206
+ {
1207
+ "data": {
1208
+ "status": "APPROVED",
1209
+ "txid": "123456789"
1210
+ }
1211
+ }
1212
+ ```
1213
+
1214
+ #### Refund
1215
+
1216
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
1217
+
1218
+ **Request Body**:
1219
+
1220
+ ```json
1221
+ {
1222
+ "txid": "123456789",
1223
+ "amount": -1000,
1224
+ "currency": "EUR",
1225
+ "reference": "REF1234567890ABCDEF",
1226
+ "sequencenumber": 2
1227
+ }
1228
+ ```
1229
+
1230
+ **Response**:
1231
+
1232
+ ```json
1233
+ {
1234
+ "data": {
1235
+ "status": "APPROVED",
1236
+ "txid": "123456789"
1237
+ }
1238
+ }
1239
+ ```
1240
+
1241
+ </details>
1242
+
1243
+ ---
1244
+
1245
+ ## ✅ Supported Payment Methods
1246
+
1247
+ Click on any payment method to see detailed API documentation:
1248
+
1249
+ - [Credit Card](#credit-card)
1250
+ - [PayPal](#paypal)
1251
+ - [Google Pay](#google-pay)
1252
+ - [Apple Pay](#apple-pay)
1253
+ - [SEPA Direct Debit](#sepa-direct-debit)
1254
+ - [Sofort Banking](#sofort-banking)
1255
+
1256
+ ---
1257
+
1258
+ ## 📝 Notes
1259
+
1260
+ ### Important Parameters
1261
+
1262
+ - **amount**: Always in cents (e.g., 1000 = 10.00 EUR)
1263
+ - **reference**: Max 20 characters, alphanumeric only. Auto-normalized by the plugin.
1264
+ - **cardexpiredate**: Format is YYMM (e.g., "2512" = December 2025)
1265
+ - **sequencenumber**: Start with 1 for capture, 2 for first refund, increment for subsequent refunds
1266
+ - **Refund amount**: Must be negative (e.g., -1000 for 10.00 EUR refund)
1267
+
1268
+ ### Redirect URLs
1269
+
1270
+ For redirect-based payment methods (PayPal, Google Pay, Apple Pay, Sofort), you must provide:
1271
+
1272
+ - `successurl`: URL to redirect after successful payment
1273
+ - `errorurl`: URL to redirect after payment error
1274
+ - `backurl`: URL to redirect if user cancels payment
1275
+
1276
+ ### Preauthorization vs Authorization
1277
+
1278
+ - **Preauthorization**: Reserves funds but doesn't charge immediately. Requires a Capture call later.
1279
+ - **Authorization**: Immediately charges the customer's payment method.
1280
+
1281
+ ### Capture Mode
1282
+
1283
+ For wallet payments (PayPal, Google Pay, Apple Pay), you can specify:
621
1284
 
622
- **Made with ❤️ for Strapi**
1285
+ - `capturemode: "full"`: Capture the entire preauthorized amount
1286
+ - `capturemode: "partial"`: Capture less than the preauthorized amount