Skip to content

feat(stripe): supports stripe connector#251

Merged
yardend-wix merged 5 commits intomainfrom
task/stripe-connector
Mar 10, 2026
Merged

feat(stripe): supports stripe connector#251
yardend-wix merged 5 commits intomainfrom
task/stripe-connector

Conversation

@yardend-wix
Copy link
Contributor

@yardend-wix yardend-wix commented Feb 16, 2026

Note

Description

This PR adds Stripe payment connector support to the Base44 CLI, enabling users to install, sync, and remove Stripe integrations alongside existing OAuth connectors. It refactors the connector sync result types into discriminated unions (OAuthSyncResult, StripeSyncResult) for better type safety, introduces a new pullAllConnectors() function that unifies OAuth and Stripe connector fetching, and improves the deploy and push commands to properly handle and display Stripe provisioning results.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added installStripe(), getStripeStatus(), and removeStripe() API functions with Zod-validated responses and camelCase transforms
  • Added StripeConnectorSchema and STRIPE_CONNECTOR_TYPE constant; extended ConnectorSyncResult union with OAuthSyncResult and StripeSyncResult discriminated types
  • Created new stripe.ts module with syncStripeConnector() and isStripeInstalled() handling install, removal, and already-synced states fully isolated from OAuth logic
  • Created core/resources/connector/pull.ts with pullAllConnectors() that merges OAuth connectors and Stripe status into a unified ConnectorResource[]
  • Refactored pushConnectors() to delegate to syncOAuthConnectors() and syncStripeConnector() with dedicated helper functions
  • Updated deploy and push CLI commands to display Stripe provisioning output (claim URL, connectors dashboard link)
  • Added getConnectorsUrl() helper in urls.ts for linking to the connectors dashboard
  • Fixed OAuth filter to only check connectionId presence and added null-guard in runOAuthFlowWithSkip()
  • Added comprehensive unit tests and CLI integration tests covering install, sync, removal, and error scenarios for Stripe
  • Added Stripe mock methods (mockStripeInstall, mockStripeStatus, mockStripeRemove, mockStripeInstallError) and new with-stripe-connector test fixtures to the test infrastructure

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The Stripe connector is modelled differently from OAuth connectors: it uses a separate provisioning API (/payments/stripe/...) rather than the generic integrations endpoint. The syncStripeConnector() function handles install, removal, and already-synced states independently, keeping Stripe logic fully isolated from OAuth connector sync. The claimUrl returned during Stripe provisioning is surfaced to the user in the CLI output along with a link to the connectors dashboard.


🤖 Generated by Claude | 2026-03-10 10:00 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.41-pr.251.ff9ed73

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

npm i "base44@npm:@base44-preview/cli@0.0.41-pr.251.ff9ed73"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.41-pr.251.ff9ed73"
  }
}

Preview published to npm registry — try new features instantly!

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 5 discrepancies found that need to be fixed:

  1. eject command is commented out but exists in code
  2. connectors pull command is missing from table
  3. connectors push command is missing from table
  4. types generate command is missing from table
  5. Multiple command descriptions don't match the code:
    • create: should be "Create a new Base44 project" (not "...from a template")
    • deploy: should be "Deploy all project resources (entities, functions, agents, connectors, and site)"
    • link: should be "Link a local project to a Base44 project (create new or link existing)"
    • logout: should be "Logout from current device" (not "Sign out and clear stored credentials")
    • whoami: should be "Display current authenticated user" (not "Display the current authenticated user")
    • agents pull/push: descriptions should include "(replaces all local/remote agent configs)"
    • entities push: should be "Push local entities to Base44" (not "...entity schemas...")

Please update README.md manually or re-run this check after granting write permissions.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 4 issue(s) found and applied: (1) Added missing eject command, (2) Added missing connectors pull command, (3) Added missing types generate command, (4) Fixed logout description to match code. README.md has been updated in this branch.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 8 issues found and applied: (1) Added 'eject' command to table, (2) Added 'connectors pull' command, (3) Added 'connectors push' command, (4) Added 'types generate' command, (5) Updated 'create' description, (6) Updated 'deploy' description, (7) Updated 'link' description, (8) Updated 'logout' and 'whoami' descriptions. README.md has been updated in this branch.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 4 issue(s) found and applied: added missing commands (eject, connectors pull/push, types generate) and updated command descriptions to match code. README.md has been updated in this branch.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 7 issues found and applied: (1) Updated 'create' description to match code, (2) Updated 'deploy' description with full resource list, (3) Uncommented and updated 'eject' command, (4) Updated 'link' description, (5) Updated 'logout' description to match code, (6) Added 'connectors pull' and 'connectors push' commands, (7) Added 'types generate' command, (8) Updated agent command descriptions with full details. README.md has been updated in this branch.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 7 issues found and applied: Added missing commands (eject, connectors pull, connectors push, types generate), updated command descriptions to match source code (create, deploy, link, logout, whoami, agents pull/push, entities push). README.md has been updated in this branch.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 5 issues found and applied: (1) added missing eject command, (2) added missing connectors pull/push commands, (3) added missing types generate command, (4) updated descriptions to match code exactly. README.md has been updated in this branch.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. 6 issue(s) found and applied: added missing commands (logout, eject, connectors pull/push, types generate) and updated command descriptions to match code. README.md has been updated in this branch.

@claude
Copy link

claude bot commented Feb 16, 2026

README check ran. Found 7 issue(s) and applied fixes: Added missing eject, connectors pull, connectors push, and types generate commands; updated descriptions for create, deploy, link, logout, whoami, agents pull, and agents push to match the CLI code. README.md has been updated in this branch.

@kfirstri kfirstri moved this from Backlog to In progress in CLI Development Feb 18, 2026
@kfirstri kfirstri moved this from Backlog to In progress in Backend Platform Feb 24, 2026
@gonengar gonengar moved this from In progress to In review in Backend Platform Feb 25, 2026
Add Stripe connector support with OAuth flow, deploy/pull integration,
and connector management commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yardend-wix yardend-wix force-pushed the task/stripe-connector branch from a509d96 to 828eb87 Compare March 9, 2026 09:50
Copy link
Collaborator

@kfirstri kfirstri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small comments and stuff
i'll also call @claude here to so a review of these code changes

@claude
Copy link

claude bot commented Mar 9, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@kfirstri
Copy link
Collaborator

kfirstri commented Mar 9, 2026

@claude please review

@claude
Copy link

claude bot commented Mar 9, 2026

Claude finished @kfirstri's task in 1m 49s —— View job


Code Review

  • Gather context and read changed files
  • Review core schema and API changes
  • Review push/pull logic
  • Review CLI command changes
  • Review tests
  • Post final review

Overall this is a well-structured PR with good test coverage. The discriminated union refactor for ConnectorSyncResult is particularly nice. A few things worth addressing before merging:

Issues

1. Missing camelCase transforms on Stripe schemas (addressing reviewer comment)

schema.ts:217-227 — Both InstallStripeResponseSchema and StripeStatusResponseSchema return raw snake_case fields, inconsistent with every other schema in the file (all use .transform() to camelCase). This means downstream code accesses result.claim_url, remoteStatus.stripe_mode etc. in snake_case.

// Current — inconsistent with codebase patterns
export const InstallStripeResponseSchema = z.object({
  already_installed: z.boolean(),
  claim_url: z.string().nullable(),
});

// Should be
export const InstallStripeResponseSchema = z.object({
  already_installed: z.boolean(),
  claim_url: z.string().nullable(),
}).transform((data) => ({
  alreadyInstalled: data.already_installed,
  claimUrl: data.claim_url,
}));

Same for StripeStatusResponseSchema. Then update call sites in push.ts and pull.ts to use camelCase field access, and update test mocks accordingly. Fix this →

2. connectionId empty string fallback (push.ts:209)

connectionId: response.connectionId ?? "",

Using "" as a fallback for a missing connectionId is a silent failure — if the API ever returns redirectUrl without connectionId, the OAuth flow downstream will silently receive an empty string. If the API guarantees they come together, this should be a non-null assertion or an error:

connectionId: response.connectionId!, // or throw an ApiError

Fix this →

3. pullAllConnectors doesn't degrade gracefully on Stripe API failure (pull.ts)

syncStripeConnector in push.ts handles Stripe status errors gracefully (returns null/error result), but pullAllConnectors in pull.ts will throw and abort the entire pull if getStripeStatus() fails. A Stripe API blip will prevent users from pulling their OAuth connectors. Consider catching Stripe errors in pull and simply not including Stripe in the results (logging a warning):

const stripeStatus = await getStripeStatus().catch(() => null);
if (stripeStatus?.stripe_mode !== null) { ... }

Fix this →


Suggestions (non-blocking)

4. Extract Stripe logic to stripe.ts (addressing reviewer comment)

push.ts has 8 Stripe-specific helper functions (syncStripeConnector, fetchStripeRemoteStatus, handleStripeInstall, handleStripeRemoval, stripeSynced, stripeProvisioned, stripeRemoved, stripeError). Extracting these to a stripe.ts co-located file would make push.ts much easier to navigate and mirrors the suggestion from @kfirstri.

5. STRIPE_CONNECTOR_TYPE constant (addressing reviewer comment)

schema.ts:215 — It's a reasonable pattern to avoid magic strings, but since StripeConnectorSchema already has type: z.literal("stripe") and KnownIntegrationTypes includes "stripe", the added constant is somewhat redundant. It's fine to keep if you want an explicit reference point.

6. sandbox_claim_url field is .nullable().optional() (schema.ts:226)

Both .nullable() and .optional() together is unusual — this means the type is string | null | undefined. If the API returns null, use just .nullable(). If it might be absent from the response, use .optional(). Having both is rarely intentional.

7. already_installed field unused (schema.ts:218, push.ts)

InstallStripeResponse.already_installed is parsed from the API but never used. The push logic relies on the separate getStripeStatus() call to determine if install is needed, not this field. Either use it to short-circuit (skip install when already installed) or document why it's intentionally ignored.

8. Printing "Stripe sandbox provisioned" unconditionally (push.ts:66, deploy.ts:162)

The success message says "Stripe sandbox provisioned" but StripeStatusResponseSchema includes stripe_mode: "live". If a user is re-provisioning in live mode, the message may be misleading. Consider making the mode dynamic: "Stripe ${mode} provisioned".


Positive highlights

  • The discriminated union refactor (SharedSyncResult | OAuthSyncResult | StripeSyncResult) is clean and type-safe
  • Parallel fetching in pullAllConnectors with Promise.all is the right approach
  • Test coverage is thorough — all Stripe push scenarios including error cases are covered
  • Separating Stripe from OAuth in pushConnectors with clear variable names (stripeConnector, oauthConnectors) is readable
  • handleOAuthConnectors() extraction in deploy.ts improves readability

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yardend-wix and others added 3 commits March 10, 2026 15:42
…nectionId

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port stripe mock methods from deleted Base44APIMock.ts to TestAPIServer.ts,
adapting from MSW to Express-based test server pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-project-automation github-project-automation bot moved this from In progress to In review in CLI Development Mar 10, 2026
@yardend-wix yardend-wix merged commit 4ca3edf into main Mar 10, 2026
10 checks passed
@yardend-wix yardend-wix deleted the task/stripe-connector branch March 10, 2026 15:57
@github-project-automation github-project-automation bot moved this from In review to Done in Backend Platform Mar 10, 2026
@github-project-automation github-project-automation bot moved this from In review to Done in CLI Development Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants