Repository navigation
feat(core): multi-provider hosted checkout (providerChoices + create-session providerId) - #122
Open
alexasomba wants to merge 3 commits into
Open
alexasomba wants to merge 3 commits into
alexasomba wants to merge 3 commits into
Conversation
3 tasks done
Contributor
Author
This was referenced Dec 3, 2026
cavewebs
added a commit
that referenced
this pull request
Dec 3, 2026
## What and why Checkout's country field always starts on `US` (`value="US"` in `HostedCheckoutForm` and in the starter's embedded form), and core has no setting for where the shop is based. A shopper on a shop outside the US changes it on every order. #103 (now carried in #107) works around the same gap in its payout form by guessing the country from the default currency, and mentions a shop-country setting as a follow-up. Once both land, that form can start from this setting. Part of the roadmap in #108. ## Behaviour - **Before:** the ship-to country starts on `US`; a digital order's country starts empty. - **After, with the setting:** both start on the shop's country. Customers can still change it. - **Without the setting nothing changes.** ## Changes - **New optional setting `storeCountry`** in `settings/schema.ts`: checked against core's country list (`isValidCountryCode`), trimmed and upper-cased. A country name or an unknown code is refused; `null` clears it. - **Settings → Store → Shop country:** a searchable country picker (the kit's `Combobox` with `countryOptions()`) above the currency fields. The card's description now mentions it. - **`HostedCheckoutForm`:** a new optional `defaultCountry` prop. The ship-to country starts on it (else `US`), and a digital order's country is prefilled with it (else empty). - **Starter:** reads the setting and passes it to the hosted form, and to the embedded form's shipping and billing country. - Changeset: minor for core (a new setting and prop), patch for the starter. No change to `routes/checkout.ts` or to currencies. ## Tests `packages/core/test/store-country.test.ts`: - through the real `admin/settings` route: saves `" ke "` as `KE` and returns it; can be cleared with `null`; is `null` on a new shop; refuses `"Kenya"`, `"XX"` and a number with a 400 naming the field; - source checks on both forms' country inputs and the starter's wiring. Five of the six fail without the change (the refusal test passes either way, since an unknown key is refused too). Full suite: core 370 (364 before), paystack 105, lite 144, registry-setup 5, all passing. `tsc --noEmit` passes for core, `astro check` for the starter, Biome is clean on the new and changed lines; `bun.lock` is unchanged. ## Review points - **Why not infer it from the currency?** Several countries share a currency (USD, EUR), and a shop can sell in a currency that isn't its own. An explicit setting is cheap and exact. - **Payout form in #103:** not changed here, to keep this PR off #107's files. A one-line follow-up after both merge. - **No formatting churn:** Biome reports some older lines in `SettingsPage.tsx` on `main`; they're left as they are. **Next to #122:** both add props near the top of `HostedCheckoutForm.astro`. If #122 merges first I'll rebase this; the change itself doesn't overlap.
…e-session Adds providerChoices to HostedCheckoutForm and accepts an optional providerId on checkout/create-session so buyers can pick Paystack vs Flutterwave without wrapping the route in a host plugin. Co-authored-by: Cursor <cursoragent@cursor.com>
alexasomba
force-pushed
the
feat/hosted-multi-provider
branch
from
December 4, 2026 05:39
0c6089c to
62d952f
Compare
Contributor
Author
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 changes
HostedCheckoutFormaccepts optionalproviderChoicesand shows a selector when more than one provider is supplied. The selector stays available for retry after payment fails or the buyer closes on-page checkout.checkout/create-sessionuses the selected registered, configured provider and binds it to the checkout draft. An unavailable selection returns a buyer-readable 409. A request without a selection uses the store default.Closes feat(core): multi-provider hosted checkout (providerChoices + create-session providerId) #121.
The provider and checkout reference binding from Checkout and refund safety #115 is already on
main. This branch includes the current upstreammain.moset15’s earlier checkout work also touches the hosted form. Each branch merges cleanly with this PR in a local merge check.
Validation