Skip to content

Fixed checkout failures when collecting tax IDs#29010

Open
alexreiling wants to merge 1 commit into
TryGhost:mainfrom
alexreiling:fix/stripe-tax-id-customer-update
Open

Fixed checkout failures when collecting tax IDs#29010
alexreiling wants to merge 1 commit into
TryGhost:mainfrom
alexreiling:fix/stripe-tax-id-customer-update

Conversation

@alexreiling

Copy link
Copy Markdown

Summary

  • allowed Stripe Checkout to update existing customer names when automatic tax customer updates are enabled
  • tightened Stripe API tests around customer_update for subscription, donation, and gift checkout sessions

Testing

  • pnpm test:single test/unit/server/services/stripe/stripe-api.test.js

no ref

Stripe requires Checkout sessions for existing customers to allow name updates when tax ID collection is enabled. This keeps the existing automatic tax customer update and lets Stripe save the legal business name.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 33d02163-84ff-43a8-90f5-6a2b1cbf55b4

📥 Commits

Reviewing files that changed from the base of the PR and between cd4f5fd and 009142c.

📒 Files selected for processing (2)
  • ghost/core/core/server/services/stripe/stripe-api.js
  • ghost/core/test/unit/server/services/stripe/stripe-api.test.js

Walkthrough

This change modifies StripeAPI's checkout session creation logic so that when automatic tax is enabled and a customer is present, the customer_update payload includes both address: 'auto' and name: 'auto', previously only setting address: 'auto'. This applies to the checkout subscription, donation payment, and gift subscription session creation methods. Corresponding unit tests were updated to assert the exact customer_update shape, and a new test was added covering the donation checkout session scenario.

Changes

Cohort / File(s) Change Summary
Stripe customer_update name auto field: stripe-api.js Added name: 'auto' to customer_update payload in three checkout session creation methods (subscription, donation, gift) when automatic tax is enabled and customer is present
Stripe customer_update name auto field: stripe-api.test.js Updated existing test assertions to check exact customer_update shape; added new test for donation checkout session

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant StripeAPI
  participant Stripe

  Caller->>StripeAPI: createCheckoutSession/createDonationCheckoutSession/createGiftCheckoutSession
  alt automatic tax enabled and customer present
    StripeAPI->>StripeAPI: set customer_update = {address: 'auto', name: 'auto'}
  end
  StripeAPI->>Stripe: create session with stripeSessionOptions
  Stripe-->>StripeAPI: session response
  StripeAPI-->>Caller: session
Loading

Related issues: None specified.

Related PRs: None specified.

Suggested labels: stripe, bug-fix

Suggested reviewers: None specified.

🚀 A tiny tweak in Stripe's own hand,
Now names auto-update, as customers demand.
Address and name, together they go,
Checkout, donation, and gift all in flow.
Tests confirm it, exact and precise —
A small fix delivered, clean and nice.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: fixing Stripe Checkout failures related to tax ID collection and customer updates.
Description check ✅ Passed The description accurately summarizes the Stripe Checkout/customer_update changes and the related test updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant