Fix Stripe Connect button to save settings before OAuth redirect#341
Fix Stripe Connect button to save settings before OAuth redirect#341superdav42 merged 1 commit intomainfrom
Conversation
The Connect with Stripe button previously navigated directly to the OAuth init URL without saving settings first. When a user enabled Stripe and toggled sandbox mode for the first time, the unsaved settings meant the OAuth flow used the wrong Stripe environment. Changed the connect button from an <a> link to a form submit button that saves all settings before redirecting to the OAuth init URL via a new wu_settings_save_redirect filter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe settings save flow now supports redirect overrides via a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Settings Admin
participant Stripe Gateway
participant Stripe OAuth
User->>Settings Admin: Submit form with Stripe connect button
Settings Admin->>Settings Admin: Save settings to database
Settings Admin->>Stripe Gateway: Apply wu_settings_save_redirect filter
Stripe Gateway->>Stripe Gateway: Check if wu_connect_stripe in submission
alt Connect button was clicked
Stripe Gateway->>Stripe OAuth: Return OAuth init URL
Stripe Gateway-->>Settings Admin: OAuth URL
else Connect button not clicked
Stripe Gateway-->>Settings Admin: Original redirect URL
end
Settings Admin->>User: Safe redirect to resulting URL
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
Summary
<a>link that navigated directly to the OAuth init URL without saving settings first<button type="submit">that submits the settings form, saving all settings before redirecting to the OAuth init URLwu_settings_save_redirectfilter in the settings save handler so gateways can intercept the redirect after saveTest plan
?updated=1🤖 Generated with Claude Code
Summary by CodeRabbit