Repository navigation
fix: setup stripe points to the dashboard instead of a dead OAuth flow - #35
Merged
Merged
Conversation
The CLI flow could not complete: the token exchange needs Affitor's platform secret, POST /api/v1/cli/stripe-connect answers 410, and the webhook it created pointed at /webhooks/stripe/<id>, which the CMS does not serve (and subscribed to invoice.paid, which the CMS does not handle). Now it prints where to connect Stripe and exits 1, with no network call. Bump to 0.4.3 (not published). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
What & why
affitor setup stripe(CLI 0.4.2) cannot work for any brand and, when it gets far enough, leaves a dead webhook on the brand's Stripe account:stripe.oauth.token(...)with the key the user passesclient_idneeds Affitor's platform secret, which a brand does not havepackages/cli/src/lib/stripe-oauth.ts:53-57(before)webhookEndpoints.createon the connected account, URL<api-url>/webhooks/stripe/<program_id>, events incl.invoice.paid/webhooks/stripe/*route (Stripe intake isPOST /api/webhook-distributor/stripe), and the distributor handlesinvoice.payment_succeeded, notinvoice.paidsetup-stripe.ts:98,stripe-oauth.ts:196-200,types.ts:199-206(before); affiliate-cmssrc/api/webhook-distributor/routes/custom-routes.ts:6,services/webhook-distributor.ts:773-790POST /api/v1/cli/stripe-connectsrc/api/cli/routes/custom-routes.ts:68-80,controllers/cli.ts:368-382Real Stripe tracking (dashboard Connect + Affitor's platform webhook, which handles
invoice.payment_succeededfor renewals) is unaffected. No recurring sale is lost through this path, because the command never completes.Fix (smallest):
setup stripenow prints "Stripe is connected from the Affitor dashboard, not the CLI: open the program, go to Settings, and use Connect Stripe." and exits 1 ({"error": "stripe_setup_moved", "message": ...}with--json). It makes no network call, and old flags are still accepted.lib/stripe-oauth.ts,WEBHOOK_EVENTS, the OAuth port constants,saveStripeConnection,StripeConnectResponse, and the now-unusedstripedependency.status, the generated.env.exampleand agent instructions, and the README now point to the dashboard instead ofnpx affitor setup stripe.Tests
packages/cli/tests/setup-stripe.test.ts:--jsonprintsstripe_setup_moved+ exits 1 + nofetch; old--stripe-secret-key/--stripe-client-idflags still get the directions with no network call.npm run buildpass,npm run lint(tsc) pass,npm test: cli 115/115 (13 files), recipes 19/19, mcp 20/20.Companion docs PR: Affitor/affitor-docs#105.
🤖 Generated with Claude Code