Skip to content

feat(payments): add payments module with embedded checkout - #323

Open
naor-gal wants to merge 2 commits into
mainfrom
feat/payments-module
Open

naor-gal wants to merge 2 commits into
mainfrom
feat/payments-module

Conversation

@naor-gal

Copy link
Copy Markdown

Summary

  • Adds base44.payments (browser) with completeCheckout(), listPurchases() and mountCheckout().
  • Adds base44.asServiceRole.payments (backend functions) with createCheckout(), completeCheckout(), listPurchases(), refund(), cancelSubscription(), pauseSubscription() and resumeSubscription().
  • The service-only methods aren't on the user module type, so calling them from the browser fails at compile time. This follows the ConnectorsModule / UserConnectorsModule split.
  • Request and response fields use the API's snake_case names unchanged, like the other modules. Failed requests reject with the existing Base44Error, with code from the API's error envelope.
  • mountCheckout() renders an embedded checkout in any framework, with no new dependencies:
    • PayPal: loads PayPal JS SDK v6 for the checkout's environment and renders a <paypal-button>. On approve it calls completeCheckout(). A declined payment goes to onError, and the button stays so the buyer can re-approve the same order.
    • Stripe: loads Stripe.js v3 and mounts Embedded Checkout. Mounts run in order, and a new one replaces the previous one, since Stripe allows one per page.
  • Docs: JSDoc for every public type and method, a provider support table, and the error codes, purchase statuses and recurring frequencies on the payments reference page. A separate service-role-payments page holds the service-role methods. Also adds a README entry.

Notes

  • Base44Client gains a required payments member and asServiceRole gains payments, the same as earlier module additions. Code that builds that type by hand needs the new members.
  • The public element type is the structural CheckoutElement, so the SDK's types don't need the DOM library in backend code.

Test plan

  • npm run lint
  • npm test -w @base44/sdk: 362 tests, including new unit tests (HTTP routes, error envelope, mount lifecycle) and type tests
  • npm run build -w @base44/sdk
  • npm run create-docs (packages/sdk): payments and service-role-payments pages generate cleanly
  • Manual, PayPal sandbox: created an embedded checkout, mounted it, approved as a sandbox buyer, and completeCheckout() returned paid
  • Manual, PayPal sandbox: re-approved the same order from the mounted button, and capture succeeded
  • Reviewer: spot-check the generated payments.mdx page in mintlify-docs

🤖 Generated with Claude Code

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>
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.53-pr.323.f5fc4fa

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.53-pr.323.f5fc4fa"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.53-pr.323.f5fc4fa"
  }
}

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 Oct 12, 2026
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.

2 participants