strapi-plugin-payone-provider 1.1.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 (36) hide show
  1. package/README.md +1045 -330
  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,50 +52,17 @@ You will need the following credentials from your Payone account:
57
52
 
58
53
  ## 📦 Installation
59
54
 
60
- ### Option 1: Install from npm (if published)
55
+ ### Install from npm
61
56
 
62
57
  ```bash
63
- npm install payone-provider
64
- ```
65
-
66
- ### Option 2: Manual Installation
67
-
68
- 1. Copy the `payone-provider` folder to your Strapi project's `src/plugins/` directory:
69
-
70
- ```bash
71
- # From your Strapi project root
72
- mkdir -p src/plugins
73
- cp -r /path/to/payone-provider src/plugins/
74
- ```
75
-
76
- 2. Install the plugin dependencies:
77
-
78
- ```bash
79
- npm install
80
- ```
81
-
82
- 3. Enable the plugin by adding it to your `config/plugins.js` (or `config/plugins.ts`):
83
-
84
- ```javascript
85
- module.exports = {
86
- // ... other plugins
87
- 'payone-provider': {
88
- enabled: true,
89
- resolve: './src/plugins/payone-provider',
90
- },
91
- };
92
- ```
58
+ # Using npm
59
+ npm install strapi-plugin-payone-provider
93
60
 
94
- 4. Rebuild your Strapi admin panel:
61
+ # Using yarn
62
+ yarn add strapi-plugin-payone-provider
95
63
 
96
- ```bash
97
- npm run build
98
- ```
99
-
100
- 5. Restart your Strapi application:
101
-
102
- ```bash
103
- npm run develop
64
+ # Using pnpm
65
+ pnpm add strapi-plugin-payone-provider
104
66
  ```
105
67
 
106
68
  ## ⚙️ Configuration
@@ -122,49 +84,6 @@ After installation, you need to configure your Payone credentials:
122
84
  5. Click **"Test Connection"** to verify your credentials
123
85
  6. Click **"Save Configuration"** to store your settings
124
86
 
125
- ### Manual Configuration (Alternative)
126
-
127
- You can also configure the plugin programmatically by adding settings to your `config/plugins.js`:
128
-
129
- ```javascript
130
- module.exports = {
131
- 'payone-provider': {
132
- enabled: true,
133
- resolve: './src/plugins/payone-provider',
134
- config: {
135
- settings: {
136
- aid: 'YOUR_ACCOUNT_ID',
137
- portalid: 'YOUR_PORTAL_ID',
138
- mid: 'YOUR_MERCHANT_ID',
139
- key: 'YOUR_PORTAL_KEY',
140
- mode: 'test', // or 'live'
141
- api_version: '3.10',
142
- },
143
- },
144
- },
145
- };
146
- ```
147
-
148
- > ⚠️ **Security Warning**: Never commit your production credentials to version control. Use environment variables instead:
149
-
150
- ```javascript
151
- module.exports = {
152
- 'payone-provider': {
153
- enabled: true,
154
- config: {
155
- settings: {
156
- aid: process.env.PAYONE_AID,
157
- portalid: process.env.PAYONE_PORTAL_ID,
158
- mid: process.env.PAYONE_MID,
159
- key: process.env.PAYONE_KEY,
160
- mode: process.env.PAYONE_MODE || 'test',
161
- api_version: '3.10',
162
- },
163
- },
164
- },
165
- };
166
- ```
167
-
168
87
  ## 🚀 Getting Started
169
88
 
170
89
  ### 1. Test Your Connection
@@ -179,65 +98,62 @@ After configuring your credentials:
179
98
  ### 2. Try a Test Payment
180
99
 
181
100
  1. Go to the **Payment Actions** tab
182
- 2. Try a **Preauthorization** operation (currently test UI supports Credit Card only):
101
+ 2. Try a **Preauthorization** operation:
183
102
  - Amount: 1000 (equals 10.00 EUR in cents)
184
103
  - Reference: Leave empty for auto-generation
185
104
  - Click **"Execute Preauthorization"**
186
105
  3. Check the **Transaction History** tab to see the logged transaction
187
106
 
188
- ### 3. Review Transaction History
189
-
190
- 1. Navigate to the **Transaction History** tab
191
- 2. View all payment operations
192
- 3. Use filters to search for specific transactions
193
- 4. Click on any transaction to view full details
194
-
195
107
  ## 📖 Usage
196
108
 
197
- ### Admin Panel
109
+ ### Base URL
198
110
 
199
- The plugin adds a new menu item **"Payone Provider"** to your Strapi admin panel with three tabs:
111
+ All API endpoints are available at:
200
112
 
201
- #### 1. Configuration Tab
113
+ **Content API (Frontend)**: `/api/strapi-plugin-payone-provider`
202
114
 
203
- - Configure Payone API credentials
204
- - Test connection to Payone servers
205
- - Switch between test and live modes
115
+ **Admin API**: `/strapi-plugin-payone-provider`
206
116
 
207
- #### 2. Transaction History Tab
117
+ > ⚠️ **Authentication Required**: All endpoints require authentication. Include your Bearer token in the Authorization header.
208
118
 
209
- - View all payment transactions
210
- - Filter by status, type, transaction ID, reference, or date range
211
- - View detailed request/response data for each transaction
212
- - 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
+ ```
213
127
 
214
- #### 3. Payment Actions Tab
128
+ ### Common Response Fields
215
129
 
216
- - Test payment operations without writing code
217
- - Execute preauthorizations, authorizations, captures, and refunds
218
- - View real-time results and error messages
130
+ All responses include:
219
131
 
220
- ### 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)
221
136
 
222
- The plugin provides REST API endpoints for programmatic access:
137
+ ---
223
138
 
224
- #### Content API Endpoints (Public with Auth Policy)
139
+ ## 💳 Payment Methods & Operations
225
140
 
226
- All content API endpoints require authentication via the `isAuth` policy. These are meant for your frontend application.
141
+ ### Credit Card
227
142
 
228
- Base URL: `/api/payone-provider`
143
+ <details>
144
+ <summary><strong>Credit Card Payment Method</strong></summary>
229
145
 
230
- ##### POST `/api/payone-provider/preauthorization`
146
+ #### Preauthorization
231
147
 
232
- Reserve funds on a customer's card without immediate charge.
148
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
233
149
 
234
- **Request Body:**
150
+ **Request Body**:
235
151
 
236
152
  ```json
237
153
  {
238
154
  "amount": 1000,
239
155
  "currency": "EUR",
240
- "reference": "ORDER-12345",
156
+ "reference": "PAY1234567890ABCDEF",
241
157
  "clearingtype": "cc",
242
158
  "cardtype": "V",
243
159
  "cardpan": "4111111111111111",
@@ -245,15 +161,24 @@ Reserve funds on a customer's card without immediate charge.
245
161
  "cardcvc2": "123",
246
162
  "firstname": "John",
247
163
  "lastname": "Doe",
164
+ "email": "john.doe@example.com",
165
+ "telephonenumber": "+4917512345678",
248
166
  "street": "Main Street 123",
249
167
  "zip": "12345",
250
168
  "city": "Berlin",
251
169
  "country": "DE",
252
- "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"
253
178
  }
254
179
  ```
255
180
 
256
- **Response:**
181
+ **Response**:
257
182
 
258
183
  ```json
259
184
  {
@@ -265,307 +190,1097 @@ Reserve funds on a customer's card without immediate charge.
265
190
  }
266
191
  ```
267
192
 
268
- ##### POST `/api/payone-provider/authorization`
193
+ #### Authorization
194
+
195
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
196
+
197
+ **Request Body**: (Same as Preauthorization)
269
198
 
270
- Immediately charge a customer's card.
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
+ ```
271
227
 
272
- **Request Body:** (Same as preauthorization)
228
+ **Response**:
273
229
 
274
- > 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
+ ```
275
239
 
276
- ##### POST `/api/payone-provider/capture`
240
+ #### Capture
277
241
 
278
- Complete a preauthorized transaction and capture the funds.
242
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
279
243
 
280
- **Request Body:**
244
+ **Request Body**:
281
245
 
282
246
  ```json
283
247
  {
284
248
  "txid": "123456789",
285
249
  "amount": 1000,
286
- "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
+ }
287
263
  }
288
264
  ```
289
265
 
290
- ##### POST `/api/payone-provider/refund`
266
+ #### Refund
291
267
 
292
- Refund a captured transaction.
268
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
293
269
 
294
- **Request Body:**
270
+ **Request Body**:
295
271
 
296
272
  ```json
297
273
  {
298
274
  "txid": "123456789",
299
275
  "amount": -1000,
300
276
  "currency": "EUR",
301
- "reference": "REFUND-12345",
277
+ "reference": "REF1234567890ABCDEF",
302
278
  "sequencenumber": 2
303
279
  }
304
280
  ```
305
281
 
306
- #### Admin API Endpoints
282
+ **Response**:
307
283
 
308
- These endpoints require admin authentication and are available at `/payone-provider/`.
284
+ ```json
285
+ {
286
+ "data": {
287
+ "status": "APPROVED",
288
+ "txid": "123456789"
289
+ }
290
+ }
291
+ ```
309
292
 
310
- - `GET /payone-provider/settings` - Get current settings
311
- - `PUT /payone-provider/settings` - Update settings
312
- - `GET /payone-provider/transaction-history` - Get transaction history
313
- - `POST /payone-provider/test-connection` - Test Payone connection
314
- - All payment operation endpoints (same as content API)
293
+ </details>
315
294
 
316
- ### JavaScript/TypeScript Usage Example
295
+ ---
317
296
 
318
- ```javascript
319
- // In your frontend application
320
- import axios from 'axios';
321
-
322
- const processPayment = async (orderData) => {
323
- try {
324
- // Step 1: Preauthorize the payment
325
- const preauth = await axios.post(
326
- 'http://localhost:1337/api/payone-provider/preauthorization',
327
- {
328
- amount: orderData.amount, // in cents, e.g., 1000 = 10.00 EUR
329
- currency: 'EUR',
330
- reference: orderData.orderId,
331
- clearingtype: 'cc',
332
- cardtype: 'V', // Visa
333
- cardpan: orderData.cardNumber,
334
- cardexpiredate: orderData.cardExpiry, // YYMM format
335
- cardcvc2: orderData.cardCvc,
336
- firstname: orderData.firstName,
337
- lastname: orderData.lastName,
338
- street: orderData.street,
339
- zip: orderData.zip,
340
- city: orderData.city,
341
- country: orderData.country,
342
- email: orderData.email,
343
- },
344
- {
345
- headers: {
346
- Authorization: `Bearer ${yourAuthToken}`,
347
- },
348
- }
349
- );
350
-
351
- if (preauth.data.data.status === 'APPROVED') {
352
- const txid = preauth.data.data.txid;
353
-
354
- // Step 2: Capture the preauthorized amount
355
- const capture = await axios.post(
356
- 'http://localhost:1337/api/payone-provider/capture',
357
- {
358
- txid: txid,
359
- amount: orderData.amount,
360
- currency: 'EUR',
361
- },
362
- {
363
- headers: {
364
- Authorization: `Bearer ${yourAuthToken}`,
365
- },
366
- }
367
- );
368
-
369
- return {
370
- success: true,
371
- transactionId: txid,
372
- };
373
- }
374
- } catch (error) {
375
- console.error('Payment failed:', error);
376
- return {
377
- success: false,
378
- error: error.message,
379
- };
380
- }
381
- };
297
+ ### PayPal
298
+
299
+ <details>
300
+ <summary><strong>PayPal Payment Method</strong></summary>
301
+
302
+ #### Preauthorization
303
+
304
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
305
+
306
+ **Request Body**:
307
+
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
+ }
382
338
  ```
383
339
 
384
- ## 💳 Payment Operations
340
+ **Response**:
385
341
 
386
- ## ✅ Supported Payment Methods
342
+ ```json
343
+ {
344
+ "data": {
345
+ "status": "REDIRECT",
346
+ "txid": "123456789",
347
+ "redirecturl": "https://secure.pay1.de/redirect/..."
348
+ }
349
+ }
350
+ ```
387
351
 
388
- 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.
352
+ #### Authorization
389
353
 
390
- Common required fields (all methods):
354
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
391
355
 
392
- - `amount` (in cents), `currency`, `reference` (max 20 chars; auto-normalized)
393
- - `firstname`, `lastname`, `email`, `telephonenumber`
394
- - `street`, `zip`, `city`, `country`
356
+ **Request Body**: (Same as Preauthorization)
357
+
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
+ ```
395
389
 
396
- Credit Card (`clearingtype = cc`):
390
+ **Response**:
397
391
 
398
- - Required: `cardtype` (V/M/A...), `cardpan`, `cardexpiredate` (MMyy), `cardcvc2`
399
- - Operations: preauthorization, authorization, capture, refund
400
- - Test payment in Admin currently supported for Credit Card only
392
+ ```json
393
+ {
394
+ "data": {
395
+ "status": "REDIRECT",
396
+ "txid": "123456789",
397
+ "redirecturl": "https://secure.pay1.de/redirect/..."
398
+ }
399
+ }
400
+ ```
401
401
 
402
- PayPal Wallet (`clearingtype = wlt`, `wallettype = PPE`):
402
+ #### Capture
403
403
 
404
- - Required: `successurl`, `errorurl`, `backurl` (redirect URLs)
405
- - Recommended shipping fields: `shipping_firstname`, `shipping_lastname`, `shipping_street`, `shipping_zip`, `shipping_city`, `shipping_country`
406
- - Operations: preauthorization, authorization (capture/refund roadmap)
404
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
407
405
 
408
- SEPA Direct Debit (`clearingtype = elv`):
406
+ **Request Body**:
409
407
 
410
- - Required: `iban`, `bic`, `bankaccountholder`, `bankcountry`
411
- - Operations: preauthorization, authorization (capture/refund roadmap)
408
+ ```json
409
+ {
410
+ "txid": "123456789",
411
+ "amount": 1000,
412
+ "currency": "EUR",
413
+ "sequencenumber": 1,
414
+ "capturemode": "full"
415
+ }
416
+ ```
412
417
 
413
- Online Banking/PNT (`clearingtype = sb`):
418
+ **Response**:
414
419
 
415
- - Required: `onlinebanktransfertype` (e.g. `PNT`), `bankcountry`, redirect URLs (`successurl`, `errorurl`, `backurl`)
416
- - Operations: authorization (capture/refund roadmap)
420
+ ```json
421
+ {
422
+ "data": {
423
+ "status": "APPROVED",
424
+ "txid": "123456789"
425
+ }
426
+ }
427
+ ```
417
428
 
418
- Notes:
429
+ #### Refund
419
430
 
420
- - The plugin normalizes `reference` server-side to comply with Payone (alphanumeric only, max 20 chars, auto-generated fallback).
421
- - For redirect flows, the plugin auto-fills redirect URLs when missing using a base URL from settings or environment.
431
+ **URL**: `POST /api/strapi-plugin-payone-provider/refund`
422
432
 
423
- ### Preauthorization vs Authorization
433
+ **Request Body**:
424
434
 
425
- - **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.
435
+ ```json
436
+ {
437
+ "txid": "123456789",
438
+ "amount": -1000,
439
+ "currency": "EUR",
440
+ "reference": "REF1234567890ABCDEF",
441
+ "sequencenumber": 2
442
+ }
443
+ ```
426
444
 
427
- - **Authorization**: Immediately charges the customer's card. Use this for instant payments (e.g., e-commerce purchases).
445
+ **Response**:
428
446
 
429
- ### Capture
447
+ ```json
448
+ {
449
+ "data": {
450
+ "status": "APPROVED",
451
+ "txid": "123456789"
452
+ }
453
+ }
454
+ ```
430
455
 
431
- After a successful preauthorization, you must capture the transaction to receive the funds. Captures can be:
456
+ </details>
432
457
 
433
- - **Full capture**: Capture the entire preauthorized amount
434
- - **Partial capture**: Capture less than the preauthorized amount
458
+ ---
435
459
 
436
- ### Refund
460
+ ### Google Pay
437
461
 
438
- Refunds return money to the customer. Important notes:
462
+ <details>
463
+ <summary><strong>Google Pay Payment Method</strong></summary>
439
464
 
440
- - Amount must be negative (e.g., -1000 for 10.00 EUR)
441
- - Requires a valid transaction ID (txid)
442
- - Requires a sequence number (start with 2, increment for each additional refund on same transaction)
465
+ #### Overview
443
466
 
444
- > Current limitation: Capture and Refund are implemented for Credit Card only. Support for PayPal/SEPA/Online Banking will be added in future updates.
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.
445
468
 
446
- ## 📊 Transaction History
469
+ #### Getting Google Pay Token
447
470
 
448
- All payment operations are automatically logged to the transaction history. Each entry includes:
471
+ **1. Include Google Pay Script**
449
472
 
450
- - **Transaction ID (txid)**: Payone's unique transaction identifier
451
- - **Reference**: Your custom order/payment reference
452
- - **Type**: Operation type (authorization, preauthorization, capture, refund)
453
- - **Amount**: Transaction amount in cents
454
- - **Currency**: Currency code (EUR, USD, etc.)
455
- - **Status**: APPROVED, ERROR, REDIRECT, etc.
456
- - **Timestamp**: When the transaction occurred
457
- - **Raw Request/Response**: Complete API request and response data for debugging
473
+ ```html
474
+ <script async src="https://pay.google.com/gp/p/js/pay.js"></script>
475
+ ```
458
476
 
459
- ### Filtering Transactions
477
+ **2. Initialize Google Pay**
460
478
 
461
- Use the filters in the Transaction History tab to find specific transactions:
479
+ ```javascript
480
+ const paymentsClient = new google.payments.api.PaymentsClient({
481
+ environment: 'TEST', // or "PRODUCTION" for live
482
+ });
462
483
 
463
- - **Status**: Filter by APPROVED, ERROR, etc.
464
- - **Type**: Filter by operation type
465
- - **Transaction ID**: Search by specific txid
466
- - **Reference**: Search by your order reference
467
- - **Date Range**: Filter by date
484
+ const baseRequest = {
485
+ apiVersion: 2,
486
+ apiVersionMinor: 0,
487
+ };
468
488
 
469
- ## 🔍 Troubleshooting
489
+ const allowedCardNetworks = ['MASTERCARD', 'VISA'];
490
+ const allowedAuthMethods = ['PAN_ONLY', 'CRYPTOGRAM_3DS'];
470
491
 
471
- ### Connection Test Fails
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
+ };
472
499
 
473
- **Problem**: "Authentication failed" or "Invalid credentials"
500
+ const cardPaymentMethod = {
501
+ type: 'CARD',
502
+ parameters: {
503
+ allowedCardNetworks,
504
+ allowedAuthMethods,
505
+ },
506
+ tokenizationSpecification,
507
+ };
474
508
 
475
- **Solutions**:
509
+ const isReadyToPayRequest = Object.assign({}, baseRequest);
510
+ isReadyToPayRequest.allowedPaymentMethods = [cardPaymentMethod];
476
511
 
477
- 1. Verify your AID, Portal ID, Merchant ID, and Portal Key are correct
478
- 2. Ensure you're using the correct mode (test/live)
479
- 3. Check that your Payone account is active and not suspended
480
- 4. Verify the Portal Key is the MD5 hash key from your Payone PMI
512
+ paymentsClient.isReadyToPay(isReadyToPayRequest).then(function (response) {
513
+ if (response.result) {
514
+ // Google Pay is available, show button
515
+ }
516
+ });
517
+ ```
481
518
 
482
- ### Payment Gets Rejected
519
+ **3. Create Payment Button and Get Token**
483
520
 
484
- **Problem**: Transactions return ERROR status
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
+ };
485
533
 
486
- **Common Causes**:
534
+ const button = paymentsClient.createButton({
535
+ onClick: async () => {
536
+ try {
537
+ const paymentData = await paymentsClient.loadPaymentData(paymentDataRequest);
538
+ const token = paymentData.paymentMethodData.tokenizationData.token;
487
539
 
488
- 1. **Invalid card data**: Check card number, expiry date, and CVC
489
- 2. **Insufficient funds**: Test cards may have limits
490
- 3. **Duplicate reference**: Each transaction needs a unique reference
491
- 4. **Missing required fields**: Ensure all required customer data is provided
492
- 5. **Test mode restrictions**: Some features may be limited in test mode
540
+ // Token is a JSON string, encode it to Base64 for Payone
541
+ const base64Token = btoa(unescape(encodeURIComponent(token)));
493
542
 
494
- **Debug Steps**:
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
+ });
495
562
 
496
- 1. Check the Transaction History for error codes and messages
497
- 2. Review the raw response data for detailed error information
498
- 3. Consult the Payone API documentation for error code meanings
499
- 4. Check your Strapi server logs for detailed error traces
563
+ document.getElementById('google-pay-button').appendChild(button);
564
+ ```
500
565
 
501
- ### Plugin Not Appearing in Admin
566
+ **Token Format**
502
567
 
503
- **Problem**: Payone Provider menu item doesn't appear
568
+ The token from Google Pay is a JSON string with the following structure:
504
569
 
505
- **Solutions**:
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
+ ```
506
581
 
507
- 1. Ensure the plugin is enabled in `config/plugins.js`
508
- 2. Run `npm run build` to rebuild the admin panel
509
- 3. Clear your browser cache and refresh
510
- 4. Restart your Strapi server
511
- 5. Check browser console for JavaScript errors
582
+ **Important**: The token must be Base64 encoded before sending to Payone.
512
583
 
513
- ### API Requests Return 403 Forbidden
584
+ #### Preauthorization
514
585
 
515
- **Problem**: Content API endpoints return authorization errors
586
+ **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
516
587
 
517
- **Solutions**:
588
+ **Request Body**:
518
589
 
519
- 1. Ensure you're sending a valid authentication token
520
- 2. Check that the `isAuth` policy is properly configured
521
- 3. Verify your user has the necessary permissions
522
- 4. Review Strapi's role and permissions settings
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
+ ```
523
622
 
524
- ### Transactions Not Logging
623
+ **Payone Request Parameters** (automatically added by plugin):
525
624
 
526
- **Problem**: Transaction history is empty
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
+ ```
527
656
 
528
- **Solutions**:
657
+ **Response**:
529
658
 
530
- 1. Check that requests are actually reaching Payone (check server logs)
531
- 2. Verify database write permissions
532
- 3. Check for JavaScript errors in the browser console
533
- 4. Ensure the plugin store is accessible
659
+ ```json
660
+ {
661
+ "data": {
662
+ "status": "APPROVED",
663
+ "txid": "123456789"
664
+ }
665
+ }
666
+ ```
534
667
 
535
- ## 🔐 Security Best Practices
668
+ #### Authorization
536
669
 
537
- 1. **Never expose your Portal Key**: Keep it secure and never commit it to version control
538
- 2. **Use environment variables**: Store credentials in `.env` files (excluded from git)
539
- 3. **Enable HTTPS**: Always use HTTPS in production for API requests
540
- 4. **Validate user input**: Always validate and sanitize payment data on the server side
541
- 5. **Use test mode**: Test thoroughly in test mode before going live
542
- 6. **Monitor transactions**: Regularly review transaction history for suspicious activity
543
- 7. **PCI Compliance**: If handling card data directly, ensure PCI DSS compliance
670
+ **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
544
671
 
545
- ## 📝 License
672
+ **Request Body**: (Same as Preauthorization, include `googlePayToken`)
546
673
 
547
- MIT
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
+ ```
548
700
 
549
- ## 🤝 Support
701
+ **Response**:
550
702
 
551
- If you encounter issues or need help:
703
+ ```json
704
+ {
705
+ "data": {
706
+ "status": "APPROVED",
707
+ "txid": "123456789"
708
+ }
709
+ }
710
+ ```
552
711
 
553
- 1. Check this README thoroughly
554
- 2. Review your Strapi server logs
555
- 3. Consult the [Payone API Documentation](https://docs.payone.com/)
556
- 4. Check the Transaction History for detailed error messages
712
+ #### Capture
557
713
 
558
- ## 🔄 Updates
714
+ **URL**: `POST /api/strapi-plugin-payone-provider/capture`
559
715
 
560
- To update the plugin:
716
+ **Request Body**:
561
717
 
562
- ```bash
563
- npm update payone-provider
564
- npm run build
718
+ ```json
719
+ {
720
+ "txid": "123456789",
721
+ "amount": 1000,
722
+ "currency": "EUR",
723
+ "sequencenumber": 1
724
+ }
565
725
  ```
566
726
 
567
- Then restart your Strapi application.
727
+ **Response**:
568
728
 
569
- ---
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:
570
1284
 
571
- **Made with ❤️ for Strapi**
1285
+ - `capturemode: "full"`: Capture the entire preauthorized amount
1286
+ - `capturemode: "partial"`: Capture less than the preauthorized amount