Wix (beta)
The integration is a Velo Payment Provider service plugin plus backend code you add to your site. It takes card payments through the OnCharge hosted checkout, keeps Wix orders in step with OnCharge, reports shipment tracking (OnCharge pays out once the carrier confirms delivery), refunds from the Wix dashboard, and serves the RUO compliance feed.
Requirements: a Wix premium plan that accepts payments, a connected custom domain (OnCharge accepts return URLs and webhooks only on registered domains), and Dev Mode. Wix allows this kind of plugin only on the owner's own site, not in the App Market.
How it plugs into Wix#
| Wix calls | When | The integration |
|---|---|---|
connectAccount() | You select Connect under Accept Payments | Checks the API key and secret with a signed request. |
createTransaction() | A buyer places an order | POST /api/v1/checkout/sessions (with the shipping address, line items and Idempotency-Key: wix-<transaction id>) and sends the buyer to the OnCharge checkout. |
refundTransaction() | You refund from the Orders page | POST /api/v1/refunds. |
Payment results reach Wix through an HTTP function that verifies the OnCharge webhook and updates the Wix transaction. Fulfillments are reported to POST /api/v1/shipments, with an hourly job resending numbers OnCharge could not judge yet.
Set up#
- Turn on Dev Mode in the Wix editor (Wix Studio has the code panel on by default).
- Add the payment plugin: Code sidebar → Public & Backend → Service Plugins → + → Payment, named
oncharge. Replace the generated files with the integration's. - Add the backend files from the integration package (
http-functions.js,events.js,jobs.configand theoncharge/folder), and install@wix/storesand@wix/essentials. - Create the CMS collection
OnChargeLogwith admin-only permissions (fieldskindanddata). It holds session IDs, handled webhook IDs, compliance nonces and pending tracking numbers; no card data or secrets. - Save the secrets in Developer Tools → Secrets Manager:
oncharge_api_key,oncharge_api_secret,oncharge_webhook_secretand, for RUO stores,oncharge_compliance_code. They are read only in backend code. - Edit
backend/oncharge/config.js: your site's domain, policy page paths and reviewer settings. - Publish the site. Service plugins, HTTP functions and backend events run only on the published site.
- In the OnCharge portal: register the site's domain under Security → Domains, and register
https://<your domain>/_functions/onchargeWebhookas the store's webhook URL. Save the signing secret it shows asoncharge_webhook_secret, then publish again. - Connect OnCharge in Wix: Dashboard → Settings → Accept Payments → See More Payment Options → OnCharge → Connect. OnCharge then appears at checkout as "Credit / Debit Card".
Endpoints#
Wix names an HTTP function after its exported JavaScript function, which cannot contain a hyphen, so the paths are camel case.
| URL | Purpose |
|---|---|
POST https://<domain>/_functions/onchargeWebhook | OnCharge webhooks |
GET https://<domain>/_functions/onchargeReturn | Return URL of each checkout session (signed state; redirects to the matching Wix page) |
GET https://<domain>/_functions/onchargeCompliance/proof | Compliance feed: ownership proof |
GET https://<domain>/_functions/onchargeCompliance/content | Compliance feed: catalogue (signed) |
GET https://<domain>/_functions/onchargeCompliance/reviewer-access | Compliance feed: reviewer login status (signed) |
Webhooks: payment.captured approves the Wix transaction after checking amount and currency; payment.pending, payment.refused and payment.cancelled set the matching Wix status; refund, chargeback and delivery events are logged. Refunds issued in the OnCharge portal are not mirrored into Wix.
RUO stores: compliance review#
In the OnCharge portal, add your host, choose Wix and set the feed base path to /_functions/onchargeCompliance. Save the connection code as oncharge_compliance_code, publish, then select Verify connection. For reviewer access, create a separate site member with the same access a verified buyer has, set its login email in config.js, sign in as it once to check it shows every product with its price, confirm it in config.js and publish.
Notes#
- All OnCharge API calls run in backend code, where the secrets are available. Page code never sees them.
- Use USPS, UPS, FedEx or DHL Express in Wix fulfillments so OnCharge can confirm delivery; other carriers are sent without a carrier name.