Let store owners configure payment plugins per store - #840
Merged
KrzysztofPajak merged 3 commits intoSep 13, 2026
Merged
Conversation
The Store payment grid rendered method names as plain text, so a store manager could activate a payment method but never reach its settings. The shipped payment plugins only had Areas/Admin controllers, and their ConfigurationUrl is an absolute /Admin/... path, so linking to it would have sent the manager into the admin area instead. Each payment plugin now ships an Areas/Store configuration screen that reads and writes its settings for the manager's own store, and the grid links to that screen - built from the Store-area controller the plugin actually ships, so a plugin without one still renders plain text. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bf2UUL1avH6UD5Mxxzu7UK
BrainTree's admin screen wrote its settings globally and read them from the injected instance, which is resolved for whichever store hosts the admin panel - the store scope selector was ignored, so per-store credentials were impossible. It now loads and saves for the selected scope, like the other payment plugins, and offers the scope selector. Stripe assigned the api key to the process-wide StripeConfiguration before every call. With one key for all stores that was harmless; with a key per store two concurrent checkouts would overwrite each other's credentials, so the key now travels with a per-call StripeClient. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bf2UUL1avH6UD5Mxxzu7UK
The Store-area controller the StoreAreaConfiguration tests discover is a stand-in for a shipped plugin configuration screen, but its POST overload lacked the antiforgery attribute every real one carries, which CodeQL flagged as a missing CSRF token validation. Mirror the shipped controllers so the stand-in is faithful.
KrzysztofPajak
deleted the
feature/store-owner-payment-plugin-config
branch
September 13, 2026 13:28
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.
Type: feature
Issue
A store owner can activate a payment method in the Store panel but cannot configure any of them. The grid at
/Store/Payment/Indexrenders the method's friendly name and system name as plain text, so there is no way into the plugin's settings. Two things stand in the way:Payments.CashOnDelivery,Payments.BrainTree,Payments.StripeCheckout) only haveAreas/Admincontrollers, and theirConfigurationUrlis an absolute/Admin/...path — linking to it would send a store manager into the admin area rather than to a screen they are allowed to use.StripeCheckoutServiceassigned the api key to the process-wide staticStripeConfiguration.ApiKey; harmless with one key for all stores, but with a key per store two concurrent checkouts overwrite each other's credentials.Reproduce: sign in to
/Storeas a store manager withManagePaymentMethodsgranted, open Payment methods — the names are not links, and there is no other route to the plugin settings.Solution
Each payment plugin now ships an
Areas/Storeconfiguration screen that loads and saves its settings for the manager's own store (StaffStoreId), gateway credentials included, so each store transacts on its own Stripe/BrainTree account. The screens reuse the plugins' existing configuration models and localization resources — no new resources, no migration.The Store grid links to that screen. The url is built from the Store-area controller the plugin actually ships (
StoreAreaConfiguration.GetConfigurationUrl) rather than from the provider's ownConfigurationUrl, since the latter points at the admin area; a plugin without a Store screen renders plain text, exactly as the Shipping grid already does.Storefront behavior needed no change:
AddSettingsalready registers everyISettingsclass as scoped and loads it for the current store, so checkout has always read per-store values. The two genuine defects above are fixed — BrainTree's admin screen now honors the selected store scope (and offers the selector), and the Stripe api key travels with a per-callStripeClient.Breaking changes
None to public contracts. One behavior change worth noting: BrainTree's admin configuration screen now writes to the selected store scope instead of always writing globally. With the scope set to all stores (the default) the behavior is identical; an admin who had a specific store selected will now see their edits apply to that store, which is the point of the fix.
Note that
StoreManagerdoes not carryManagePaymentMethodsby default — an admin must grant it before the menu entry and these screens appear. This is pre-existing and unchanged here.Testing
StoreManagercustomer group theManagePaymentMethodspermission, and assign a store manager customer to a store./Storeas that store manager and open Payment methods. The friendly name and system name of Cash on delivery, BrainTree and Stripe are now links; a payment plugin without a Store-area screen would stay plain text.dotnet build GrandNode.slnanddotnet test src/Tests/Grand.Web.Store.Testsboth pass.