@one-payments/web-components 1.1.31 → 1.2.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/dist/index.js +550 -464
- package/dist/one-payment.browser.iife.js +4 -42
- package/dist/one-payment.browser.iife.js.map +1 -1
- package/dist/one-payment.d.ts +63 -1
- package/dist/one-payment.d.ts.map +1 -1
- package/dist/one-payment.js +316 -184
- package/dist/one-payment.js.map +1 -1
- package/docs/appearance-prop-implementation-plan.md +457 -0
- package/docs/shopify-checkout-integration-analysis.md +496 -0
- package/docs/wix-checkout-integration-analysis.md +695 -0
- package/package.json +3 -3
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
# Wix Checkout Integration Analysis for One Payments Drop-in Element
|
|
2
|
+
|
|
3
|
+
## Executive Summary
|
|
4
|
+
|
|
5
|
+
**Can you integrate a custom Drop-in payment element into Wix websites?**
|
|
6
|
+
|
|
7
|
+
| Scenario | Feasibility | Requirements |
|
|
8
|
+
|----------|-------------|--------------|
|
|
9
|
+
| Individual Site (Velo) | **YES - POSSIBLE** | Premium plan, Velo coding, hosted payment page |
|
|
10
|
+
| Wix App Market (All Sites) | **POSSIBLE** | PSP onboarding with Wix, REST API implementation |
|
|
11
|
+
| Direct Checkout Embed | **LIMITED** | Redirect flow required, no direct embed in native checkout |
|
|
12
|
+
|
|
13
|
+
**Bottom Line**: Wix is **significantly more flexible** than Shopify for custom payment integration. Individual site owners can integrate custom payment providers using Velo, and payment service providers can apply to offer services across all Wix sites through the PSP program.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Table of Contents
|
|
18
|
+
|
|
19
|
+
1. [Wix Payment Architecture Overview](#1-wix-payment-architecture-overview)
|
|
20
|
+
2. [Integration Option 1: Velo Service Plugin (Individual Sites)](#2-integration-option-1-velo-service-plugin-individual-sites)
|
|
21
|
+
3. [Integration Option 2: REST PSP Plugin (App Market)](#3-integration-option-2-rest-psp-plugin-app-market)
|
|
22
|
+
4. [Technical Implementation Details](#4-technical-implementation-details)
|
|
23
|
+
5. [Comparison: Wix vs Shopify](#5-comparison-wix-vs-shopify)
|
|
24
|
+
6. [Feasibility for One Payments Drop-in](#6-feasibility-for-one-payments-drop-in)
|
|
25
|
+
7. [Recommended Integration Approach](#7-recommended-integration-approach)
|
|
26
|
+
8. [Implementation Guide](#8-implementation-guide)
|
|
27
|
+
9. [Conclusion & Next Steps](#9-conclusion--next-steps)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 1. Wix Payment Architecture Overview
|
|
32
|
+
|
|
33
|
+
### How Wix Payments Work
|
|
34
|
+
|
|
35
|
+
Unlike Shopify's locked-down checkout, Wix provides **two pathways** for custom payment integration:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
39
|
+
│ WIX PAYMENT OPTIONS │
|
|
40
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
41
|
+
│ │
|
|
42
|
+
│ ┌─────────────────────┐ ┌─────────────────────────────┐ │
|
|
43
|
+
│ │ VELO SERVICE │ │ REST PSP PLUGIN │ │
|
|
44
|
+
│ │ PLUGIN │ │ (App Market) │ │
|
|
45
|
+
│ │ │ │ │ │
|
|
46
|
+
│ │ • For own sites │ │ • For all Wix sites │ │
|
|
47
|
+
│ │ • No approval needed│ │ • Requires Wix onboarding │ │
|
|
48
|
+
│ │ • Hosted page flow │ │ • Full PSP integration │ │
|
|
49
|
+
│ │ • Custom code │ │ • Official payment option │ │
|
|
50
|
+
│ └─────────────────────┘ └─────────────────────────────┘ │
|
|
51
|
+
│ │
|
|
52
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Supported Payment Methods
|
|
56
|
+
|
|
57
|
+
Wix's infrastructure supports:
|
|
58
|
+
- Credit/Debit Cards (with 3DS2/PSD2 compliance)
|
|
59
|
+
- Digital Wallets (Apple Pay, Google Pay, etc.)
|
|
60
|
+
- Buy Now Pay Later (Klarna, Afterpay, etc.)
|
|
61
|
+
- Bank Transfers
|
|
62
|
+
- Cryptocurrency
|
|
63
|
+
- Local Payment Methods
|
|
64
|
+
- **Hosted Payment Pages** ← Key for Drop-in integration
|
|
65
|
+
|
|
66
|
+
### Plan Requirements
|
|
67
|
+
|
|
68
|
+
| Feature | Free Plan | Premium Plans |
|
|
69
|
+
|---------|-----------|---------------|
|
|
70
|
+
| Accept Payments | ❌ | ✅ |
|
|
71
|
+
| Custom Payment Provider (Velo) | ❌ | ✅ |
|
|
72
|
+
| Multiple Payment Methods | ❌ | ✅ |
|
|
73
|
+
| eCommerce Checkout | ❌ | ✅ Business/eCommerce |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 2. Integration Option 1: Velo Service Plugin (Individual Sites)
|
|
78
|
+
|
|
79
|
+
### Overview
|
|
80
|
+
|
|
81
|
+
The **Payment Provider Service Plugin** allows Wix site owners to integrate **any payment provider** with their own sites using Velo (Wix's development platform).
|
|
82
|
+
|
|
83
|
+
### Key Characteristics
|
|
84
|
+
|
|
85
|
+
| Aspect | Details |
|
|
86
|
+
|--------|---------|
|
|
87
|
+
| **Availability** | Any Wix Premium site with Velo enabled |
|
|
88
|
+
| **Approval Required** | ❌ No Wix approval needed |
|
|
89
|
+
| **App Market** | ❌ Cannot be published to App Market |
|
|
90
|
+
| **Scope** | Own sites only |
|
|
91
|
+
| **Payment Flow** | Hosted page (redirect) |
|
|
92
|
+
| **Development** | JavaScript/Velo code |
|
|
93
|
+
|
|
94
|
+
### How It Works
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Customer Journey with Velo Plugin:
|
|
98
|
+
|
|
99
|
+
┌──────────┐ ┌──────────┐ ┌───────────────────┐ ┌──────────┐
|
|
100
|
+
│ Wix │ -> │ Checkout │ -> │ One Payments │ -> │ Order │
|
|
101
|
+
│ Store │ │ Page │ │ Hosted Page │ │ Complete │
|
|
102
|
+
└──────────┘ └──────────┘ │ (with Drop-in) │ └──────────┘
|
|
103
|
+
└───────────────────┘
|
|
104
|
+
│
|
|
105
|
+
▼
|
|
106
|
+
┌───────────────────┐
|
|
107
|
+
│ Webhook to Wix │
|
|
108
|
+
│ (submitEvent) │
|
|
109
|
+
└───────────────────┘
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Required Implementation Files
|
|
113
|
+
|
|
114
|
+
#### 1. Configuration File (`payment-provider-config.js`)
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
// payment-provider-config.js
|
|
118
|
+
export function getConfig() {
|
|
119
|
+
return {
|
|
120
|
+
title: "One Payments",
|
|
121
|
+
|
|
122
|
+
paymentMethods: [
|
|
123
|
+
{
|
|
124
|
+
hostedPage: {
|
|
125
|
+
// Billing address fields required
|
|
126
|
+
billingAddressMandatoryFields: [
|
|
127
|
+
"EMAIL",
|
|
128
|
+
"FIRST_NAME",
|
|
129
|
+
"LAST_NAME",
|
|
130
|
+
"COUNTRY",
|
|
131
|
+
"ZIP_CODE"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
|
|
137
|
+
credentialsFields: [
|
|
138
|
+
{
|
|
139
|
+
simpleField: {
|
|
140
|
+
name: "apiKey",
|
|
141
|
+
label: "One Payments API Key"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
simpleField: {
|
|
146
|
+
name: "merchantId",
|
|
147
|
+
label: "Merchant ID"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
dropdownField: {
|
|
152
|
+
name: "environment",
|
|
153
|
+
label: "Environment",
|
|
154
|
+
options: [
|
|
155
|
+
{ value: "prod", label: "Production" },
|
|
156
|
+
{ value: "demo", label: "Demo/Sandbox" }
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### 2. Plugin Implementation (`payment-provider.js`)
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
// payment-provider.js
|
|
169
|
+
import { fetch } from 'wix-fetch';
|
|
170
|
+
|
|
171
|
+
// Called when merchant connects their account
|
|
172
|
+
export async function connectAccount(options) {
|
|
173
|
+
const { credentials, country, currency } = options;
|
|
174
|
+
|
|
175
|
+
try {
|
|
176
|
+
// Validate credentials with One Payments API
|
|
177
|
+
const response = await fetch('https://public.prod.one.ooo/validate-credentials', {
|
|
178
|
+
method: 'POST',
|
|
179
|
+
headers: { 'Content-Type': 'application/json' },
|
|
180
|
+
body: JSON.stringify({
|
|
181
|
+
apiKey: credentials.apiKey,
|
|
182
|
+
merchantId: credentials.merchantId
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
if (response.ok) {
|
|
187
|
+
return {
|
|
188
|
+
credentials: {
|
|
189
|
+
apiKey: credentials.apiKey,
|
|
190
|
+
merchantId: credentials.merchantId,
|
|
191
|
+
environment: credentials.environment
|
|
192
|
+
},
|
|
193
|
+
accountId: credentials.merchantId,
|
|
194
|
+
accountName: "One Payments Account"
|
|
195
|
+
};
|
|
196
|
+
} else {
|
|
197
|
+
return {
|
|
198
|
+
errorCode: -1,
|
|
199
|
+
errorMessage: "Invalid credentials"
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
} catch (error) {
|
|
203
|
+
return {
|
|
204
|
+
errorCode: -1,
|
|
205
|
+
errorMessage: error.message
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Called at checkout to create transaction
|
|
211
|
+
export async function createTransaction(options) {
|
|
212
|
+
const {
|
|
213
|
+
wixTransactionId,
|
|
214
|
+
merchantCredentials,
|
|
215
|
+
order,
|
|
216
|
+
paymentMethod
|
|
217
|
+
} = options;
|
|
218
|
+
|
|
219
|
+
// Generate unique transaction ID
|
|
220
|
+
const pluginTransactionId = `one_${wixTransactionId}_${Date.now()}`;
|
|
221
|
+
|
|
222
|
+
// Build redirect URL to hosted payment page
|
|
223
|
+
const baseUrl = merchantCredentials.environment === 'prod'
|
|
224
|
+
? 'https://checkout.one.ooo'
|
|
225
|
+
: 'https://checkout.demo.one.ooo';
|
|
226
|
+
|
|
227
|
+
const params = new URLSearchParams({
|
|
228
|
+
orderId: pluginTransactionId,
|
|
229
|
+
amount: order.description.totalAmount,
|
|
230
|
+
currency: order.description.currency,
|
|
231
|
+
merchantId: merchantCredentials.merchantId,
|
|
232
|
+
returnUrl: order.returnUrls.successUrl,
|
|
233
|
+
cancelUrl: order.returnUrls.cancelUrl,
|
|
234
|
+
webhookUrl: order.returnUrls.pendingUrl, // Use for webhook
|
|
235
|
+
customerEmail: order.description.billingAddress?.email,
|
|
236
|
+
customerName: `${order.description.billingAddress?.firstName} ${order.description.billingAddress?.lastName}`
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
pluginTransactionId,
|
|
241
|
+
redirectUrl: `${baseUrl}/pay?${params.toString()}`
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Called for refunds
|
|
246
|
+
export async function refundTransaction(options) {
|
|
247
|
+
const {
|
|
248
|
+
pluginTransactionId,
|
|
249
|
+
merchantCredentials,
|
|
250
|
+
refundAmount
|
|
251
|
+
} = options;
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const response = await fetch('https://public.prod.one.ooo/refund', {
|
|
255
|
+
method: 'POST',
|
|
256
|
+
headers: {
|
|
257
|
+
'Content-Type': 'application/json',
|
|
258
|
+
'Authorization': `Bearer ${merchantCredentials.apiKey}`
|
|
259
|
+
},
|
|
260
|
+
body: JSON.stringify({
|
|
261
|
+
transactionId: pluginTransactionId,
|
|
262
|
+
amount: refundAmount
|
|
263
|
+
})
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
const result = await response.json();
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
pluginRefundId: result.refundId
|
|
270
|
+
};
|
|
271
|
+
} catch (error) {
|
|
272
|
+
return {
|
|
273
|
+
errorCode: -1,
|
|
274
|
+
errorMessage: error.message
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### 3. Webhook Handler (`http-functions.js`)
|
|
281
|
+
|
|
282
|
+
```javascript
|
|
283
|
+
// backend/http-functions.js
|
|
284
|
+
import { ok, badRequest } from 'wix-http-functions';
|
|
285
|
+
import { paymentProvider } from 'wix-payment-provider-backend';
|
|
286
|
+
|
|
287
|
+
// Webhook endpoint: https://[your-site]/_functions/onePaymentsWebhook
|
|
288
|
+
export async function post_onePaymentsWebhook(request) {
|
|
289
|
+
try {
|
|
290
|
+
const body = await request.body.json();
|
|
291
|
+
|
|
292
|
+
const {
|
|
293
|
+
transactionId,
|
|
294
|
+
status,
|
|
295
|
+
wixTransactionId
|
|
296
|
+
} = body;
|
|
297
|
+
|
|
298
|
+
// Map One Payments status to Wix status
|
|
299
|
+
const eventType = status === 'completed'
|
|
300
|
+
? 'Approved'
|
|
301
|
+
: status === 'failed'
|
|
302
|
+
? 'Declined'
|
|
303
|
+
: 'Pending';
|
|
304
|
+
|
|
305
|
+
// Notify Wix about the transaction status
|
|
306
|
+
await paymentProvider.submitEvent({
|
|
307
|
+
event: {
|
|
308
|
+
transaction: {
|
|
309
|
+
wixTransactionId,
|
|
310
|
+
pluginTransactionId: transactionId,
|
|
311
|
+
eventType
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
return ok({ received: true });
|
|
317
|
+
} catch (error) {
|
|
318
|
+
return badRequest({ error: error.message });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Advantages of Velo Approach
|
|
324
|
+
|
|
325
|
+
| Advantage | Description |
|
|
326
|
+
|-----------|-------------|
|
|
327
|
+
| **No Approval Needed** | Site owners can implement immediately |
|
|
328
|
+
| **Full Control** | Complete customization of payment flow |
|
|
329
|
+
| **Hosted Page Support** | Perfect for Drop-in integration |
|
|
330
|
+
| **Quick Implementation** | Days/weeks, not months |
|
|
331
|
+
| **Direct Integration** | No middleman required |
|
|
332
|
+
|
|
333
|
+
### Limitations
|
|
334
|
+
|
|
335
|
+
| Limitation | Impact |
|
|
336
|
+
|------------|--------|
|
|
337
|
+
| **Own Sites Only** | Cannot distribute to other Wix users |
|
|
338
|
+
| **Requires Coding** | Site owner needs Velo knowledge |
|
|
339
|
+
| **Premium Required** | Need paid Wix plan |
|
|
340
|
+
| **Hosted Page Only** | Cannot embed directly in Wix checkout |
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## 3. Integration Option 2: REST PSP Plugin (App Market)
|
|
345
|
+
|
|
346
|
+
### Overview
|
|
347
|
+
|
|
348
|
+
For payment service providers who want to offer their services to **all Wix merchants**, there's the REST Payment Service Provider plugin program.
|
|
349
|
+
|
|
350
|
+
### Requirements
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
354
|
+
│ PSP ONBOARDING REQUIREMENTS │
|
|
355
|
+
├─────────────────────────────────────────────────────────────┤
|
|
356
|
+
│ │
|
|
357
|
+
│ 1. Fill out application form at: │
|
|
358
|
+
│ https://www.wix-providerplatform.com/ │
|
|
359
|
+
│ │
|
|
360
|
+
│ 2. Complete business development onboarding │
|
|
361
|
+
│ │
|
|
362
|
+
│ 3. Implement required REST endpoints: │
|
|
363
|
+
│ • Connect Account │
|
|
364
|
+
│ • Create Transaction │
|
|
365
|
+
│ • Refund Transaction │
|
|
366
|
+
│ • (Optional) Capture Transaction │
|
|
367
|
+
│ • (Optional) Void Transaction │
|
|
368
|
+
│ │
|
|
369
|
+
│ 4. Implement webhook handling (Submit Event API) │
|
|
370
|
+
│ │
|
|
371
|
+
│ 5. Support PSD2/3DS2 compliance │
|
|
372
|
+
│ │
|
|
373
|
+
│ 6. Create Wix App in App Dashboard │
|
|
374
|
+
│ │
|
|
375
|
+
│ 7. Pass Wix review and testing │
|
|
376
|
+
│ │
|
|
377
|
+
└─────────────────────────────────────────────────────────────┘
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Required Endpoints
|
|
381
|
+
|
|
382
|
+
| Endpoint | Purpose | When Called |
|
|
383
|
+
|----------|---------|-------------|
|
|
384
|
+
| **Connect Account** | Merchant onboarding | Merchant connects provider |
|
|
385
|
+
| **Create Transaction** | Process payment | Buyer initiates payment |
|
|
386
|
+
| **Refund Transaction** | Process refund | Merchant initiates refund |
|
|
387
|
+
| **Capture Transaction** | Capture authorized payment | Optional: Auth-capture flow |
|
|
388
|
+
| **Void Transaction** | Cancel authorization | Optional: Void payment |
|
|
389
|
+
|
|
390
|
+
### Webhook Events
|
|
391
|
+
|
|
392
|
+
PSPs must send webhooks to Wix using the Submit Event API to notify about:
|
|
393
|
+
- Transaction approval/decline
|
|
394
|
+
- Refund completion/failure
|
|
395
|
+
- Chargeback notifications
|
|
396
|
+
- Status updates
|
|
397
|
+
|
|
398
|
+
### Supported Features
|
|
399
|
+
|
|
400
|
+
| Feature | Support |
|
|
401
|
+
|---------|---------|
|
|
402
|
+
| Credit Cards | ✅ Full support |
|
|
403
|
+
| 3DS2/PSD2 | ✅ Required for cards |
|
|
404
|
+
| Alternative Payments | ✅ Supported |
|
|
405
|
+
| Multi-currency | ✅ Supported |
|
|
406
|
+
| Auth-Capture | ✅ Optional |
|
|
407
|
+
| Refunds | ✅ Required |
|
|
408
|
+
| Partial Refunds | ✅ Supported |
|
|
409
|
+
|
|
410
|
+
### Timeline & Process
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
Week 1-2: Submit application at wix-providerplatform.com
|
|
414
|
+
Week 2-4: Business development discussions
|
|
415
|
+
Week 4-8: Technical integration development
|
|
416
|
+
Week 8-10: Testing and validation
|
|
417
|
+
Week 10-12: Wix review and approval
|
|
418
|
+
Week 12+: Launch in Wix App Market
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## 4. Technical Implementation Details
|
|
424
|
+
|
|
425
|
+
### Hosted Payment Page Flow
|
|
426
|
+
|
|
427
|
+
This is the recommended flow for One Payments Drop-in integration:
|
|
428
|
+
|
|
429
|
+
```
|
|
430
|
+
┌──────────────────────────────────────────────────────────────────┐
|
|
431
|
+
│ HOSTED PAGE PAYMENT FLOW │
|
|
432
|
+
└──────────────────────────────────────────────────────────────────┘
|
|
433
|
+
|
|
434
|
+
Step 1: Customer clicks "Pay" on Wix checkout
|
|
435
|
+
│
|
|
436
|
+
▼
|
|
437
|
+
Step 2: Wix calls createTransaction()
|
|
438
|
+
│
|
|
439
|
+
▼
|
|
440
|
+
Step 3: Your code returns { redirectUrl: "https://checkout.one.ooo/pay?..." }
|
|
441
|
+
│
|
|
442
|
+
▼
|
|
443
|
+
Step 4: Customer is redirected to hosted payment page
|
|
444
|
+
│
|
|
445
|
+
▼
|
|
446
|
+
Step 5: Customer sees One Payments Drop-in element
|
|
447
|
+
│
|
|
448
|
+
▼
|
|
449
|
+
Step 6: Customer completes payment
|
|
450
|
+
│
|
|
451
|
+
▼
|
|
452
|
+
Step 7: One Payments sends webhook to Wix (submitEvent)
|
|
453
|
+
│
|
|
454
|
+
▼
|
|
455
|
+
Step 8: Customer is redirected back to Wix success page
|
|
456
|
+
│
|
|
457
|
+
▼
|
|
458
|
+
Step 9: Order is marked as paid in Wix dashboard
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Hosted Payment Page Implementation
|
|
462
|
+
|
|
463
|
+
You'll need to create a hosted checkout page that includes the Drop-in:
|
|
464
|
+
|
|
465
|
+
```html
|
|
466
|
+
<!-- checkout.one.ooo/pay -->
|
|
467
|
+
<!DOCTYPE html>
|
|
468
|
+
<html>
|
|
469
|
+
<head>
|
|
470
|
+
<title>Complete Your Payment</title>
|
|
471
|
+
<script src="https://cdn.jsdelivr.net/npm/@one-payments/web-components@latest/dist/one-payment.browser.iife.js"></script>
|
|
472
|
+
</head>
|
|
473
|
+
<body>
|
|
474
|
+
<div class="checkout-container">
|
|
475
|
+
<h1>Complete Your Payment</h1>
|
|
476
|
+
|
|
477
|
+
<one-payment
|
|
478
|
+
id="payment-element"
|
|
479
|
+
amount=""
|
|
480
|
+
currency=""
|
|
481
|
+
order-id=""
|
|
482
|
+
first-name=""
|
|
483
|
+
last-name=""
|
|
484
|
+
email="">
|
|
485
|
+
</one-payment>
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
<script>
|
|
489
|
+
// Parse URL parameters
|
|
490
|
+
const params = new URLSearchParams(window.location.search);
|
|
491
|
+
|
|
492
|
+
// Configure element
|
|
493
|
+
const element = document.getElementById('payment-element');
|
|
494
|
+
element.amount = params.get('amount');
|
|
495
|
+
element.currency = params.get('currency');
|
|
496
|
+
element.orderId = params.get('orderId');
|
|
497
|
+
element.firstName = params.get('customerName')?.split(' ')[0] || '';
|
|
498
|
+
element.lastName = params.get('customerName')?.split(' ').slice(1).join(' ') || '';
|
|
499
|
+
element.email = params.get('customerEmail');
|
|
500
|
+
|
|
501
|
+
// Configure adapters and config
|
|
502
|
+
element.adapters = OnePayments.createWebAdapters();
|
|
503
|
+
element.config = {
|
|
504
|
+
apiKey: 'YOUR_API_KEY',
|
|
505
|
+
environment: 'prod'
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
// Handle payment completion
|
|
509
|
+
element.addEventListener('payment-success', async (e) => {
|
|
510
|
+
// Send webhook to Wix
|
|
511
|
+
await fetch(params.get('webhookUrl'), {
|
|
512
|
+
method: 'POST',
|
|
513
|
+
headers: { 'Content-Type': 'application/json' },
|
|
514
|
+
body: JSON.stringify({
|
|
515
|
+
transactionId: params.get('orderId'),
|
|
516
|
+
status: 'completed',
|
|
517
|
+
wixTransactionId: params.get('wixTransactionId')
|
|
518
|
+
})
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// Redirect to success page
|
|
522
|
+
window.location.href = params.get('returnUrl');
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
element.addEventListener('payment-error', () => {
|
|
526
|
+
window.location.href = params.get('cancelUrl');
|
|
527
|
+
});
|
|
528
|
+
</script>
|
|
529
|
+
</body>
|
|
530
|
+
</html>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
## 5. Comparison: Wix vs Shopify
|
|
536
|
+
|
|
537
|
+
| Aspect | Wix | Shopify |
|
|
538
|
+
|--------|-----|---------|
|
|
539
|
+
| **Individual Site Integration** | ✅ Possible via Velo | ❌ Not possible |
|
|
540
|
+
| **Approval Required (Own Site)** | ❌ No | N/A |
|
|
541
|
+
| **Custom Payment Provider** | ✅ Yes (Velo plugin) | ❌ Only via Partner Program |
|
|
542
|
+
| **Hosted Page Support** | ✅ Yes | ❌ Sandboxed |
|
|
543
|
+
| **App Market Distribution** | ✅ Via PSP program | ✅ Via Partner Program |
|
|
544
|
+
| **Time to First Integration** | Days/Weeks | Months |
|
|
545
|
+
| **Coding Required** | ✅ Velo/JavaScript | ✅ Shopify-specific |
|
|
546
|
+
| **Direct Checkout Embed** | ❌ Redirect only | ❌ Sandboxed only |
|
|
547
|
+
| **Plan Requirements** | Premium | Plus ($2000+/mo) for extensions |
|
|
548
|
+
|
|
549
|
+
### Key Difference
|
|
550
|
+
|
|
551
|
+
> **Wix allows individual site owners to add custom payment providers themselves.**
|
|
552
|
+
>
|
|
553
|
+
> Shopify requires becoming an approved Payments Partner, which takes months and has strict requirements.
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## 6. Feasibility for One Payments Drop-in
|
|
558
|
+
|
|
559
|
+
### Can It Be Done?
|
|
560
|
+
|
|
561
|
+
| Integration Type | Feasible? | Effort |
|
|
562
|
+
|-----------------|-----------|--------|
|
|
563
|
+
| Velo Plugin (hosted page redirect) | ✅ **YES** | Medium |
|
|
564
|
+
| Direct embed in Wix checkout | ❌ No | N/A |
|
|
565
|
+
| App Market PSP integration | ✅ **YES** | High |
|
|
566
|
+
| Wix Stores native checkout | ❌ Redirect only | N/A |
|
|
567
|
+
|
|
568
|
+
### Recommended Approach
|
|
569
|
+
|
|
570
|
+
**For immediate integration**: Use the Velo Service Plugin with a hosted payment page containing the Drop-in element.
|
|
571
|
+
|
|
572
|
+
**For broad distribution**: Apply to Wix's PSP program to offer One Payments in the Wix App Market.
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## 7. Recommended Integration Approach
|
|
577
|
+
|
|
578
|
+
### Phase 1: Hosted Payment Page (Immediate)
|
|
579
|
+
|
|
580
|
+
Create a hosted checkout page at `checkout.one.ooo` (or similar) that:
|
|
581
|
+
|
|
582
|
+
1. Receives order details via URL parameters
|
|
583
|
+
2. Displays the One Payments Drop-in
|
|
584
|
+
3. Processes payment
|
|
585
|
+
4. Sends webhook to Wix
|
|
586
|
+
5. Redirects customer back to Wix
|
|
587
|
+
|
|
588
|
+
**Timeline**: 1-2 weeks
|
|
589
|
+
|
|
590
|
+
### Phase 2: Velo Plugin Template (Short-term)
|
|
591
|
+
|
|
592
|
+
Create a ready-to-use Velo plugin template that Wix merchants can:
|
|
593
|
+
|
|
594
|
+
1. Copy into their Wix site
|
|
595
|
+
2. Configure with their One Payments credentials
|
|
596
|
+
3. Immediately accept payments
|
|
597
|
+
|
|
598
|
+
**Timeline**: 2-4 weeks
|
|
599
|
+
|
|
600
|
+
### Phase 3: Wix App Market (Long-term)
|
|
601
|
+
|
|
602
|
+
Apply to Wix's PSP program to:
|
|
603
|
+
|
|
604
|
+
1. Offer One Payments as official payment option
|
|
605
|
+
2. Appear in Wix payment provider list
|
|
606
|
+
3. Enable one-click setup for merchants
|
|
607
|
+
|
|
608
|
+
**Timeline**: 2-4 months
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
## 8. Implementation Guide
|
|
613
|
+
|
|
614
|
+
### For Wix Merchants
|
|
615
|
+
|
|
616
|
+
#### Step 1: Set Up Hosted Payment Page
|
|
617
|
+
|
|
618
|
+
Contact One Payments to get access to the hosted checkout page, or host your own using the template above.
|
|
619
|
+
|
|
620
|
+
#### Step 2: Create Velo Service Plugin
|
|
621
|
+
|
|
622
|
+
1. Open your Wix site in the Editor
|
|
623
|
+
2. Enable Developer Mode (Dev Mode toggle)
|
|
624
|
+
3. Go to Code Files → Service Plugins
|
|
625
|
+
4. Add new Payment Provider plugin
|
|
626
|
+
5. Copy the configuration and plugin code from section 2
|
|
627
|
+
|
|
628
|
+
#### Step 3: Deploy and Test
|
|
629
|
+
|
|
630
|
+
1. Publish your site
|
|
631
|
+
2. Go to Dashboard → Accept Payments
|
|
632
|
+
3. Find and connect "One Payments"
|
|
633
|
+
4. Enter your API credentials
|
|
634
|
+
5. Test with a small transaction
|
|
635
|
+
|
|
636
|
+
### For One Payments Team
|
|
637
|
+
|
|
638
|
+
#### Immediate Actions
|
|
639
|
+
|
|
640
|
+
1. **Create hosted checkout page** at `checkout.one.ooo/pay`
|
|
641
|
+
2. **Document the integration** for Wix merchants
|
|
642
|
+
3. **Create Velo plugin template** (copy-paste ready)
|
|
643
|
+
4. **Set up webhook endpoints** to handle Wix callbacks
|
|
644
|
+
|
|
645
|
+
#### Long-term Actions
|
|
646
|
+
|
|
647
|
+
1. **Apply to Wix PSP program** at https://www.wix-providerplatform.com/
|
|
648
|
+
2. **Implement REST endpoints** per Wix specifications
|
|
649
|
+
3. **Complete Wix onboarding** process
|
|
650
|
+
4. **Launch in App Market**
|
|
651
|
+
|
|
652
|
+
---
|
|
653
|
+
|
|
654
|
+
## 9. Conclusion & Next Steps
|
|
655
|
+
|
|
656
|
+
### Summary
|
|
657
|
+
|
|
658
|
+
| Question | Answer |
|
|
659
|
+
|----------|--------|
|
|
660
|
+
| Can we integrate with Wix? | **YES** |
|
|
661
|
+
| Can individual merchants do it? | **YES** (via Velo) |
|
|
662
|
+
| Is it easier than Shopify? | **YES** (significantly) |
|
|
663
|
+
| Can we use the Drop-in? | **YES** (via hosted page) |
|
|
664
|
+
| Can we reach all Wix users? | **YES** (via PSP program) |
|
|
665
|
+
|
|
666
|
+
### Immediate Next Steps
|
|
667
|
+
|
|
668
|
+
1. **Create hosted payment page** for Wix redirect flow
|
|
669
|
+
2. **Write Velo plugin template** for easy merchant setup
|
|
670
|
+
3. **Document the integration process** for merchants
|
|
671
|
+
4. **Apply to Wix PSP program** for App Market presence
|
|
672
|
+
|
|
673
|
+
### Key Advantages of Wix Integration
|
|
674
|
+
|
|
675
|
+
1. **No approval needed** for individual site integration
|
|
676
|
+
2. **Faster time-to-market** than Shopify
|
|
677
|
+
3. **Broader accessibility** (any Premium site can use it)
|
|
678
|
+
4. **Clear path to App Market** via PSP program
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## References & Sources
|
|
683
|
+
|
|
684
|
+
- [Wix Payment Provider Service Plugin Tutorial](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-pay/tutorial-payment-provider-service-plugin)
|
|
685
|
+
- [Connecting Payment Providers - Wix Help](https://support.wix.com/en/article/connecting-a-payment-provider)
|
|
686
|
+
- [PSP Service Plugin Introduction](https://dev.wix.com/docs/api-reference/business-management/payments/service-plugins/payment-service-provider-service-plugin/introduction)
|
|
687
|
+
- [Wix Provider Platform Application](https://www.wix-providerplatform.com/)
|
|
688
|
+
- [Wix Velo Service Plugins Overview](https://dev.wix.com/docs/velo/articles/api-overview/service-plugins-spis)
|
|
689
|
+
- [eCommerce Payment Settings SPI](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/payments/payment-settings/payment-settings-integration-service-plugin/introduction)
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
*Document created: December 3, 2024*
|
|
694
|
+
*Last updated: December 3, 2024*
|
|
695
|
+
*Version: 1.0*
|