@xpaysh/n8n-nodes-xpay 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 xpay✦
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # n8n-nodes-xpay
2
+
3
+ **Monetize your n8n workflows with xpay✦ payments.**
4
+
5
+ Turn any n8n workflow into a paid service in 60 seconds. Accept USDC payments on Base - no coding required.
6
+
7
+ ## How It Works
8
+
9
+ 1. Drag the **xpay✦ pay-to-run trigger** node onto your canvas
10
+ 2. Configure your product name and price
11
+ 3. Add any customer input fields you need
12
+ 4. Activate the workflow - you'll get a shareable Pay to Run form URL
13
+ 5. Share the link with customers
14
+ 6. When they pay, your workflow runs automatically
15
+
16
+ ## Installation
17
+
18
+ ### In n8n (Recommended)
19
+
20
+ 1. Go to **Settings > Community Nodes**
21
+ 2. Click **Install a community node**
22
+ 3. Enter `@xpaysh/n8n-nodes-xpay`
23
+ 4. Click **Install**
24
+
25
+ ### Manual Installation
26
+
27
+ ```bash
28
+ npm install @xpaysh/n8n-nodes-xpay
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ### 1. Get Your API Key
34
+
35
+ 1. Sign up at [app.xpay.sh](https://app.xpay.sh)
36
+ 2. Go to **Settings > API Keys**
37
+ 3. Create a new API key
38
+ 4. Copy the secret key
39
+
40
+ ### 2. Add Credentials in n8n
41
+
42
+ 1. Go to **Credentials** in n8n
43
+ 2. Click **Add Credential**
44
+ 3. Search for "xpay✦ API"
45
+ 4. Paste your API secret
46
+ 5. Choose **Sandbox** for testing or **Production** for real payments
47
+
48
+ ### 3. Create Your First Paid Workflow
49
+
50
+ 1. Create a new workflow
51
+ 2. Add the **xpay✦ pay-to-run trigger** node
52
+ 3. Configure:
53
+ - **Product Name**: "Premium SEO Audit"
54
+ - **Price**: 5.00 (USDC)
55
+ - **Recipient Wallet**: Your wallet address
56
+ - **Customer Fields**: Add "email" and "website" fields
57
+ 4. Connect your other nodes (e.g., HTTP Request, Send Email)
58
+ 5. **Activate** the workflow
59
+ 6. Get your Pay to Run form URL (see below)
60
+
61
+ ### 4. Get Your Pay to Run Form URL
62
+
63
+ There are two ways to find your form URL:
64
+
65
+ **Option A: POST to Webhook URL (Recommended)**
66
+ 1. Copy the webhook URL shown in the n8n trigger panel
67
+ 2. Send an empty POST request: `curl -X POST <webhook-url>`
68
+ 3. You'll get back your form URL and instructions:
69
+ ```json
70
+ {
71
+ "message": "xpay✦ pay-to-run trigger is listening!",
72
+ "form_url": "https://run.xpay.sh/p/chk_abc123",
73
+ "test_mode": true,
74
+ "instructions": "Test mode is ON. Send a POST with {\"payment\": ...} to simulate."
75
+ }
76
+ ```
77
+
78
+ **Option B: Check Server Logs**
79
+ 1. Activate the workflow
80
+ 2. Check your n8n server logs for: `Form URL: https://run.xpay.sh/p/...`
81
+
82
+ ### 5. Test in Sandbox Mode
83
+
84
+ With **Test Mode** enabled:
85
+ - No real payments required
86
+ - No signature verification on webhooks (easier testing)
87
+ - Click "Simulate Payment" on the Pay to Run form
88
+ - Or POST test data directly to your webhook:
89
+ ```bash
90
+ curl -X POST <webhook-url> \
91
+ -H "Content-Type: application/json" \
92
+ -d '{"payment":{"amount":5},"input":{"email":"test@test.com"}}'
93
+ ```
94
+
95
+ ## Test Mode vs Production Mode
96
+
97
+ **Important:** When you test a workflow in n8n (clicking "Execute workflow" or "Test step"), a new temporary checkout is created. This checkout becomes inactive when you stop testing.
98
+
99
+ **For a persistent Pay to Run form URL:**
100
+ 1. **Activate** the workflow (toggle the switch in the top-right)
101
+ 2. The form URL will remain active as long as the workflow is active
102
+ 3. The same URL works for all customers - no need to generate new ones
103
+
104
+ ## Node Properties
105
+
106
+ | Property | Description |
107
+ |----------|-------------|
108
+ | **Product Name** | What customers are paying for |
109
+ | **Description** | Brief description shown on payment page |
110
+ | **Price (USDC)** | Amount in USDC (e.g., 5.00 = $5) |
111
+ | **Network** | Base (production) or Base Sepolia (testnet) |
112
+ | **Recipient Wallet** | Your wallet address to receive payments |
113
+ | **Customer Form Fields** | Input fields customers must fill |
114
+ | **Redirect URL** | Where to send customers after payment |
115
+ | **Test Mode** | Enable sandbox mode (no real payments) |
116
+
117
+ ## Output Data
118
+
119
+ When a payment is received, the workflow gets:
120
+
121
+ ```json
122
+ {
123
+ "payment": {
124
+ "txHash": "0x123...",
125
+ "amount": 5.00,
126
+ "currency": "USDC",
127
+ "payer": "0xABC...",
128
+ "network": "base",
129
+ "timestamp": 1702841234
130
+ },
131
+ "input": {
132
+ "email": "customer@example.com",
133
+ "website": "https://example.com"
134
+ },
135
+ "metadata": {
136
+ "checkoutId": "chk_abc123",
137
+ "receivedAt": "2024-12-17T10:00:00.000Z"
138
+ }
139
+ }
140
+ ```
141
+
142
+ ## Use Cases
143
+
144
+ - **SEO Audits**: Charge $10 per website audit
145
+ - **Report Generation**: Sell custom reports
146
+ - **API Access**: Monetize your APIs per-request
147
+ - **Consultations**: Accept payment before scheduling
148
+ - **Digital Products**: Deliver files after payment
149
+ - **Lead Generation**: Qualify leads with payment
150
+
151
+ ## Security
152
+
153
+ - **Non-custodial**: Payments go directly to your wallet
154
+ - **Signature verification**: All webhooks are HMAC-signed (production mode)
155
+ - **Replay protection**: Each payment can only trigger once
156
+ - **Timestamp validation**: Old requests are rejected
157
+
158
+ ## Support
159
+
160
+ - Documentation: [docs.xpay.sh/integrations/n8n](https://docs.xpay.sh/integrations/n8n)
161
+ - Issues: [GitHub Issues](https://github.com/xpay-sh/n8n-nodes-xpay/issues)
162
+ - Email: xpaysh@gmail.com
163
+
164
+ ## License
165
+
166
+ MIT
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class XPayApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=XPayApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XPayApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/XPayApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,OAAQ,YAAW,eAAe;IAC9C,IAAI,SAAa;IACjB,WAAW,SAAe;IAC1B,gBAAgB,SAA2C;IAE3D,UAAU,EAAE,eAAe,EAAE,CAgC3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAO1B;CACF"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XPayApi = void 0;
4
+ class XPayApi {
5
+ constructor() {
6
+ this.name = 'xPayApi';
7
+ this.displayName = 'xpay✦ API';
8
+ this.documentationUrl = 'https://docs.xpay.sh/integrations/n8n';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Secret',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: {
15
+ password: true,
16
+ },
17
+ default: '',
18
+ required: true,
19
+ description: 'Your xpay✦ API secret key',
20
+ hint: 'Get your keys at app.xpay.sh/settings/api-keys',
21
+ },
22
+ {
23
+ displayName: 'Environment',
24
+ name: 'environment',
25
+ type: 'options',
26
+ options: [
27
+ {
28
+ name: 'Sandbox',
29
+ value: 'sandbox',
30
+ description: 'Test mode - no real payments',
31
+ },
32
+ {
33
+ name: 'Production',
34
+ value: 'production',
35
+ description: 'Live mode - real payments',
36
+ },
37
+ ],
38
+ default: 'sandbox',
39
+ description: 'Choose Sandbox for testing, Production for live payments',
40
+ },
41
+ ];
42
+ this.authenticate = {
43
+ type: 'generic',
44
+ properties: {
45
+ headers: {
46
+ Authorization: '=Bearer {{$credentials.apiKey}}',
47
+ },
48
+ },
49
+ };
50
+ this.test = {
51
+ request: {
52
+ // TODO: Update to api.xpay.sh once DNS is configured
53
+ baseURL: '={{$credentials.environment === "production" ? "https://cja09z457f.execute-api.us-east-1.amazonaws.com/dev" : "https://cja09z457f.execute-api.us-east-1.amazonaws.com/dev"}}',
54
+ url: '/v1/health',
55
+ method: 'GET',
56
+ },
57
+ };
58
+ }
59
+ }
60
+ exports.XPayApi = XPayApi;
61
+ //# sourceMappingURL=XPayApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XPayApi.credentials.js","sourceRoot":"","sources":["../../credentials/XPayApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACC,SAAI,GAAG,SAAS,CAAC;QACjB,gBAAW,GAAG,WAAW,CAAC;QAC1B,qBAAgB,GAAG,uCAAuC,CAAC;QAE3D,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,gDAAgD;aACtD;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,SAAS;wBAChB,WAAW,EAAE,8BAA8B;qBAC3C;oBACD;wBACC,IAAI,EAAE,YAAY;wBAClB,KAAK,EAAE,YAAY;wBACnB,WAAW,EAAE,2BAA2B;qBACxC;iBACD;gBACD,OAAO,EAAE,SAAS;gBAClB,WAAW,EAAE,0DAA0D;aACvE;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,qDAAqD;gBACrD,OAAO,EAAE,8KAA8K;gBACvL,GAAG,EAAE,YAAY;gBACjB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAxDD,0BAwDC"}
@@ -0,0 +1,3 @@
1
+ export * from './nodes/XPayTrigger/XPayTrigger.node';
2
+ export * from './credentials/XPayApi.credentials';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./nodes/XPayTrigger/XPayTrigger.node"), exports);
18
+ __exportStar(require("./credentials/XPayApi.credentials"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,oEAAkD"}
@@ -0,0 +1,13 @@
1
+ import type { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
2
+ export declare class XPayTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhookMethods: {
5
+ default: {
6
+ checkExists(this: IHookFunctions): Promise<boolean>;
7
+ create(this: IHookFunctions): Promise<boolean>;
8
+ delete(this: IHookFunctions): Promise<boolean>;
9
+ };
10
+ };
11
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
12
+ }
13
+ //# sourceMappingURL=XPayTrigger.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XPayTrigger.node.d.ts","sourceRoot":"","sources":["../../../nodes/XPayTrigger/XPayTrigger.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,iBAAiB,EAEjB,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EAGpB,MAAM,cAAc,CAAC;AAGtB,qBAAa,WAAY,YAAW,SAAS;IAC5C,WAAW,EAAE,oBAAoB,CAsM/B;IAEF,cAAc;;8BAEY,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;yBAKtC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;yBAgGjC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;;MAkCpD;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAoKrE"}
@@ -0,0 +1,501 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.XPayTrigger = void 0;
37
+ const crypto = __importStar(require("crypto"));
38
+ class XPayTrigger {
39
+ constructor() {
40
+ this.description = {
41
+ displayName: 'xpay✦ pay-to-run trigger',
42
+ name: 'xPayTrigger',
43
+ icon: 'file:xpay.svg',
44
+ group: ['trigger'],
45
+ version: 1,
46
+ subtitle: '={{$parameter["productName"]}}',
47
+ description: 'Starts the workflow when a customer pays via your hosted beautiful Pay to Run form',
48
+ defaults: {
49
+ name: 'xpay✦ pay-to-run trigger',
50
+ },
51
+ // Show activation message with checkout URL
52
+ activationMessage: 'xpay✦ is active! Your Pay to Run form URL is ready - check the Output panel.',
53
+ inputs: [],
54
+ outputs: ['main'],
55
+ credentials: [
56
+ {
57
+ name: 'xPayApi',
58
+ required: true,
59
+ },
60
+ ],
61
+ webhooks: [
62
+ {
63
+ name: 'default',
64
+ httpMethod: 'POST',
65
+ responseMode: 'onReceived',
66
+ path: 'webhook',
67
+ },
68
+ {
69
+ name: 'setup',
70
+ httpMethod: 'GET',
71
+ responseMode: 'onReceived',
72
+ path: 'webhook',
73
+ restartWebhook: true,
74
+ },
75
+ ],
76
+ // Custom trigger panel text
77
+ triggerPanel: {
78
+ header: 'xpay✦ pay-to-run trigger',
79
+ executionsHelp: {
80
+ inactive: 'Activate the workflow to generate your Pay to Run form URL. POST an empty body to the webhook URL to get it.',
81
+ active: 'Workflow is active! POST an empty body to the webhook URL shown above to get your Pay to Run form URL.',
82
+ },
83
+ activationHint: 'POST an empty body {} to the webhook URL above to get your form URL, then simulate a test payment.',
84
+ },
85
+ properties: [
86
+ // Instructions notice with actual content
87
+ {
88
+ displayName: 'After activating, POST an empty body {} to the webhook URL above. You will receive your Pay to Run form URL in the response.',
89
+ name: 'notice',
90
+ type: 'notice',
91
+ default: '',
92
+ },
93
+ // Product Details Section
94
+ {
95
+ displayName: 'Product Name',
96
+ name: 'productName',
97
+ type: 'string',
98
+ default: '',
99
+ required: true,
100
+ placeholder: 'e.g., Premium SEO Audit',
101
+ description: 'The name of what customers are paying for',
102
+ },
103
+ {
104
+ displayName: 'Description',
105
+ name: 'description',
106
+ type: 'string',
107
+ typeOptions: {
108
+ rows: 3,
109
+ },
110
+ default: '',
111
+ placeholder: 'Brief description of what the customer will receive',
112
+ description: 'A short description shown on the payment page',
113
+ },
114
+ // Pricing Section
115
+ {
116
+ displayName: 'Price (USDC)',
117
+ name: 'amount',
118
+ type: 'number',
119
+ default: 1.0,
120
+ required: true,
121
+ typeOptions: {
122
+ minValue: 0.01,
123
+ numberPrecision: 2,
124
+ },
125
+ description: 'Price in USDC (e.g., 5.00 for $5)',
126
+ },
127
+ {
128
+ displayName: 'Network',
129
+ name: 'network',
130
+ type: 'options',
131
+ options: [
132
+ {
133
+ name: 'Base',
134
+ value: 'base',
135
+ description: 'Base Mainnet (production)',
136
+ },
137
+ {
138
+ name: 'Base Sepolia',
139
+ value: 'base-sepolia',
140
+ description: 'Base Sepolia (testnet)',
141
+ },
142
+ ],
143
+ default: 'base-sepolia',
144
+ description: 'Blockchain network for payments',
145
+ },
146
+ // Recipient Wallet
147
+ {
148
+ displayName: 'Recipient Wallet',
149
+ name: 'recipientWallet',
150
+ type: 'string',
151
+ default: '',
152
+ required: true,
153
+ placeholder: '0x742d35Cc6634C0532925a3b844Bc9e7595f8fE00',
154
+ description: 'Your Ethereum wallet address (42 characters, starting with 0x)',
155
+ validateType: 'string',
156
+ typeOptions: {
157
+ validationMessage: 'Must be a valid Ethereum address (42 characters starting with 0x)',
158
+ },
159
+ },
160
+ // Customer Input Fields
161
+ {
162
+ displayName: 'Customer Form Fields',
163
+ name: 'fields',
164
+ type: 'fixedCollection',
165
+ typeOptions: {
166
+ multipleValues: true,
167
+ },
168
+ default: {},
169
+ placeholder: 'Add Field',
170
+ description: 'Form fields the customer must fill before paying',
171
+ options: [
172
+ {
173
+ name: 'fieldValues',
174
+ displayName: 'Field',
175
+ values: [
176
+ {
177
+ displayName: 'Field Name',
178
+ name: 'name',
179
+ type: 'string',
180
+ default: '',
181
+ placeholder: 'e.g., email',
182
+ description: 'The field identifier (no spaces)',
183
+ },
184
+ {
185
+ displayName: 'Label',
186
+ name: 'label',
187
+ type: 'string',
188
+ default: '',
189
+ placeholder: 'e.g., Email Address',
190
+ description: 'Display label shown to customer',
191
+ },
192
+ {
193
+ displayName: 'Field Type',
194
+ name: 'type',
195
+ type: 'options',
196
+ options: [
197
+ { name: 'Text', value: 'text' },
198
+ { name: 'Email', value: 'email' },
199
+ { name: 'URL', value: 'url' },
200
+ { name: 'Number', value: 'number' },
201
+ { name: 'Textarea', value: 'textarea' },
202
+ ],
203
+ default: 'text',
204
+ description: 'Type of input field',
205
+ },
206
+ {
207
+ displayName: 'Required',
208
+ name: 'required',
209
+ type: 'boolean',
210
+ default: true,
211
+ description: 'Whether this field is required',
212
+ },
213
+ ],
214
+ },
215
+ ],
216
+ },
217
+ // Configuration Section
218
+ {
219
+ displayName: 'Redirect URL',
220
+ name: 'redirectUrl',
221
+ type: 'string',
222
+ default: '',
223
+ placeholder: 'https://yoursite.com/thank-you',
224
+ description: 'Where to send customers after successful payment (optional)',
225
+ },
226
+ {
227
+ displayName: 'Test Mode',
228
+ name: 'testMode',
229
+ type: 'boolean',
230
+ default: true,
231
+ description: 'Whether to enable sandbox mode (no real payments required)',
232
+ },
233
+ ],
234
+ };
235
+ this.webhookMethods = {
236
+ default: {
237
+ async checkExists() {
238
+ const webhookData = this.getWorkflowStaticData('node');
239
+ return webhookData.checkoutId !== undefined;
240
+ },
241
+ async create() {
242
+ const webhookUrl = this.getNodeWebhookUrl('default');
243
+ const credentials = await this.getCredentials('xPayApi');
244
+ // Get node parameters
245
+ const productName = this.getNodeParameter('productName');
246
+ const recipientWallet = this.getNodeParameter('recipientWallet');
247
+ // Validate wallet address format
248
+ if (!recipientWallet || !/^0x[a-fA-F0-9]{40}$/.test(recipientWallet)) {
249
+ throw new Error('Invalid wallet address. Must be 42 characters starting with 0x (e.g., 0x742d35Cc6634C0532925a3b844Bc9e7595f8fE00)');
250
+ }
251
+ const description = this.getNodeParameter('description', '');
252
+ const amount = this.getNodeParameter('amount');
253
+ const network = this.getNodeParameter('network');
254
+ const fieldsData = this.getNodeParameter('fields');
255
+ const redirectUrl = this.getNodeParameter('redirectUrl', '');
256
+ const testMode = this.getNodeParameter('testMode');
257
+ // Format fields for API
258
+ const fields = (fieldsData.fieldValues || []).map((field) => ({
259
+ name: field.name,
260
+ label: field.label,
261
+ type: field.type,
262
+ required: field.required,
263
+ }));
264
+ // Determine API base URL
265
+ // TODO: Update to api.xpay.sh once DNS is configured
266
+ const apiBaseUrl = credentials.environment === 'production'
267
+ ? 'https://cja09z457f.execute-api.us-east-1.amazonaws.com/dev'
268
+ : 'https://cja09z457f.execute-api.us-east-1.amazonaws.com/dev';
269
+ // Register webhook with xPay API
270
+ const requestOptions = {
271
+ method: 'POST',
272
+ url: `${apiBaseUrl}/v1/webhooks/register`,
273
+ body: {
274
+ callback_url: webhookUrl,
275
+ config: {
276
+ product_name: productName,
277
+ description: description,
278
+ price: amount,
279
+ currency: 'USDC',
280
+ network: network,
281
+ recipient_wallet: recipientWallet,
282
+ fields: fields,
283
+ redirect_url: redirectUrl,
284
+ test_mode: testMode,
285
+ },
286
+ },
287
+ json: true,
288
+ };
289
+ try {
290
+ const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'xPayApi', requestOptions));
291
+ // Store checkout data in workflow static data
292
+ const webhookData = this.getWorkflowStaticData('node');
293
+ webhookData.checkoutId = response.checkout_id;
294
+ webhookData.checkoutUrl = response.checkout_url;
295
+ webhookData.webhookSecret = response.webhook_secret;
296
+ // Log the checkout URL for the builder to copy
297
+ console.log('\n========================================');
298
+ console.log('xpay✦ Pay to Run Form Generated!');
299
+ console.log('========================================');
300
+ console.log(`Product: ${productName}`);
301
+ console.log(`Price: $${amount} USDC`);
302
+ console.log(`Form URL: ${response.checkout_url}`);
303
+ console.log('========================================');
304
+ console.log('Share this link with your customers to start the workflow.\n');
305
+ return true;
306
+ }
307
+ catch (error) {
308
+ // For now, allow activation even if API fails (for local testing)
309
+ console.warn('xPay API registration failed:', error);
310
+ console.warn('Workflow will accept webhooks but checkout URL is not available.');
311
+ const webhookData = this.getWorkflowStaticData('node');
312
+ webhookData.checkoutId = 'local-test';
313
+ webhookData.webhookSecret = 'test-secret';
314
+ return true;
315
+ }
316
+ },
317
+ async delete() {
318
+ const webhookData = this.getWorkflowStaticData('node');
319
+ const checkoutId = webhookData.checkoutId;
320
+ if (!checkoutId || checkoutId === 'local-test') {
321
+ return true;
322
+ }
323
+ const credentials = await this.getCredentials('xPayApi');
324
+ // TODO: Update to api.xpay.sh once DNS is configured
325
+ const apiBaseUrl = credentials.environment === 'production'
326
+ ? 'https://cja09z457f.execute-api.us-east-1.amazonaws.com/dev'
327
+ : 'https://cja09z457f.execute-api.us-east-1.amazonaws.com/dev';
328
+ try {
329
+ await this.helpers.httpRequestWithAuthentication.call(this, 'xPayApi', {
330
+ method: 'DELETE',
331
+ url: `${apiBaseUrl}/v1/webhooks/${checkoutId}`,
332
+ json: true,
333
+ });
334
+ }
335
+ catch (error) {
336
+ // Ignore errors on deletion
337
+ console.warn('Failed to delete webhook:', error);
338
+ }
339
+ // Clear static data
340
+ delete webhookData.checkoutId;
341
+ delete webhookData.checkoutUrl;
342
+ delete webhookData.webhookSecret;
343
+ return true;
344
+ },
345
+ },
346
+ };
347
+ }
348
+ async webhook() {
349
+ const webhookName = this.getWebhookName();
350
+ const req = this.getRequestObject();
351
+ const webhookData = this.getWorkflowStaticData('node');
352
+ // Handle GET request - show checkout URL info page
353
+ if (webhookName === 'setup' || req.method === 'GET') {
354
+ const checkoutUrl = webhookData.checkoutUrl;
355
+ const productName = this.getNodeParameter('productName');
356
+ const amount = this.getNodeParameter('amount');
357
+ const html = `
358
+ <!DOCTYPE html>
359
+ <html>
360
+ <head>
361
+ <title>xpay✦ Pay to Run Form Ready</title>
362
+ <style>
363
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; background: #f5f5f5; }
364
+ .card { background: white; border-radius: 12px; padding: 30px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
365
+ h1 { color: #10b981; margin-top: 0; }
366
+ .url-box { background: #f0fdf4; border: 2px solid #10b981; border-radius: 8px; padding: 15px; margin: 20px 0; word-break: break-all; }
367
+ .copy-btn { background: #10b981; color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 16px; margin-top: 10px; }
368
+ .copy-btn:hover { background: #059669; }
369
+ .info { color: #666; margin-top: 20px; }
370
+ .test-btn { display: inline-block; background: #3b82f6; color: white; text-decoration: none; padding: 12px 24px; border-radius: 6px; margin-top: 10px; }
371
+ </style>
372
+ </head>
373
+ <body>
374
+ <div class="card">
375
+ <h1>✅ xpay✦ Pay to Run Form Ready!</h1>
376
+ <p><strong>Product:</strong> ${productName}</p>
377
+ <p><strong>Price:</strong> $${amount} USDC</p>
378
+
379
+ <h3>Your Pay to Run Form URL:</h3>
380
+ <div class="url-box" id="checkoutUrl">${checkoutUrl || 'URL not available yet'}</div>
381
+ <button class="copy-btn" onclick="navigator.clipboard.writeText('${checkoutUrl}'); this.textContent='Copied!'">📋 Copy URL</button>
382
+
383
+ ${checkoutUrl ? `<p><a href="${checkoutUrl}" target="_blank" class="test-btn">🚀 Open Pay to Run Form</a></p>` : ''}
384
+
385
+ <div class="info">
386
+ <p><strong>Next Steps:</strong></p>
387
+ <ol>
388
+ <li>Copy the form URL above</li>
389
+ <li>Share it with your customers</li>
390
+ <li>When they pay, your n8n workflow will trigger!</li>
391
+ </ol>
392
+ </div>
393
+ </div>
394
+ </body>
395
+ </html>`;
396
+ return {
397
+ webhookResponse: {
398
+ status: 200,
399
+ headers: { 'Content-Type': 'text/html' },
400
+ body: html,
401
+ },
402
+ };
403
+ }
404
+ // Handle POST request - actual payment webhook
405
+ const body = this.getBodyData();
406
+ const headers = this.getHeaderData();
407
+ const webhookSecret = webhookData.webhookSecret;
408
+ const testMode = this.getNodeParameter('testMode', true);
409
+ const checkoutUrl = webhookData.checkoutUrl;
410
+ // If empty body or _getInfo flag, return helpful info
411
+ if (!body || Object.keys(body).length === 0 || body._getInfo) {
412
+ return {
413
+ webhookResponse: {
414
+ status: 200,
415
+ body: {
416
+ message: 'xpay✦ pay-to-run trigger is listening!',
417
+ form_url: checkoutUrl,
418
+ checkout_id: webhookData.checkoutId,
419
+ test_mode: testMode,
420
+ instructions: testMode
421
+ ? 'Test mode is ON. Send a POST with {"payment": {"amount": 1}, "input": {"email": "test@example.com"}} to simulate a payment.'
422
+ : 'Share the form_url with customers. When they pay, this webhook will receive the payment data.',
423
+ },
424
+ },
425
+ };
426
+ }
427
+ // In test mode, skip signature verification for easier testing
428
+ const skipSignatureVerification = testMode || webhookSecret === 'test-secret';
429
+ if (!skipSignatureVerification) {
430
+ const signature = headers['x-xpay-signature'];
431
+ const timestamp = headers['x-xpay-timestamp'];
432
+ if (!signature || !timestamp) {
433
+ return {
434
+ webhookResponse: {
435
+ status: 401,
436
+ body: { error: 'Missing signature headers' },
437
+ },
438
+ };
439
+ }
440
+ // Verify HMAC signature
441
+ const payload = `${timestamp}.${JSON.stringify(body)}`;
442
+ const expectedSignature = crypto
443
+ .createHmac('sha256', webhookSecret)
444
+ .update(payload)
445
+ .digest('hex');
446
+ const signatureValue = signature.replace('sha256=', '');
447
+ if (signatureValue !== expectedSignature) {
448
+ return {
449
+ webhookResponse: {
450
+ status: 401,
451
+ body: { error: 'Invalid signature' },
452
+ },
453
+ };
454
+ }
455
+ // Check timestamp is recent (within 5 minutes)
456
+ const timestampNum = parseInt(timestamp, 10);
457
+ const now = Math.floor(Date.now() / 1000);
458
+ if (Math.abs(now - timestampNum) > 300) {
459
+ return {
460
+ webhookResponse: {
461
+ status: 401,
462
+ body: { error: 'Timestamp too old' },
463
+ },
464
+ };
465
+ }
466
+ }
467
+ // Extract payment and customer input data
468
+ const payment = body.payment || {};
469
+ const customerInput = body.input || body.customer_input || {};
470
+ // Return data to workflow
471
+ return {
472
+ workflowData: [
473
+ [
474
+ {
475
+ json: {
476
+ payment: {
477
+ txHash: payment.txHash || payment.tx_hash || '',
478
+ amount: payment.amount || 0,
479
+ currency: payment.currency || 'USDC',
480
+ payer: payment.payer || payment.payer_address || '',
481
+ network: payment.network || 'base',
482
+ timestamp: payment.timestamp || Date.now(),
483
+ },
484
+ input: customerInput,
485
+ metadata: {
486
+ checkoutId: webhookData.checkoutId,
487
+ receivedAt: new Date().toISOString(),
488
+ },
489
+ },
490
+ },
491
+ ],
492
+ ],
493
+ webhookResponse: {
494
+ status: 200,
495
+ body: { success: true },
496
+ },
497
+ };
498
+ }
499
+ }
500
+ exports.XPayTrigger = XPayTrigger;
501
+ //# sourceMappingURL=XPayTrigger.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XPayTrigger.node.js","sourceRoot":"","sources":["../../../nodes/XPayTrigger/XPayTrigger.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,+CAAiC;AAEjC,MAAa,WAAW;IAAxB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,gCAAgC;YAC1C,WAAW,EAAE,oFAAoF;YACjG,QAAQ,EAAE;gBACT,IAAI,EAAE,0BAA0B;aAChC;YACD,4CAA4C;YAC5C,iBAAiB,EAAE,8EAA8E;YACjG,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,MAA4B,CAAC;YACvC,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;o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AI,OAAO,CAAC,OAAO,IAAI,EAAE;gCAC/C,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC;gCAC3B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,MAAM;gCACpC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,aAAa,IAAI,EAAE;gCACnD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,MAAM;gCAClC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE;6BAC1C;4BACD,KAAK,EAAE,aAAa;4BACpB,QAAQ,EAAE;gCACT,UAAU,EAAE,WAAW,CAAC,UAAU;gCAClC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;6BACpC;yBACD;qBACD;iBACD;aACD;YACD,eAAe,EAAE;gBAChB,MAAM,EAAE,GAAG;gBACX,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;aACvB;SACD,CAAC;IACH,CAAC;CACD;AAxfD,kCAwfC"}
@@ -0,0 +1 @@
1
+ <svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="400" viewBox="0, 0, 400,400"><g id="svgg"><path id="path0" d="M114.306 48.412 C 87.701 50.111,66.237 66.237,60.142 89.104 C 58.355 95.811,58.316 96.530,58.014 128.800 C 57.690 163.352,57.837 161.580,54.794 167.614 C 48.834 179.436,42.377 183.055,26.400 183.532 L 17.400 183.800 17.294 196.973 C 17.212 207.245,17.300 210.217,17.694 210.467 C 17.972 210.643,21.350 210.794,25.200 210.801 C 39.396 210.827,46.491 215.090,52.642 227.287 C 57.576 237.071,57.706 238.244,58.027 275.800 C 58.336 312.037,58.409 312.964,61.623 321.553 C 70.557 345.432,92.355 357.615,126.400 357.757 L 136.600 357.800 136.600 344.200 L 136.600 330.600 124.000 330.365 C 104.968 330.011,96.132 326.570,89.819 317.054 C 85.438 310.451,85.520 311.215,85.204 274.200 C 84.913 240.076,84.920 240.208,82.779 231.324 C 80.059 220.037,73.691 207.549,67.064 200.505 C 65.569 198.915,65.200 198.288,65.534 197.905 C 65.776 197.627,67.473 195.849,69.307 193.954 C 76.424 186.596,81.112 177.739,83.893 166.400 L 84.923 162.200 85.200 130.800 C 85.502 96.518,85.410 97.813,87.932 92.275 C 90.919 85.714,97.156 80.450,105.182 77.716 C 110.936 75.755,112.601 75.553,124.905 75.323 L 136.811 75.100 136.705 61.650 L 136.600 48.200 127.800 48.156 C 122.960 48.132,116.888 48.247,114.306 48.412 M263.382 48.503 C 263.276 48.780,263.236 54.855,263.294 62.003 L 263.400 75.000 274.200 75.251 C 293.224 75.694,303.119 79.806,309.151 89.774 C 312.988 96.115,313.184 98.108,313.193 130.716 C 313.200 157.593,313.397 162.012,314.837 167.712 C 317.506 178.276,322.055 186.594,329.373 194.290 L 333.257 198.374 331.485 200.287 C 327.086 205.039,322.771 211.878,319.771 218.851 C 317.149 224.946,315.768 229.922,313.792 240.400 C 313.646 241.170,313.386 256.290,313.214 274.000 C 312.894 306.797,312.846 307.708,311.232 312.022 C 306.583 324.449,295.802 329.935,275.200 330.358 L 263.400 330.600 263.288 343.400 C 263.227 350.440,263.282 356.634,263.412 357.163 L 263.647 358.127 273.724 357.857 C 289.544 357.434,296.625 356.247,305.570 352.518 C 322.502 345.460,334.110 332.598,338.402 316.138 C 340.015 309.949,340.105 308.124,340.410 275.400 C 340.765 237.244,340.729 237.523,346.890 225.522 C 352.814 213.982,357.832 211.156,373.000 210.815 L 382.600 210.600 382.705 197.158 L 382.811 183.715 372.905 183.498 C 356.103 183.129,349.496 179.546,343.562 167.586 C 340.537 161.489,340.685 163.282,340.387 129.200 C 340.215 109.421,339.958 97.610,339.663 95.800 C 335.708 71.587,318.419 54.584,292.519 49.436 C 285.905 48.121,263.800 47.414,263.382 48.503 M151.212 225.068 C 151.669 225.802,151.663 226.048,151.176 226.668 C 150.648 227.339,150.659 227.354,151.300 226.851 C 152.179 226.162,152.191 225.455,151.336 224.749 C 150.730 224.249,150.719 224.277,151.212 225.068 " stroke="none" fill="#00DC9C" fill-rule="evenodd"></path><path id="path2" d="M102.228 163.245 C 102.537 163.745,144.487 216.255,148.936 221.712 C 150.511 223.643,151.853 225.378,151.919 225.567 C 152.021 225.866,144.438 235.449,109.529 279.132 C 105.604 284.044,102.494 288.229,102.619 288.432 C 103.093 289.197,124.612 288.886,125.524 288.100 C 125.971 287.715,131.353 281.100,137.484 273.400 C 143.615 265.700,151.144 256.269,154.216 252.441 C 157.287 248.614,160.610 244.431,161.600 243.146 C 162.590 241.861,163.608 240.853,163.862 240.905 C 164.115 240.957,172.353 251.080,182.168 263.400 C 191.982 275.720,200.608 286.475,201.337 287.300 L 202.662 288.800 213.931 288.800 C 220.760 288.800,225.200 288.651,225.200 288.421 C 225.200 288.213,223.073 285.378,220.474 282.121 C 217.875 278.864,209.297 268.100,201.414 258.200 C 193.530 248.300,186.418 239.390,185.609 238.400 C 183.156 235.398,177.832 228.695,176.626 227.091 L 175.491 225.581 177.075 223.691 C 178.610 221.859,189.369 208.470,213.307 178.600 C 219.655 170.680,225.023 163.885,225.238 163.500 C 225.606 162.840,224.959 162.800,214.061 162.800 L 202.495 162.800 189.347 179.282 C 182.116 188.347,175.247 196.942,174.082 198.382 C 172.917 199.822,170.231 203.205,168.113 205.900 C 165.995 208.595,164.068 210.791,163.831 210.781 C 163.363 210.760,162.201 209.348,151.008 195.200 C 146.918 190.030,142.893 184.990,142.064 184.000 C 141.235 183.010,138.860 180.040,136.786 177.400 C 134.713 174.760,132.832 172.403,132.608 172.162 C 132.384 171.921,130.622 169.716,128.692 167.262 L 125.185 162.800 113.569 162.800 C 105.146 162.800,102.028 162.922,102.228 163.245 " stroke="none" fill="#0F1C4D" fill-rule="evenodd"></path><path id="path3" d="M244.000 88.248 C 244.000 91.323,241.601 105.263,239.948 111.800 C 235.652 128.783,226.466 135.833,204.000 139.392 C 201.690 139.758,198.225 140.314,196.300 140.628 C 194.375 140.943,192.395 141.203,191.900 141.206 C 188.573 141.229,189.690 142.393,193.468 142.841 C 231.033 147.294,237.784 153.752,243.311 190.517 C 244.170 196.236,244.885 198.100,245.107 195.200 C 245.479 190.344,247.874 176.957,249.258 172.000 C 254.547 153.056,262.950 147.412,291.800 143.422 C 299.065 142.417,299.200 142.391,299.200 141.989 C 299.200 141.544,298.766 141.449,292.800 140.594 C 257.156 135.481,250.781 129.129,245.939 93.900 C 245.296 89.227,244.864 87.200,244.509 87.200 C 244.227 87.200,244.000 87.667,244.000 88.248 " stroke="none" fill="#ffb400" fill-rule="evenodd"></path></g></svg>
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@xpaysh/n8n-nodes-xpay",
3
+ "version": "0.1.0",
4
+ "description": "Monetize your n8n workflows with xpay✦ payments. Create pay-to-run workflows in 60 seconds.",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "n8n",
8
+ "payments",
9
+ "usdc",
10
+ "base",
11
+ "paywall",
12
+ "monetization",
13
+ "pay-to-run",
14
+ "xpay"
15
+ ],
16
+ "license": "MIT",
17
+ "author": {
18
+ "name": "xpay✦ Team",
19
+ "email": "xpaysh@gmail.com"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/xpay-sh/n8n-nodes-xpay.git"
24
+ },
25
+ "homepage": "https://xpay.sh",
26
+ "main": "dist/index.js",
27
+ "scripts": {
28
+ "build": "tsc && npm run copy-icons",
29
+ "copy-icons": "cp nodes/XPayTrigger/xpay.svg dist/nodes/XPayTrigger/",
30
+ "lint": "eslint nodes credentials --ext .ts",
31
+ "lint:fix": "eslint nodes credentials --ext .ts --fix",
32
+ "prepublishOnly": "npm run build"
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "n8n": {
38
+ "n8nNodesApiVersion": 1,
39
+ "credentials": [
40
+ "dist/credentials/XPayApi.credentials.js"
41
+ ],
42
+ "nodes": [
43
+ "dist/nodes/XPayTrigger/XPayTrigger.node.js"
44
+ ]
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^22.0.0",
48
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
49
+ "@typescript-eslint/parser": "^8.0.0",
50
+ "eslint": "^9.0.0",
51
+ "n8n-workflow": "^1.70.0",
52
+ "typescript": "^5.7.0"
53
+ },
54
+ "peerDependencies": {
55
+ "n8n-workflow": ">=1.70.0"
56
+ }
57
+ }