Repository navigation
feat(payments): PayPal checkout created on click - #366
Merged
Merged
Conversation
… once
mountCheckout() also accepts { provider: 'paypal', currency, intent, createCheckout }. PayPal's button renders on page load from the payments config, and createCheckout() runs inside the buyer's click, so the app no longer needs its own button that creates the order first. The created checkout must match the button's provider, intent, currency and merchant. CheckoutMount gains setDisabled() to keep the button off until a form is valid.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.58-beta.0-pr.366.dccfb00Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.58-beta.0-pr.366.dccfb00"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.58-beta.0-pr.366.dccfb00"
}
}
Preview published to npm registry — try new features instantly! |
guyofeck
reviewed
Nov 3, 2026
… charge twice Once onApprove completes the checkout, clicks are ignored and setDisabled(false) no longer turns the button back on. With an on-click checkout, re-enabling it would have created and charged a second order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guyofeck
self-requested a review
November 4, 2026 10:36
guyofeck
approved these changes
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PayPal checkout can now be created on click, so the buyer clicks once.
Today a page has to create the checkout before it can mount PayPal's button, because the button needs the checkout's PayPal details. So the buyer clicks the app's own button, waits 1-3 seconds for PayPal's button to appear, and clicks again.
mountCheckout()now also accepts a checkout to create on click:paypal.buttondetails inGET /payments/config.createCheckout()runs inside the buyer's click. PayPal'ssession.start()takes the order as a promise, so its window opens right away and continues once the order exists. Page views create no orders.onError. A rejection fromcreateCheckout(), for example an empty required field, closes PayPal's window and reachesonError.CheckoutMount.setDisabled()greys out the button until a form is valid. Stripe ignores it.paypal.buttondetails yet, which also covers backends that don't send them.Testing
vitest: 434 passed, including four new on-click tests: the button shows before the order exists and the order is created on click, a mismatched checkout is refused, mounting waits until PayPal is ready, and a disabled button ignores clicks.test:types: passes, with new checks for the on-click form,setDisabled(), and refusing it for Stripe.eslintis clean.🤖 Generated with Claude Code