Skip to content

feat(payments): mountCheckout opens Paddle checkouts - #393

Draft
amitbardos wants to merge 6 commits into
mainfrom
amitb/paddle-checkout
Draft

amitbardos wants to merge 6 commits into
mainfrom
amitb/paddle-checkout

Conversation

@amitbardos

Copy link
Copy Markdown
Contributor

What

Adds Paddle to base44.payments.mountCheckout(). This goes with the backend proof of concept in base44-dev/apper#47082, where createCheckout on a Paddle app returns embedded: { provider: "paddle", client_token, transaction_id, environment, customer_email }.

  • Script: Paddle.js loads from the paddle.script_url in /payments/config, and only from cdn.paddle.com. It's initialized once per page with the seller's client-side token; Environment.set("sandbox") runs for sandbox transactions.
  • Button: the element gets a Pay button that opens Paddle's checkout window for the transaction, with the buyer's email filled in.
  • Paid: on Paddle's checkout.completed, the SDK calls completeCheckout, which reads the transaction from Paddle, and then onComplete. After that the button stays off.
  • Closed or failed: checkout.closed calls onCancel and the buyer can try again; checkout.error calls onError.
  • One seller per page: a second seller's token on the same page is refused, because Paddle.js accepts one token per page.
  • Types: PaddleEmbeddedCheckout, and preloadCheckout("paddle").

Testing

npm test passes (489), including 4 new mountCheckout cases for Paddle. The same flow was run by hand against a Paddle sandbox seller: a $9.80 test charge, completed through completeCheckout.

🤖 Generated with Claude Code

An embedded checkout with provider "paddle" draws a pay button that opens
Paddle's overlay for the transaction. Paddle.js loads only from
cdn.paddle.com, is initialized once per page with the seller's client-side
token, and on Paddle's checkout.completed the SDK calls completeCheckout,
which reads the transaction from Paddle, before onComplete. A closed window
is onCancel and the buyer can try again; a paid checkout stays off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 25, 2026 •

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.393.34b3870

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.393.34b3870"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.63-pr.393.34b3870"
  }
}

Preview published to npm registry — try new features instantly!

@github-actions github-actions Bot added the docs-draft PR has auto-drafted documentation suggestions label Nov 25, 2026
amitbardos and others added 5 commits November 26, 2026 09:13
mountCheckout takes a PaddleCheckoutOnClick ({ provider: "paddle",
createCheckout }) like PayPal's on-click mode: the button shows at once and
the checkout is created inside the click. Paddle's checkout opens in the
page rather than a popup, so it can open after the create and the buyer still
clicks once. Paddle.js initializes on the first click, for either mode.
Paddle's own "Add discount" field is hidden: the app prices discounts itself
through createCheckout, as with the other providers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Email, country, postcode and card on one screen, so tax shows as the buyer types instead of after Continue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The one-page checkout sits in the mount element, in the page's language when Paddle has it, instead of a full-page window. A pre-created checkout renders at once; an on-click one shows a Buy now button and renders in its place. Paddle's frame has no order summary, so onTotalsChange reports subtotal, discount, tax and total in minor units for the page to show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
createCheckout's buyer can carry country and postal_code; the backend returns them on Paddle's embedded checkout and mountCheckout prefills Paddle with them, so Paddle works out tax at once and shows only the card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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

docs-draft PR has auto-drafted documentation suggestions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant