Repository navigation
Rate and confirm express checkout with the wallet's coupon - #1550
Open
pbennett1-godaddy wants to merge 6 commits into
Open
pbennett1-godaddy wants to merge 6 commits into
pbennett1-godaddy wants to merge 6 commits into
Conversation
Checkout-api now re-prices express discounts from coupon codes and recalculates express taxes on confirm, failing with DISCOUNT_MISMATCH or TAX_MISMATCH when they differ from what the wallet showed. - Send the applied coupon as discountCodes when confirming GoDaddy and Stripe express checkout, so the server prices from the code rather than reading it from the adjustments. - Shape price adjustment quotes as confirm's calculatedAdjustments input, which now requires each line's calculationLine id and type. - Add DISCOUNT_MISMATCH and TAX_MISMATCH messages in every locale. - Regenerate checkout-env.ts from the current checkout-api schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: dc23a0f The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Checkout now rates express shipping the way standard checkout does: on the subtotal after product discounts, including a coupon applied in the wallet. - Pass the wallet's coupon as discountCodes when fetching express shipping rates (GoDaddy and Stripe). GoDaddy express re-fetches rates when the coupon changes in the wallet and keeps the selected method at its new cost; it previously kept the old rates. - Pass price adjustment quotes straight back to confirm. The server now declares each line's calculationLine non-null, so the client-side reshaping is no longer needed. - Regenerate checkout-env.ts from the current checkout-api schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A coupon applied in standard checkout stays on the order. When the buyer removed it in the express wallet, the wallet showed and taxed the order without it, but checkout still charged the saved discount. With no coupon in the wallet, GoDaddy and Stripe express now: - fetch rates and confirm with an empty discountCodes list, so checkout rates the full subtotal and removes the order's saved discounts before charging; - quote taxes with an empty discountAdjustments override, so the saved discounts aren't taxed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a new code gets no rates or is rejected, restore the coupon, adjustments, shipping method and rates, taxes and totals the wallet showed before the change, so a bad code never wipes the buyer's shipping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <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.
Why
Checkout is making express checkout (GoDaddy and Stripe wallets) work like standard checkout when a coupon is applied:
DISCOUNT_MISMATCHorTAX_MISMATCHbefore charging if either differs from what the wallet showed.The server accepts the new optional
discountCodesinputs and falls back to existing behavior without them, so current clients keep working. This PR is the client side.What
discountCodes(calculatedShippingRates(discountCodes:)), in both GoDaddy and Stripe express.shippingMethods, and keeps the selected method (or the cheapest) at its new cost. Stripe express has no in-sheet coupon entry.discountCodesalongsidecalculatedAdjustments, so the server prices from the code. Codes are only sent with the adjustments they priced.calculationLinenon-null, so the quote is sent back to confirm unchanged; no client-side reshaping.DISCOUNT_MISMATCHandTAX_MISMATCHare added in every locale, so buyers see "Discounts/Taxes have changed. Review your order and try again." instead of the raw code.checkout-env.tsis regenerated from the current checkout API schema. Besides the new fields, it picks up schema changes that had already shipped: the non-nullcalculationLineinput, andpaymentTargetson the session.Standard checkout is unchanged; only the providers under
checkout-buttons/expresssend the new fields.Testing
express/godaddy.test.tsx): rates are fetched with the applied coupon; a coupon change re-fetches rates and sends the new shipping methods (replacing the earlier "keeps the wallet shipping methods" test); confirm sendsdiscountCodes, or neither codes nor adjustments without a coupon.express/stripe.test.tsx,use-stripe-checkout.integration.test.tsx): rates are fetched with the applied coupon; confirm sends codes with their adjustments, omits them when none were applied, and never sends codes without adjustments.@godaddy/react:pnpm typecheckpasses, andvitest runpasses (982 tests).@godaddy/localizations:pnpm typecheckpasses. Biome is clean on the changed files.🤖 Generated with Claude Code