Skip to content

[Preview only] Wix embedded checkout (mirror of #386) - #390

Draft
amitbardos wants to merge 12 commits into
mainfrom
feat/wix-embedded-checkout
Draft

amitbardos wants to merge 12 commits into
mainfrom
feat/wix-embedded-checkout

Conversation

@amitbardos

Copy link
Copy Markdown
Contributor

Mirror of #386 by @OleksandrSamsonov, pushed to this repo so the preview workflow can publish a test package. A fork PR gets no publish token.

Don't review or merge this one. Review happens on #386, and this PR gets closed once testing is done.

🤖 Generated with Claude Code

OleksandrSamsonov and others added 4 commits November 20, 2026 16:37
Add a WixEmbeddedCheckout member to EmbeddedCheckout. mountCheckout loads
the element script from the payments config, mounts the element with a Pay
button the SDK owns, calls confirmPayment() inside the click, then
completes the checkout and calls onComplete, as it does for PayPal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its mount() is async, so a failed mount now rejects mountCheckout and
cleans up instead of leaving a Pay button. Also scope payment_declined
docs to PayPal and note that Base44 Payments checkouts are completed too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The checkout never sets it, so the element is created with intentId only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	packages/sdk/src/modules/payments.types.ts
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.63-pr.390.31c1120

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/sdk:

npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.63-pr.390.31c1120"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.63-pr.390.31c1120"
  }
}

Preview published to npm registry — try new features instantly!

OleksandrSamsonov and others added 8 commits November 23, 2026 23:59
The checkout_id is now the element's intentId, so WixEmbeddedCheckout drops
order_id, and client_id is optional. A mount without it rejects. The element
is created with wpe({ clientId, locale }) and confirmPayment() resolves
{ status }. The Pay button stays off until the element is ready, and after
the element rejects a payment, since it refuses another one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…derror

Reject a checkout without a client ID before fetching the config. Turn the
Pay button off on loaderror until the element is ready again. Type the
payment result and note in setDisabled() that the button stays off after a
rejected payment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt is down

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… SDK

mountCheckout now passes getAccessToken to the element instead of the
client ID. The SDK mints an anonymous visitor token from the checkout's
client ID, renews it through the refresh token (or mints again when that
fails), and keeps one visitor per client ID in memory, so remounts and
other checkouts reuse it and concurrent calls share one request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Wix Payment Element has no button, and Wix's guide leaves it to the
page. A hardcoded "Pay" button from the SDK can't be translated, can't
have content between it and the form, and fights the app's own layout.

The mount now returns pay(), which the app calls from its own button's
click handler, and onReadyChange tells it when to enable that button.
pay() keeps the old guards: it does nothing until the element is ready,
during a payment, or after one succeeded or failed, so a failed
completeCheckout() after a successful charge can't lead to a second one.
setDisabled() is a no-op for Base44 Payments, as it is for Stripe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
preloadCheckout('wix') loads the element's script when the page opens.
Most of its cost is the tpa.wixapps.net redirect to static.parastorage.com
(two connections), not the 4.7KB file, so starting it early takes a
noticeable part of the wait off the buyer's click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants