Repository navigation
feat(payments): add payments module with embedded checkout - #323
Merged
Merged
Conversation
Adds `base44.payments` and `base44.asServiceRole.payments` for the Payments API: checkouts, PayPal checkout completion, purchase lookup, refunds, and subscription cancel, pause and resume. `mountCheckout()` renders an embedded checkout in any framework. It loads PayPal JS SDK v6 or Stripe.js v3 on demand, with no new dependencies. 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.53-pr.323.0c3777ePrefer 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.53-pr.323.0c3777e"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.53-pr.323.0c3777e"
}
}
Preview published to npm registry — try new features instantly! |
netanelgilad
approved these changes
Oct 12, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK no longer hard-codes PayPal or Stripe script URLs or PayPal environments. mountCheckout() fetches GET /payments/config once per client and loads the URL it names, after checking it is https on the provider's own host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🚀 Package Preview Available! (
|
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
base44.payments(browser) withcompleteCheckout(),listPurchases()andmountCheckout().base44.asServiceRole.payments(backend functions) withcreateCheckout(),completeCheckout(),listPurchases(),refund(),cancelSubscription(),pauseSubscription()andresumeSubscription().ConnectorsModule/UserConnectorsModulesplit.Base44Error, withcodefrom the API's error envelope.mountCheckout()renders an embedded checkout in any framework, with no new dependencies. It fetchesGET /payments/configonce per client and loads the script URL that config names for the provider. Before loading, it requireshttps:and an exact provider host (www.paypal.comorwww.sandbox.paypal.comfor PayPal,js.stripe.comfor Stripe), and rejects anything else without adding a script tag.<paypal-button>. On approve it callscompleteCheckout(). A declined payment goes toonError, and the button stays so the buyer can re-approve the same order.service-role-paymentspage holds the service-role methods. Also adds a README entry.Notes
listPurchases()in a backend function.Base44Clientgains a requiredpaymentsmember andasServiceRolegainspayments, the same as earlier module additions. Code that builds that type by hand needs the new members.CheckoutElement, so the SDK's types don't need the DOM library in backend code.Test plan
npm run lintnpm test -w @base44/sdk: 378 tests, including new unit tests (HTTP routes, error envelope, config caching and URL checks, mount lifecycle) and type testsnpm run build -w @base44/sdknpm run create-docs(packages/sdk):paymentsandservice-role-paymentspages generate cleanlycompleteCheckout()returnedpaidpayments.mdxpage in mintlify-docs🤖 Generated with Claude Code