strapi-plugin-payone-provider 4.6.13 → 4.6.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,13 +8,24 @@ A comprehensive Strapi plugin that integrates the Payone payment gateway into yo
8
8
  - [Requirements](#requirements)
9
9
  - [Installation](#installation)
10
10
  - [Configuration](#configuration)
11
- - [Getting Started](#getting-started)
11
+ - [Using the Admin Panel](#using-the-admin-panel-recommended)
12
+ - [Apple Pay Setup](#apple-pay-setup)
13
+ - [Google Pay Configuration](#google-pay-configuration)
12
14
  - [Usage](#usage)
13
- - [3D Secure (3DS) Authentication](#-3d-secure-3ds-authentication)
14
- - [Payment Methods & Operations](#-payment-methods--operations)
15
- - [Supported Payment Methods](#supported-payment-methods)
16
-
17
- ## ✨ Features
15
+ - [Base URL](#base-url)
16
+ - [Common Request Headers](#common-request-headers)
17
+ - [Common Response Fields](#common-response-fields)
18
+ - [Payment Methods & Operations](#payment-methods--operations)
19
+ - [Credit Card](#credit-card)
20
+ - [PayPal](#paypal)
21
+ - [Google Pay](#google-pay)
22
+ - [Apple Pay](#apple-pay)
23
+ - [SEPA Direct Debit](#sepa-direct-debit)
24
+ - [Sofort Banking](#sofort-banking)
25
+ - [TransactionStatus Notifications](#transactionstatus-notifications)
26
+ - [Notes](#notes)
27
+
28
+ ## Features
18
29
 
19
30
  - **Payone API Integration**: Full integration with Payone's Server API (v3.10)
20
31
  - **Payment Operations**:
@@ -29,13 +40,14 @@ A comprehensive Strapi plugin that integrates the Payone payment gateway into yo
29
40
  - Connection testing
30
41
  - **Transaction Logging**: Automatic logging of all payment operations
31
42
  - **Security**: Secure credential storage with masked API keys
32
- - **Test & Live Modes**: Support for both test and production environments
33
43
 
34
- ## 🔧 Requirements
44
+ ## Requirements
35
45
 
36
46
  Before installing this plugin, ensure you have:
37
47
 
38
- - **Strapi**: Version 4.6.0 or higher
48
+ - **Strapi**:
49
+ - Version 5.x.x for plugin version 5.x.x
50
+ - Version 4.6.0 or higher for plugin version 4.x.x
39
51
  - **Node.js**: Version 18.0.0 to 20.x.x
40
52
  - **npm**: Version 6.0.0 or higher
41
53
  - **Payone Account**: Active Payone merchant account with API credentials
@@ -51,55 +63,46 @@ You will need the following credentials from your Payone account:
51
63
 
52
64
  > â„šī¸ **How to get Payone credentials**: Log into your Payone Merchant Interface (PMI) and navigate to Configuration → Payment Portals → [Your Portal] → Advanced Tab to find these credentials.
53
65
 
54
- ## đŸ“Ļ Installation
66
+ ## Installation
67
+
68
+
69
+ **Important**: Choose the correct version based on your Strapi version:
55
70
 
56
- ### Install from npm
71
+ - **For Strapi 5.x.x**: Use plugin version `^5.x.x`
72
+ - **For Strapi 4.x.x**: Use plugin version `^4.x.x`
57
73
 
58
74
  ```bash
59
- # Using npm
75
+ # npm
60
76
  npm install strapi-plugin-payone-provider
61
-
62
- # Using yarn
77
+ # yarn
63
78
  yarn add strapi-plugin-payone-provider
64
-
65
- # Using pnpm
79
+ # pnpm
66
80
  pnpm add strapi-plugin-payone-provider
81
+
67
82
  ```
68
83
 
69
- ## âš™ī¸ Configuration
84
+ > **Version Compatibility**: Make sure to install the correct plugin version that matches your Strapi version. Using an incompatible version may cause errors or unexpected behavior.
85
+
86
+
87
+
88
+ ## Configuration
70
89
 
71
90
  After installation, you need to configure your Payone credentials:
72
91
 
73
92
  ### Using the Admin Panel (Recommended)
74
93
 
75
- 1. Log into your Strapi admin panel
76
- 2. Navigate to **Payone Provider** in the sidebar menu
77
- 3. Go to the **Configuration** tab
78
- 4. Fill in your Payone credentials:
94
+ 1. Open **Payone Provider** in the sidebar menu
95
+ 2. Go to the **Configuration** tab
96
+ 3. Fill in your Payone credentials and save:
79
97
  - **Account ID (AID)**: Your Payone account ID
80
98
  - **Portal ID**: Your Payone portal ID
81
99
  - **Merchant ID (MID)**: Your merchant ID
82
100
  - **Portal Key**: Your API security key
83
101
  - **Mode**: Select `test` for testing or `live` for production
84
102
  - **API Version**: Leave as `3.10` (default)
85
- 5. Click **"Test Connection"** to verify your credentials
86
- 6. Click **"Save Configuration"** to store your settings
87
-
88
- ### Apple Pay Configuration
89
-
90
- To configure Apple Pay settings:
103
+ 4. Click **"Test Connection"** to verify your credentials
91
104
 
92
- 1. Navigate to **Payone Provider** in the sidebar menu
93
- 2. Go to **Payment Actions** tab
94
- 3. Select **Apple Pay** as the payment method
95
- 4. Click on the Apple Pay configuration link: `/plugins/strapi-plugin-payone-provider/apple-pay-config`
96
- 5. Configure the following settings:
97
- - **Country Code**: Select the country where your business operates
98
- - **Currency Code**: Select the currency for transactions
99
- - **Supported Networks**: Select payment card networks (Visa, Mastercard, Amex, etc.)
100
- - **Merchant Capabilities**: Select payment capabilities (3D Secure is recommended)
101
- - **Button Style & Type**: Customize the Apple Pay button appearance
102
- 6. Click **"Save Apple Pay Configuration"** to store your settings
105
+ ### Apple Pay setup
103
106
 
104
107
  > âš ī¸ **Important**: Apple Pay requires a registered domain with HTTPS. It does NOT work on localhost. For testing, use a production domain with HTTPS or test on a device with Safari (iOS/macOS).
105
108
 
@@ -118,7 +121,6 @@ https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
118
121
  - Download the domain verification file from Payone documentation: [https://docs.payone.com/payment-methods/apple-pay/apple-pay-without-dev](https://docs.payone.com/payment-methods/apple-pay/apple-pay-without-dev)
119
122
  - Alternatively, log into your Payone Merchant Interface (PMI)
120
123
  - Navigate to **Configuration** → **Payment Portals** → **Apple Pay**
121
- - Download the `apple-developer-merchantid-domain-association` file
122
124
 
123
125
  2. **Place the file in Strapi:**
124
126
 
@@ -138,7 +140,7 @@ https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
138
140
 
139
141
  #### Middleware Configuration for Apple Pay
140
142
 
141
- Apple Pay requires Content Security Policy (CSP) configuration in `config/middlewares.js` to allow Apple Pay scripts. Without this configuration, Apple Pay will NOT work.
143
+ Apple Pay requires Content Security Policy (CSP) configuration in `config/middlewares.js` to allow Apple Pay scripts. Without this configuration, Apple Pay will NOT work on your strapi admin for make test transaction.
142
144
 
143
145
  **Required CSP directives:**
144
146
 
@@ -181,25 +183,10 @@ module.exports = [
181
183
 
182
184
  ### Google Pay Configuration
183
185
 
184
- To configure Google Pay settings:
185
-
186
- 1. Navigate to **Payone Provider** in the sidebar menu
187
- 2. Go to **Payment Actions** tab
188
- 3. Select **Google Pay** as the payment method
189
- 4. Click on the Google Pay configuration link: `/plugins/strapi-plugin-payone-provider/google-pay-config`
190
- 5. Configure the following settings:
191
- - **Country Code**: Select the country where your business operates
192
- - **Currency Code**: Select the currency for transactions
193
- - **Merchant Name**: Enter your business name as it will appear in Google Pay
194
- - **Allowed Card Networks**: Select payment card networks (Mastercard, Visa, Amex, etc.)
195
- - **Allowed Authentication Methods**: Select authentication methods (PAN Only, 3D Secure)
196
- 6. Click **"Save Google Pay Configuration"** to store your settings
197
-
198
- > â„šī¸ **Note**: The Gateway Merchant ID will be automatically obtained from your Payone Merchant ID (MID) or Portal ID configured in the main Configuration tab.
199
186
 
200
187
  #### Middleware Configuration for Google Pay
201
188
 
202
- Google Pay requires Content Security Policy (CSP) configuration in `config/middlewares.js` to allow Google Pay scripts. Without this configuration, Google Pay will NOT work.
189
+ Google Pay requires Content Security Policy (CSP) configuration in `config/middlewares.js` to allow Google Pay scripts. Without this configuration, Google Pay will NOT work on your strapi admin for make test transactions.
203
190
 
204
191
  **Required CSP directives:**
205
192
 
@@ -238,27 +225,8 @@ module.exports = [
238
225
 
239
226
  > âš ī¸ **Important**: Without this middleware configuration, Google Pay scripts will be blocked and Google Pay will NOT work!
240
227
 
241
- ## 🚀 Getting Started
242
-
243
- ### 1. Test Your Connection
244
-
245
- After configuring your credentials:
246
-
247
- 1. Open the **Configuration** tab in the Payone Provider admin panel
248
- 2. Click the **"Test Connection"** button
249
- 3. If successful, you'll see a green success message
250
- 4. If it fails, check your credentials and try again
251
-
252
- ### 2. Try a Test Payment
253
228
 
254
- 1. Go to the **Payment Actions** tab
255
- 2. Try a **Preauthorization** operation:
256
- - Amount: 1000 (equals 10.00 EUR in cents)
257
- - Reference: Leave empty for auto-generation
258
- - Click **"Execute Preauthorization"**
259
- 3. Check the **Transaction History** tab to see the logged transaction
260
-
261
- ## 📖 Usage
229
+ ## Usage
262
230
 
263
231
  ### Base URL
264
232
 
@@ -290,127 +258,20 @@ All responses include:
290
258
 
291
259
  ---
292
260
 
293
- ## 🔐 3D Secure (3DS) Authentication
294
-
295
- 3D Secure (3DS) is a security protocol that adds an extra layer of authentication for credit card payments, ensuring compliance with Strong Customer Authentication (SCA) requirements.
296
-
297
- ### Enabling 3D Secure
298
-
299
- 1. Navigate to **Payone Provider** in the Strapi admin panel
300
- 2. Go to the **Configuration** tab
301
- 3. Find the **"Enable 3D Secure"** dropdown
302
- 4. Select **"Enabled"** to activate 3DS for credit card payments
303
- 5. Click **"Save Configuration"**
304
-
305
- > âš ī¸ **Note**: When 3DS is enabled, it only applies to **credit card** payments (`clearingtype: "cc"`). Other payment methods are not affected.
306
-
307
- ### Supported Operations
308
-
309
- 3D Secure works with the following operations:
310
-
311
- - ✅ **Preauthorization** (`POST /api/strapi-plugin-payone-provider/preauthorization`)
312
- - ✅ **Authorization** (`POST /api/strapi-plugin-payone-provider/authorization`)
313
- - ❌ **Capture** - Not applicable (uses preauthorized transaction)
314
- - ❌ **Refund** - Not applicable (uses existing transaction)
315
-
316
- ### Required Parameters for Preauthorization/Authorization with 3DS
317
-
318
- When 3DS is enabled and you're making a credit card payment, the following parameters are required:
261
+ ## Payment Methods & Operations
319
262
 
320
- **Credit Card Details** (required when 3DS is enabled):
321
-
322
- - `cardtype`: Card type (`"V"` for VISA, `"M"` for Mastercard, `"A"` for AMEX, etc.)
323
- - `cardpan`: Card number (PAN)
324
- - `cardexpiredate`: Expiry date in format `YYMM` (e.g., `"2512"` for December 2025)
325
- - `cardcvc2`: CVC/CVV code (3 digits for most cards, 4 digits for AMEX)
326
-
327
- **Redirect URLs** (required for 3DS authentication flow):
328
-
329
- - `successurl`: URL to redirect after successful 3DS authentication
330
- - `errorurl`: URL to redirect after 3DS authentication error
331
- - `backurl`: URL to redirect if user cancels 3DS authentication
332
-
333
- **Example Request**:
334
-
335
- ```json
336
- {
337
- "amount": 1000,
338
- "currency": "EUR",
339
- "reference": "PAY1234567890ABCDEF",
340
- "clearingtype": "cc",
341
- "cardtype": "V",
342
- "cardpan": "4111111111111111",
343
- "cardexpiredate": "2512",
344
- "cardcvc2": "123",
345
- "firstname": "John",
346
- "lastname": "Doe",
347
- "email": "john.doe@example.com",
348
- "street": "Main Street 123",
349
- "zip": "12345",
350
- "city": "Berlin",
351
- "country": "DE",
352
- "successurl": "https://www.example.com/success",
353
- "errorurl": "https://www.example.com/error",
354
- "backurl": "https://www.example.com/back"
355
- }
356
- ```
357
-
358
- ### 3DS Response Handling
359
-
360
- When 3DS is required, the API response will include:
361
-
362
- ```json
363
- {
364
- "data": {
365
- "status": "REDIRECT",
366
- "redirecturl": "https://secure.pay1.de/3ds/...",
367
- "requires3DSRedirect": true,
368
- "txid": "123456789"
369
- }
370
- }
371
- ```
372
-
373
- **Response Fields**:
374
-
375
- - `status`: `"REDIRECT"` when 3DS authentication is required
376
- - `redirecturl`: URL to redirect the customer for 3DS authentication
377
- - `requires3DSRedirect`: Boolean indicating if redirect is needed
378
- - `txid`: Transaction ID (if available)
379
-
380
- ### 3DS Callback Endpoint
381
-
382
- After the customer completes 3DS authentication, Payone will send a callback to:
383
-
384
- **URL**: `POST /api/strapi-plugin-payone-provider/3ds-callback`
385
-
386
- This endpoint processes the 3DS authentication result and updates the transaction status.
387
-
388
- > â„šī¸ **Note**: The callback endpoint is automatically handled by the plugin. You don't need to manually process it unless you're implementing custom callback handling.
389
-
390
- ### How It Works
391
-
392
- 1. **Request**: Send a preauthorization or authorization request with credit card details and redirect URLs
393
- 2. **Response**: If 3DS is required, you'll receive a `REDIRECT` status with a `redirecturl`
394
- 3. **Redirect**: Redirect the customer to the `redirecturl` for 3DS authentication
395
- 4. **Callback**: After authentication, Payone redirects back to your `successurl`, `errorurl`, or `backurl` with transaction data
396
- 5. **Completion**: The transaction is completed based on the authentication result
397
-
398
- ### Testing 3DS
399
-
400
- For testing 3DS authentication, use test cards that trigger 3DS challenges. Refer to the [Payone 3D Secure Documentation](https://docs.payone.com/security-risk-management/3d-secure#/) for test card numbers and scenarios.
401
-
402
- ---
403
-
404
- ## đŸ’ŗ Payment Methods & Operations
263
+ This section provides detailed API documentation for each supported payment method. Click on any payment method below to see the full implementation details:
405
264
 
406
265
  ### Credit Card
407
266
 
408
267
  <details>
409
268
  <summary><strong>Credit Card Payment Method</strong></summary>
410
269
 
411
- #### Preauthorization
270
+ #### Preauthorization/Authorization
412
271
 
413
- **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
272
+ **Endpoints:**
273
+ - `POST /api/strapi-plugin-payone-provider/preauthorization`
274
+ - `POST /api/strapi-plugin-payone-provider/authorization`
414
275
 
415
276
  **Request Body**:
416
277
 
@@ -455,56 +316,10 @@ For testing 3DS authentication, use test cards that trigger 3DS challenges. Refe
455
316
  }
456
317
  ```
457
318
 
458
- #### Authorization
459
-
460
- **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
461
-
462
- **Request Body**: (Same as Preauthorization)
463
-
464
- ```json
465
- {
466
- "amount": 1000,
467
- "currency": "EUR",
468
- "reference": "PAY1234567890ABCDEF",
469
- "clearingtype": "cc",
470
- "cardtype": "V",
471
- "cardpan": "4111111111111111",
472
- "cardexpiredate": "2512",
473
- "cardcvc2": "123",
474
- "firstname": "John",
475
- "lastname": "Doe",
476
- "email": "john.doe@example.com",
477
- "telephonenumber": "+4917512345678",
478
- "street": "Main Street 123",
479
- "zip": "12345",
480
- "city": "Berlin",
481
- "country": "DE",
482
- "successurl": "https://www.example.com/success",
483
- "errorurl": "https://www.example.com/error",
484
- "backurl": "https://www.example.com/back",
485
- "salutation": "Herr",
486
- "gender": "m",
487
- "ip": "127.0.0.1",
488
- "language": "de",
489
- "customer_is_present": "yes"
490
- }
491
- ```
492
-
493
- **Response**:
494
-
495
- ```json
496
- {
497
- "data": {
498
- "status": "APPROVED",
499
- "txid": "123456789",
500
- "userid": "987654321"
501
- }
502
- }
503
- ```
504
-
505
319
  #### Capture
506
320
 
507
- **URL**: `POST /api/strapi-plugin-payone-provider/capture`
321
+ **Endpoint:**
322
+ - `POST /api/strapi-plugin-payone-provider/capture`
508
323
 
509
324
  **Request Body**:
510
325
 
@@ -530,7 +345,8 @@ For testing 3DS authentication, use test cards that trigger 3DS challenges. Refe
530
345
 
531
346
  #### Refund
532
347
 
533
- **URL**: `POST /api/strapi-plugin-payone-provider/refund`
348
+ **Endpoint:**
349
+ - `POST /api/strapi-plugin-payone-provider/refund`
534
350
 
535
351
  **Request Body**:
536
352
 
@@ -564,9 +380,11 @@ For testing 3DS authentication, use test cards that trigger 3DS challenges. Refe
564
380
  <details>
565
381
  <summary><strong>PayPal Payment Method</strong></summary>
566
382
 
567
- #### Preauthorization
383
+ #### Preauthorization/Authorization
568
384
 
569
- **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
385
+ **Endpoints:**
386
+ - `POST /api/strapi-plugin-payone-provider/preauthorization`
387
+ - `POST /api/strapi-plugin-payone-provider/authorization`
570
388
 
571
389
  **Request Body**:
572
390
 
@@ -614,59 +432,11 @@ For testing 3DS authentication, use test cards that trigger 3DS challenges. Refe
614
432
  }
615
433
  ```
616
434
 
617
- #### Authorization
618
-
619
- **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
620
-
621
- **Request Body**: (Same as Preauthorization)
622
-
623
- ```json
624
- {
625
- "amount": 1000,
626
- "currency": "EUR",
627
- "reference": "PAY1234567890ABCDEF",
628
- "clearingtype": "wlt",
629
- "wallettype": "PPE",
630
- "firstname": "John",
631
- "lastname": "Doe",
632
- "email": "john.doe@example.com",
633
- "telephonenumber": "+4917512345678",
634
- "street": "Main Street 123",
635
- "zip": "12345",
636
- "city": "Berlin",
637
- "country": "DE",
638
- "shipping_firstname": "John",
639
- "shipping_lastname": "Doe",
640
- "shipping_street": "Main Street 123",
641
- "shipping_zip": "12345",
642
- "shipping_city": "Berlin",
643
- "shipping_country": "DE",
644
- "successurl": "https://www.example.com/success",
645
- "errorurl": "https://www.example.com/error",
646
- "backurl": "https://www.example.com/back",
647
- "salutation": "Herr",
648
- "gender": "m",
649
- "ip": "127.0.0.1",
650
- "language": "de",
651
- "customer_is_present": "yes"
652
- }
653
- ```
654
-
655
- **Response**:
656
-
657
- ```json
658
- {
659
- "data": {
660
- "status": "REDIRECT",
661
- "txid": "123456789",
662
- "redirecturl": "https://secure.pay1.de/redirect/..."
663
- }
664
- }
665
- ```
666
435
 
667
436
  #### Capture
668
437
 
669
- **URL**: `POST /api/strapi-plugin-payone-provider/capture`
438
+ **Endpoint:**
439
+ - `POST /api/strapi-plugin-payone-provider/capture`
670
440
 
671
441
  **Request Body**:
672
442
 
@@ -693,7 +463,8 @@ For testing 3DS authentication, use test cards that trigger 3DS challenges. Refe
693
463
 
694
464
  #### Refund
695
465
 
696
- **URL**: `POST /api/strapi-plugin-payone-provider/refund`
466
+ **Endpoint:**
467
+ - `POST /api/strapi-plugin-payone-provider/refund`
697
468
 
698
469
  **Request Body**:
699
470
 
@@ -743,7 +514,7 @@ Google Pay integration requires obtaining an encrypted payment token from Google
743
514
 
744
515
  ```javascript
745
516
  const paymentsClient = new google.payments.api.PaymentsClient({
746
- environment: "TEST", // or "PRODUCTION" for live
517
+ environment: "TEST", // or "PRODUCTION" for live mode
747
518
  });
748
519
 
749
520
  const baseRequest = {
@@ -850,9 +621,11 @@ The token from Google Pay is a JSON string with the following structure:
850
621
 
851
622
  **Important**: The token must be Base64 encoded before sending to Payone.
852
623
 
853
- #### Preauthorization
624
+ #### Preauthorization/Authorization
854
625
 
855
- **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
626
+ **Endpoints:**
627
+ - `POST /api/strapi-plugin-payone-provider/preauthorization`
628
+ - `POST /api/strapi-plugin-payone-provider/authorization`
856
629
 
857
630
  **Request Body**:
858
631
 
@@ -934,53 +707,11 @@ The token from Google Pay is a JSON string with the following structure:
934
707
  }
935
708
  ```
936
709
 
937
- #### Authorization
938
-
939
- **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
940
-
941
- **Request Body**: (Same as Preauthorization, include `googlePayToken`)
942
-
943
- ```json
944
- {
945
- "amount": 1000,
946
- "currency": "EUR",
947
- "reference": "PAY1234567890ABCDEF",
948
- "clearingtype": "wlt",
949
- "wallettype": "GGP",
950
- "googlePayToken": "BASE64_ENCODED_TOKEN",
951
- "firstname": "John",
952
- "lastname": "Doe",
953
- "email": "john.doe@example.com",
954
- "street": "Main Street 123",
955
- "zip": "12345",
956
- "city": "Berlin",
957
- "country": "DE",
958
- "shipping_firstname": "John",
959
- "shipping_lastname": "Doe",
960
- "shipping_street": "Main Street 123",
961
- "shipping_zip": "12345",
962
- "shipping_city": "Berlin",
963
- "shipping_country": "DE",
964
- "successurl": "https://www.example.com/success",
965
- "errorurl": "https://www.example.com/error",
966
- "backurl": "https://www.example.com/back"
967
- }
968
- ```
969
-
970
- **Response**:
971
-
972
- ```json
973
- {
974
- "data": {
975
- "status": "APPROVED",
976
- "txid": "123456789"
977
- }
978
- }
979
- ```
980
710
 
981
711
  #### Capture
982
712
 
983
- **URL**: `POST /api/strapi-plugin-payone-provider/capture`
713
+ **Endpoint:**
714
+ - `POST /api/strapi-plugin-payone-provider/capture`
984
715
 
985
716
  **Request Body**:
986
717
 
@@ -1006,7 +737,8 @@ The token from Google Pay is a JSON string with the following structure:
1006
737
 
1007
738
  #### Refund
1008
739
 
1009
- **URL**: `POST /api/strapi-plugin-payone-provider/refund`
740
+ **Endpoint:**
741
+ - `POST /api/strapi-plugin-payone-provider/refund`
1010
742
 
1011
743
  **Request Body**:
1012
744
 
@@ -1051,9 +783,11 @@ The token from Google Pay is a JSON string with the following structure:
1051
783
  <details>
1052
784
  <summary><strong>Apple Pay Payment Method</strong></summary>
1053
785
 
1054
- #### Preauthorization
786
+ #### Preauthorization/Authorization
1055
787
 
1056
- **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
788
+ **Endpoints:**
789
+ - `POST /api/strapi-plugin-payone-provider/preauthorization`
790
+ - `POST /api/strapi-plugin-payone-provider/authorization`
1057
791
 
1058
792
  **Request Body**:
1059
793
 
@@ -1101,59 +835,10 @@ The token from Google Pay is a JSON string with the following structure:
1101
835
  }
1102
836
  ```
1103
837
 
1104
- #### Authorization
1105
-
1106
- **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
1107
-
1108
- **Request Body**: (Same as Preauthorization)
1109
-
1110
- ```json
1111
- {
1112
- "amount": 1000,
1113
- "currency": "EUR",
1114
- "reference": "PAY1234567890ABCDEF",
1115
- "clearingtype": "wlt",
1116
- "wallettype": "APL",
1117
- "firstname": "John",
1118
- "lastname": "Doe",
1119
- "email": "john.doe@example.com",
1120
- "telephonenumber": "+4917512345678",
1121
- "street": "Main Street 123",
1122
- "zip": "12345",
1123
- "city": "Berlin",
1124
- "country": "DE",
1125
- "shipping_firstname": "John",
1126
- "shipping_lastname": "Doe",
1127
- "shipping_street": "Main Street 123",
1128
- "shipping_zip": "12345",
1129
- "shipping_city": "Berlin",
1130
- "shipping_country": "DE",
1131
- "successurl": "https://www.example.com/success",
1132
- "errorurl": "https://www.example.com/error",
1133
- "backurl": "https://www.example.com/back",
1134
- "salutation": "Herr",
1135
- "gender": "m",
1136
- "ip": "127.0.0.1",
1137
- "language": "de",
1138
- "customer_is_present": "yes"
1139
- }
1140
- ```
1141
-
1142
- **Response**:
1143
-
1144
- ```json
1145
- {
1146
- "data": {
1147
- "status": "REDIRECT",
1148
- "txid": "123456789",
1149
- "redirecturl": "https://secure.pay1.de/redirect/..."
1150
- }
1151
- }
1152
- ```
1153
-
1154
838
  #### Capture
1155
839
 
1156
- **URL**: `POST /api/strapi-plugin-payone-provider/capture`
840
+ **Endpoint:**
841
+ - `POST /api/strapi-plugin-payone-provider/capture`
1157
842
 
1158
843
  **Request Body**:
1159
844
 
@@ -1180,7 +865,8 @@ The token from Google Pay is a JSON string with the following structure:
1180
865
 
1181
866
  #### Refund
1182
867
 
1183
- **URL**: `POST /api/strapi-plugin-payone-provider/refund`
868
+ **Endpoint:**
869
+ - `POST /api/strapi-plugin-payone-provider/refund`
1184
870
 
1185
871
  **Request Body**:
1186
872
 
@@ -1214,9 +900,11 @@ The token from Google Pay is a JSON string with the following structure:
1214
900
  <details>
1215
901
  <summary><strong>SEPA Direct Debit Payment Method</strong></summary>
1216
902
 
1217
- #### Preauthorization
903
+ #### Preauthorization/Authorization
1218
904
 
1219
- **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
905
+ **Endpoints:**
906
+ - `POST /api/strapi-plugin-payone-provider/preauthorization`
907
+ - `POST /api/strapi-plugin-payone-provider/authorization`
1220
908
 
1221
909
  **Request Body**:
1222
910
 
@@ -1258,53 +946,10 @@ The token from Google Pay is a JSON string with the following structure:
1258
946
  }
1259
947
  ```
1260
948
 
1261
- #### Authorization
1262
-
1263
- **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
1264
-
1265
- **Request Body**: (Same as Preauthorization)
1266
-
1267
- ```json
1268
- {
1269
- "amount": 1000,
1270
- "currency": "EUR",
1271
- "reference": "PAY1234567890ABCDEF",
1272
- "clearingtype": "elv",
1273
- "iban": "DE89370400440532013000",
1274
- "bic": "COBADEFFXXX",
1275
- "bankaccountholder": "John Doe",
1276
- "bankcountry": "DE",
1277
- "firstname": "John",
1278
- "lastname": "Doe",
1279
- "email": "john.doe@example.com",
1280
- "telephonenumber": "+4917512345678",
1281
- "street": "Main Street 123",
1282
- "zip": "12345",
1283
- "city": "Berlin",
1284
- "country": "DE",
1285
- "salutation": "Herr",
1286
- "gender": "m",
1287
- "ip": "127.0.0.1",
1288
- "language": "de",
1289
- "customer_is_present": "yes"
1290
- }
1291
- ```
1292
-
1293
- **Response**:
1294
-
1295
- ```json
1296
- {
1297
- "data": {
1298
- "status": "APPROVED",
1299
- "txid": "123456789",
1300
- "userid": "987654321"
1301
- }
1302
- }
1303
- ```
1304
-
1305
949
  #### Capture
1306
950
 
1307
- **URL**: `POST /api/strapi-plugin-payone-provider/capture`
951
+ **Endpoint:**
952
+ - `POST /api/strapi-plugin-payone-provider/capture`
1308
953
 
1309
954
  **Request Body**:
1310
955
 
@@ -1330,7 +975,8 @@ The token from Google Pay is a JSON string with the following structure:
1330
975
 
1331
976
  #### Refund
1332
977
 
1333
- **URL**: `POST /api/strapi-plugin-payone-provider/refund`
978
+ **Endpoint:**
979
+ - `POST /api/strapi-plugin-payone-provider/refund`
1334
980
 
1335
981
  **Request Body**:
1336
982
 
@@ -1364,9 +1010,12 @@ The token from Google Pay is a JSON string with the following structure:
1364
1010
  <details>
1365
1011
  <summary><strong>Sofort Banking Payment Method</strong></summary>
1366
1012
 
1367
- #### Preauthorization
1013
+ #### Preauthorization/Authorization
1014
+
1015
+ **Endpoint:**
1016
+ - `POST /api/strapi-plugin-payone-provider/preauthorization`
1017
+ - `POST /api/strapi-plugin-payone-provider/authorization`
1368
1018
 
1369
- **URL**: `POST /api/strapi-plugin-payone-provider/preauthorization`
1370
1019
 
1371
1020
  **Request Body**:
1372
1021
 
@@ -1409,54 +1058,11 @@ The token from Google Pay is a JSON string with the following structure:
1409
1058
  }
1410
1059
  ```
1411
1060
 
1412
- #### Authorization
1413
-
1414
- **URL**: `POST /api/strapi-plugin-payone-provider/authorization`
1415
-
1416
- **Request Body**: (Same as Preauthorization)
1417
-
1418
- ```json
1419
- {
1420
- "amount": 1000,
1421
- "currency": "EUR",
1422
- "reference": "PAY1234567890ABCDEF",
1423
- "clearingtype": "sb",
1424
- "onlinebanktransfertype": "PNT",
1425
- "bankcountry": "DE",
1426
- "firstname": "John",
1427
- "lastname": "Doe",
1428
- "email": "john.doe@example.com",
1429
- "telephonenumber": "+4917512345678",
1430
- "street": "Main Street 123",
1431
- "zip": "12345",
1432
- "city": "Berlin",
1433
- "country": "DE",
1434
- "successurl": "https://www.example.com/success",
1435
- "errorurl": "https://www.example.com/error",
1436
- "backurl": "https://www.example.com/back",
1437
- "salutation": "Herr",
1438
- "gender": "m",
1439
- "ip": "127.0.0.1",
1440
- "language": "de",
1441
- "customer_is_present": "yes"
1442
- }
1443
- ```
1444
-
1445
- **Response**:
1446
-
1447
- ```json
1448
- {
1449
- "data": {
1450
- "status": "REDIRECT",
1451
- "txid": "123456789",
1452
- "redirecturl": "https://secure.pay1.de/redirect/..."
1453
- }
1454
- }
1455
- ```
1456
1061
 
1457
1062
  #### Capture
1458
1063
 
1459
- **URL**: `POST /api/strapi-plugin-payone-provider/capture`
1064
+ **Endpoint:**
1065
+ - `POST /api/strapi-plugin-payone-provider/capture`
1460
1066
 
1461
1067
  **Request Body**:
1462
1068
 
@@ -1482,7 +1088,8 @@ The token from Google Pay is a JSON string with the following structure:
1482
1088
 
1483
1089
  #### Refund
1484
1090
 
1485
- **URL**: `POST /api/strapi-plugin-payone-provider/refund`
1091
+ **Endpoint:**
1092
+ - `POST /api/strapi-plugin-payone-provider/refund`
1486
1093
 
1487
1094
  **Request Body**:
1488
1095
 
@@ -1511,50 +1118,7 @@ The token from Google Pay is a JSON string with the following structure:
1511
1118
 
1512
1119
  ---
1513
1120
 
1514
- ## ✅ Supported Payment Methods
1515
-
1516
- Click on any payment method to see detailed API documentation:
1517
-
1518
- - [Credit Card](#credit-card)
1519
- - [PayPal](#paypal)
1520
- - [Google Pay](#google-pay)
1521
- - [Apple Pay](#apple-pay)
1522
- - [SEPA Direct Debit](#sepa-direct-debit)
1523
- - [Sofort Banking](#sofort-banking)
1524
-
1525
- ---
1526
-
1527
- ## 📝 Notes
1528
-
1529
- ### Important Parameters
1530
-
1531
- - **amount**: Always in cents (e.g., 1000 = 10.00 EUR)
1532
- - **reference**: Max 20 characters, alphanumeric only. Auto-normalized by the plugin.
1533
- - **cardexpiredate**: Format is YYMM (e.g., "2512" = December 2025)
1534
- - **sequencenumber**: Start with 1 for capture, 2 for first refund, increment for subsequent refunds
1535
- - **Refund amount**: Must be negative (e.g., -1000 for 10.00 EUR refund)
1536
-
1537
- ### Redirect URLs
1538
-
1539
- For redirect-based payment methods (PayPal, Google Pay, Apple Pay, Sofort), you must provide:
1540
-
1541
- - `successurl`: URL to redirect after successful payment
1542
- - `errorurl`: URL to redirect after payment error
1543
- - `backurl`: URL to redirect if user cancels payment
1544
-
1545
- ### Preauthorization vs Authorization
1546
-
1547
- - **Preauthorization**: Reserves funds but doesn't charge immediately. Requires a Capture call later.
1548
- - **Authorization**: Immediately charges the customer's payment method.
1549
-
1550
- ### Capture Mode
1551
-
1552
- For wallet payments (PayPal, Google Pay, Apple Pay), you can specify:
1553
-
1554
- - `capturemode: "full"`: Capture the entire preauthorized amount
1555
- - `capturemode: "partial"`: Capture less than the preauthorized amount
1556
-
1557
- ## đŸ“ĸ TransactionStatus Notifications
1121
+ ## TransactionStatus Notifications
1558
1122
 
1559
1123
  The Payone platform provides an asynchronous way of notifying your system of changes to a transaction. These notifications are called "TransactionStatus" and are automatically handled by this plugin.
1560
1124
 
@@ -1617,3 +1181,11 @@ The plugin automatically verifies:
1617
1181
  4. **Credentials**: Verifies that `portalid` and `aid` match your configured settings
1618
1182
 
1619
1183
  > 📖 **Reference**: For more details, see [Payone TransactionStatus Notification Documentation](https://docs.payone.com/integration/response-handling/transactionstatus-notification)
1184
+
1185
+ ---
1186
+
1187
+ ## Notes
1188
+
1189
+ For additional information and updates, please refer to the official Payone documentation:
1190
+
1191
+ **Payone Documentation**: [https://docs.payone.com/payment-methods](https://docs.payone.com/payment-methods)
@@ -1,6 +1,18 @@
1
- import React from "react";
2
- import { Puzzle } from "@strapi/icons";
3
1
 
4
- const PluginIcon = () => <Puzzle />;
2
+ const PluginIcon = () => (
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ xmlSpace="preserve"
6
+ id="Capa_1"
7
+ width={16}
8
+ height={16}
9
+ fill="currentColor"
10
+ version="1.1"
11
+ viewBox="0 0 438.254 438.254"
12
+ >
13
+ <path d="M402.612 177.546H368.25V63.187c0-19.652-15.988-35.64-35.64-35.64H35.641C15.988 27.547 0 43.535 0 63.187v161.88c0 19.652 15.988 35.64 35.641 35.64h34.357v114.358c0 19.653 15.989 35.642 35.642 35.642h296.973c19.652 0 35.642-15.989 35.642-35.642V213.188c-.001-19.653-15.99-35.642-35.643-35.642m-64.362-45.839H30v-20h308.25zM35.641 57.547h296.97c3.109 0 5.64 2.53 5.64 5.64v28.52H30v-28.52c0-3.11 2.53-5.64 5.641-5.64m0 173.16a5.647 5.647 0 0 1-5.641-5.64v-73.36h308.25v25.839H105.64c-19.652 0-35.642 15.989-35.642 35.642v17.519zm372.613 144.358a5.65 5.65 0 0 1-5.642 5.642H105.64a5.65 5.65 0 0 1-5.642-5.642V213.188a5.65 5.65 0 0 1 5.642-5.642h296.973a5.65 5.65 0 0 1 5.642 5.642z"></path>
14
+ <path d="M358.585 287.966c-6.941 0-13.48 1.74-19.216 4.797-5.885-3.15-12.429-4.797-19.265-4.797-22.607 0-41 18.393-41 41s18.393 41 41 41c6.835 0 13.379-1.647 19.265-4.796a40.74 40.74 0 0 0 19.216 4.796c22.607 0 41-18.393 41-41s-18.393-41-41-41m-59.481 41c0-11.579 9.421-21 21-21 1.065 0 2.113.09 3.145.243-3.593 6.093-5.664 13.186-5.664 20.757s2.071 14.664 5.664 20.757c-1.032.153-2.08.243-3.145.243-11.58 0-21-9.42-21-21m59.481 21c-11.579 0-21-9.421-21-21s9.421-21 21-21 21 9.421 21 21-9.421 21-21 21M177.126 241.707h-28c-5.522 0-10 4.477-10 10s4.478 10 10 10h28c5.522 0 10-4.477 10-10s-4.478-10-10-10M237.793 241.707h-28c-5.522 0-10 4.477-10 10s4.478 10 10 10h28c5.522 0 10-4.477 10-10s-4.478-10-10-10M308.459 251.707c0-5.523-4.478-10-10-10h-28c-5.522 0-10 4.477-10 10s4.478 10 10 10h28c5.522 0 10-4.477 10-10M331.126 261.707h28c5.522 0 10-4.477 10-10s-4.478-10-10-10h-28c-5.522 0-10 4.477-10 10s4.478 10 10 10"></path>
15
+ </svg>
16
+ );
5
17
 
6
18
  export default PluginIcon;
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  import {
3
3
  Box,
4
4
  Card,
@@ -9,6 +9,7 @@ import {
9
9
  Accordion,
10
10
  AccordionToggle,
11
11
  AccordionContent,
12
+ Link,
12
13
  } from "@strapi/design-system";
13
14
 
14
15
  const CodeBlock = ({ children }) => {
@@ -123,31 +124,31 @@ const DocsPanel = () => {
123
124
  <AccordionContent>
124
125
  <Stack spacing={2} padding={4}>
125
126
  <Typography variant="pi">
126
- 1. <a href="#base-url">Base URL & Authentication</a>
127
+ 1. <a style={{ color: "inherit", textDecoration:"none" }} href="#base-url">Base URL & Authentication</a>
127
128
  </Typography>
128
129
  <Typography variant="pi">
129
- 2. <a href="#payment-methods">Supported Payment Methods</a>
130
+ 2. <a style={{ color: "inherit", textDecoration:"none" }} href="#payment-methods">Supported Payment Methods</a>
130
131
  </Typography>
131
132
  <Typography variant="pi">
132
- 3. <a href="#credit-card">Credit Card Integration</a>
133
+ 3. <a style={{ color: "inherit", textDecoration:"none" }} href="#credit-card">Credit Card Integration</a>
133
134
  </Typography>
134
135
  <Typography variant="pi">
135
- 4. <a href="#paypal">PayPal Integration</a>
136
+ 4. <a style={{ color: "inherit", textDecoration:"none" }} href="#paypal">PayPal Integration</a>
136
137
  </Typography>
137
138
  <Typography variant="pi">
138
- 5. <a href="#google-pay">Google Pay Integration</a>
139
+ 5. <a style={{ color: "inherit", textDecoration:"none" }} href="#google-pay">Google Pay Integration</a>
139
140
  </Typography>
140
141
  <Typography variant="pi">
141
- 6. <a href="#apple-pay">Apple Pay Integration</a>
142
+ 6. <a style={{ color: "inherit", textDecoration:"none" }} href="#apple-pay">Apple Pay Integration</a>
142
143
  </Typography>
143
144
  <Typography variant="pi">
144
- 7. <a href="#3d-secure">3D Secure Authentication</a>
145
+ 7. <a style={{ color: "inherit", textDecoration:"none" }} href="#3d-secure">3D Secure Authentication</a>
145
146
  </Typography>
146
147
  <Typography variant="pi">
147
- 8. <a href="#capture-refund">Capture & Refund Operations</a>
148
+ 8. <a style={{ color: "inherit", textDecoration:"none" }} href="#capture-refund">Capture & Refund Operations</a>
148
149
  </Typography>
149
150
  <Typography variant="pi">
150
- 9. <a href="#test-credentials">Test Credentials</a>
151
+ 9. <a style={{ color: "inherit", textDecoration:"none" }} href="#test-credentials">Test Credentials</a>
151
152
  </Typography>
152
153
  </Stack>
153
154
  </AccordionContent>
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import { useState } from "react";
2
2
  import { Badge, Box, Typography, Flex } from "@strapi/design-system";
3
3
  import { ExclamationMarkCircle } from "@strapi/icons";
4
4
 
@@ -133,20 +133,20 @@ const TransactionTable = () => {
133
133
  <Td>
134
134
  <Typography variant="pi">
135
135
  {getPaymentMethodName(
136
- transaction.raw_request?.clearingtype,
137
- transaction.raw_request?.wallettype,
138
- transaction.raw_request?.cardtype
136
+ (transaction.raw_request?.clearingtype || transaction?.body?.raw_request?.clearingtype),
137
+ (transaction.raw_request?.wallettype || transaction?.body?.raw_request?.wallettype),
138
+ (transaction.raw_request?.cardtype || transaction?.body?.raw_request?.cardtype)
139
139
  )}
140
140
  </Typography>
141
141
  </Td>
142
142
  <Td>
143
143
  <Typography variant="pi" fontWeight="semiBold">
144
- {transaction.request_type || "N/A"}
144
+ {(transaction.request_type || transaction?.body?.request_type) || "N/A"}
145
145
  </Typography>
146
146
  </Td>
147
147
  <Td>
148
148
  <StatusBadge
149
- status={transaction?.status}
149
+ status={(transaction.status || transaction?.body?.status)}
150
150
  transaction={transaction}
151
151
  />
152
152
  </Td>
@@ -46,8 +46,8 @@ const TransactionDetails = ({ transaction }) => {
46
46
  Name:
47
47
  </Typography>
48
48
  <Typography variant="pi" textColor="neutral800">
49
- {transaction.raw_request?.firstname}{" "}
50
- {transaction.raw_request?.lastname}
49
+ {(transaction.raw_request?.firstname || transaction?.body?.raw_request?.firstname)}{" "}
50
+ {(transaction.raw_request?.lastname || transaction?.body?.raw_request?.lastname)}
51
51
  </Typography>
52
52
  </Flex>
53
53
  <Flex gap={3}>
@@ -55,7 +55,7 @@ const TransactionDetails = ({ transaction }) => {
55
55
  Email:
56
56
  </Typography>
57
57
  <Typography variant="pi" textColor="neutral800">
58
- {transaction.raw_request?.email || "N/A"}
58
+ {(transaction.raw_request?.email || transaction?.body?.raw_request?.email) || "N/A"}
59
59
  </Typography>
60
60
  </Flex>
61
61
  <Flex gap={3}>
@@ -63,7 +63,7 @@ const TransactionDetails = ({ transaction }) => {
63
63
  Phone:
64
64
  </Typography>
65
65
  <Typography variant="pi" textColor="neutral800">
66
- {transaction.raw_request?.telephonenumber || "N/A"}
66
+ {(transaction.raw_request?.telephonenumber || transaction?.body?.raw_request?.telephonenumber) || "N/A"}
67
67
  </Typography>
68
68
  </Flex>
69
69
  <Flex gap={3}>
@@ -71,8 +71,8 @@ const TransactionDetails = ({ transaction }) => {
71
71
  Address:
72
72
  </Typography>
73
73
  <Typography variant="pi" textColor="neutral800">
74
- {transaction.raw_request?.street}, {transaction.raw_request?.zip}{" "}
75
- {transaction.raw_request?.city}
74
+ {(transaction.raw_request?.street || transaction?.body?.raw_request?.street)}, {(transaction.raw_request?.zip || transaction?.body?.raw_request?.zip)}{" "}
75
+ {(transaction.raw_request?.city || transaction?.body?.raw_request?.city)}
76
76
  </Typography>
77
77
  </Flex>
78
78
  </Flex>
@@ -90,7 +90,7 @@ const TransactionDetails = ({ transaction }) => {
90
90
  TX ID:
91
91
  </Typography>
92
92
  <Typography variant="pi" textColor="neutral800">
93
- {transaction.txid || "N/A"}
93
+ {(transaction.txid || transaction?.body?.txid) || "N/A"}
94
94
  </Typography>
95
95
  </Flex>
96
96
  {transaction.raw_request?.clearingtype === "cc" && (
@@ -104,7 +104,7 @@ const TransactionDetails = ({ transaction }) => {
104
104
  Card Type:
105
105
  </Typography>
106
106
  <Typography variant="pi" textColor="neutral800">
107
- {getCardTypeName(transaction.raw_request?.cardtype)}
107
+ {getCardTypeName(transaction.raw_request?.cardtype || transaction?.body?.raw_request?.cardtype)}
108
108
  </Typography>
109
109
  </Flex>
110
110
  <Flex gap={3}>
@@ -117,7 +117,7 @@ const TransactionDetails = ({ transaction }) => {
117
117
  </Typography>
118
118
  <Typography variant="pi" textColor="neutral800">
119
119
  **** **** ****{" "}
120
- {transaction.raw_request?.cardpan?.slice(-4) || "****"}
120
+ {(transaction.raw_request?.cardpan || transaction?.body?.raw_request?.cardpan)?.slice(-4) || "****"}
121
121
  </Typography>
122
122
  </Flex>
123
123
  </>
@@ -127,7 +127,7 @@ const TransactionDetails = ({ transaction }) => {
127
127
  Mode:
128
128
  </Typography>
129
129
  <Typography variant="pi" textColor="neutral800">
130
- {transaction.raw_request?.mode || "N/A"}
130
+ {(transaction.raw_request?.mode || transaction?.body?.raw_request?.mode) || "N/A"}
131
131
  </Typography>
132
132
  </Flex>
133
133
  </Flex>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-payone-provider",
3
- "version": "4.6.13",
3
+ "version": "4.6.15",
4
4
  "description": "Strapi plugin for Payone payment gateway integration",
5
5
  "license": "MIT",
6
6
  "maintainers": [
@@ -10,10 +10,10 @@
10
10
  }
11
11
  ],
12
12
  "dependencies": {
13
+ "@uiw/react-json-view": "^2.0.0-alpha.40",
13
14
  "apple-pay-button": "^1.2.1",
14
15
  "axios": "^1.6.3",
15
- "prop-types": "^15.7.2",
16
- "@uiw/react-json-view": "^2.0.0-alpha.40"
16
+ "prop-types": "^15.7.2"
17
17
  },
18
18
  "devDependencies": {
19
19
  "react": "^18.2.0",
@@ -48,4 +48,4 @@
48
48
  "kind": "plugin",
49
49
  "displayName": "Strapi Payone Provider"
50
50
  }
51
- }
51
+ }
@@ -258,14 +258,16 @@ module.exports = ({ strapi }) => ({
258
258
 
259
259
  async handleTransactionStatus(ctx) {
260
260
  try {
261
- if (!ctx.state.payoneAllowed) {
262
- console.log("[Payone] Notification ignored (policy failed)");
263
- } else {
261
+ if (ctx.state.payoneAllowed) {
264
262
  const notificationData = ctx.request.body || {};
265
263
  await getPayoneService(strapi).processTransactionStatus(notificationData);
264
+ } else {
265
+ console.warn("[Payone] Notification blocked by policy", {
266
+ ip: ctx.request.ip,
267
+ });
266
268
  }
267
269
  } catch (error) {
268
- console.log("[Payone TransactionStatus] Error:", error);
270
+ strapi.log.error("[Payone TransactionStatus] Error:", error);
269
271
  }
270
272
 
271
273
  ctx.status = 200;
@@ -1,20 +1,46 @@
1
1
  module.exports = async (ctx) => {
2
- const { request } = ctx;
2
+ const userAgent = ctx.request.headers["user-agent"] || "";
3
3
 
4
- const userAgent = request.headers["user-agent"] || "";
4
+ // Forwarded header parsing
5
+ const rawForwarded = ctx.request.headers["x-forwarded-for"];
6
+ const forwardedIp = rawForwarded?.split(",")[0]?.trim();
7
+ const xRealIp = ctx.request.headers["x-real-ip"]?.trim();
8
+ // Custom nginx header
9
+ const payoneHeaderIp = ctx.request.headers["x-payone-client-ip"]?.trim();
10
+
11
+ // Final client IP resolution priority
5
12
  const clientIp =
6
- request.headers["x-payone-client-ip"]?.trim() ||
7
- request.headers["x-forwarded-for"]?.split(",")[0]?.trim() ||
8
- request.ip ||
13
+ payoneHeaderIp ||
14
+ forwardedIp ||
15
+ xRealIp ||
16
+ ctx.request.ip ||
9
17
  "";
10
18
 
11
- const isValid = userAgent === "PAYONE FinanceGate" && (clientIp.startsWith("185.60.20.") || clientIp === "54.246.203.105");
19
+ // ===== Allowed IPs =====
20
+ const allowedExactIps = [
21
+ "54.246.203.105",
22
+ ];
23
+
24
+ const allowedIpRanges = [
25
+ /^185\.60\.20\.\d+$/, // 185.60.20.0 - 185.60.20.255
26
+ ];
27
+
28
+ const isIpAllowed =
29
+ allowedExactIps.includes(clientIp) ||
30
+ allowedIpRanges.some((regex) => regex.test(clientIp));
31
+
32
+ const isUserAgentValid = userAgent === "PAYONE FinanceGate";
33
+
34
+ const isValid = isIpAllowed && isUserAgentValid;
12
35
 
13
36
  ctx.state.payoneAllowed = isValid;
14
37
 
15
38
  if (!isValid) {
16
- console.log("[Payone] Policy failed", { userAgent, clientIp });
39
+ console.warn("[Payone] Policy failed", {
40
+ userAgent,
41
+ clientIp,
42
+ });
17
43
  }
18
44
 
19
45
  return true;
20
- };
46
+ };