Skip to content

Filter tax-insufficient saved payment methods (MOBILESDK-4697) - #13505

Draft
cttsai-stripe wants to merge 3 commits into
cttsai/mobilesdk-4667-us-bank-account-tax-addressfrom
cttsai/mobilesdk-4697-spm-tax-billing-filter
Draft

Filter tax-insufficient saved payment methods (MOBILESDK-4697)#13505
cttsai-stripe wants to merge 3 commits into
cttsai/mobilesdk-4667-us-bank-account-tax-addressfrom
cttsai/mobilesdk-4697-spm-tax-billing-filter

Conversation

@cttsai-stripe

@cttsai-stripe cttsai-stripe commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

On the Checkout Session path, when automatic tax uses billing as its tax address source, filter out saved payment methods whose billing address lacks the country-specific fields Stripe Tax needs. This prevents offering a saved payment method that would hard-fail at confirm.

This PR is stacked after the new-payment-method work in #13713 and #13718. It reuses the shared country requirements from #13717 without mixing saved-payment-method behavior into MOBILESDK-4667.

Motivation

Verified against pay-server: FinalizePaymentTaxes recomputes tax from the selected payment method billing address at confirm and raises checkout_automatic_tax_confirmation_failure (subscription mode: billing_automatic_tax_unrecognized_customer_location), HTTP 400, on any non-complete tax status. There is no silent zero-tax path. That confirm guard is not payment-method-type gated, so the filter intentionally applies to all saved-payment-method types.

Email does not need client-side sufficiency validation; the backend handles it. This change validates only the billing address required to compute tax for the payment method country.

Implementation:

  • Add PaymentMethod.hasSufficientBillingDetailsForAutomaticTax() using the shared country requirements from Share automatic-tax billing address primitives (MOBILESDK-4667) #13717.
  • Consult it in DefaultPaymentMethodFilter for every saved payment-method type.
  • Thread the Checkout Session-only requirement from PaymentMethodMetadata through CustomerState into FilterParams; other PaymentSheet integrations remain no-ops.

Saved-card billing-details editing remains separate and standalone in #13506.

JIRA: MOBILESDK-4697. iOS sibling: MOBILESDK-4698.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Targeted unit tests passed:

  • BillingDetailsValidationTest: country-specific address sufficiency.
  • DefaultPaymentMethodFilterTest: gating, null/incomplete addresses, country boundaries, and non-card saved methods.
  • CreateCustomerStateTest: propagation of the automatic-tax billing-address requirement.

The focused PaymentSheet unit-test set, :paymentsheet:detekt, and :paymentsheet:apiCheck passed.

Screenshots

N/A - no new UI surface; this removes unusable saved payment methods from the list.

Changelog

N/A - Checkout Session is behind @CheckoutSessionPreview; the implementation is internal/library-group restricted.

@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from e81e0a5 to 627cb7e Compare August 3, 2026 18:08
@cttsai-stripe
cttsai-stripe changed the base branch from master to codex/mobilesdk-4667-all-new-payment-methods August 3, 2026 18:08
@cttsai-stripe cttsai-stripe changed the title [PaymentSheet] Filter tax-insufficient saved payment methods on Checkout Session (MOBILESDK-4697) Filter tax-insufficient saved payment methods (MOBILESDK-4697) Aug 3, 2026
@cttsai-stripe
cttsai-stripe force-pushed the codex/mobilesdk-4667-all-new-payment-methods branch from e025939 to 5f7aefb Compare August 3, 2026 19:47
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 627cb7e to 37a55b1 Compare August 3, 2026 19:47
@cttsai-stripe
cttsai-stripe changed the base branch from codex/mobilesdk-4667-all-new-payment-methods to cttsai/mobilesdk-4667-us-bank-account-tax-address August 3, 2026 19:47
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 4889e25 to b661f1b Compare August 3, 2026 19:59
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch 2 times, most recently from a96e023 to 2b0b13d Compare August 3, 2026 20:06
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from b661f1b to 40d755f Compare August 3, 2026 20:06
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 2b0b13d to 5d4f81b Compare August 3, 2026 20:14
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 40d755f to 000dff8 Compare August 3, 2026 20:14
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 5d4f81b to eb6d085 Compare August 3, 2026 20:22
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 000dff8 to 27767c9 Compare August 3, 2026 20:22
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from eb6d085 to f0e2489 Compare August 3, 2026 20:59
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch 2 times, most recently from 29065a5 to e829b62 Compare August 3, 2026 21:58
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from f0e2489 to 0223bfe Compare August 3, 2026 21:58
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from e829b62 to bb2524c Compare August 3, 2026 22:32
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 0223bfe to 959ae97 Compare August 3, 2026 22:32
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from bb2524c to 91dd147 Compare August 3, 2026 23:46
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 959ae97 to 7f486b6 Compare August 3, 2026 23:46
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 91dd147 to 58bf122 Compare August 4, 2026 05:58
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 7f486b6 to d16fff0 Compare August 4, 2026 05:58
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 58bf122 to 00de1a9 Compare August 4, 2026 06:40
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from d16fff0 to db8bd3f Compare August 4, 2026 06:40
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 00de1a9 to 4afd3c4 Compare August 4, 2026 18:15
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 4c9cfd0 to 8ce4b60 Compare August 4, 2026 22:35
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch 2 times, most recently from 630db30 to 9fe66c1 Compare August 4, 2026 23:17
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 8ce4b60 to 17d99af Compare August 4, 2026 23:17
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 9fe66c1 to 5e2102e Compare August 4, 2026 23:20
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch 2 times, most recently from 1caaf36 to e2a12d4 Compare August 4, 2026 23:35
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 5e2102e to 787c547 Compare August 4, 2026 23:35
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from e2a12d4 to f6350ab Compare August 5, 2026 00:18
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 5edee9a to 2c8e80d Compare August 5, 2026 16:51
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from f6350ab to 582debf Compare August 5, 2026 16:51
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 2c8e80d to 0658b41 Compare August 5, 2026 17:46
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 582debf to 9567195 Compare August 5, 2026 17:46
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 0658b41 to 8434af9 Compare August 5, 2026 18:12
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 9567195 to 3ffddaa Compare August 5, 2026 18:12
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 8434af9 to 1f16579 Compare August 5, 2026 23:28
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 3ffddaa to d15109b Compare August 5, 2026 23:28
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 1f16579 to 2bf5d12 Compare August 5, 2026 23:35
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from d15109b to 357e576 Compare August 5, 2026 23:35
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 2bf5d12 to ad60921 Compare August 6, 2026 00:14
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 357e576 to 0df3714 Compare August 6, 2026 00:15
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from ad60921 to 018e20b Compare August 6, 2026 18:17
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 0df3714 to 09b6cb9 Compare August 6, 2026 18:17
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from 018e20b to dad741e Compare August 6, 2026 20:22
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from 09b6cb9 to f884d2a Compare August 6, 2026 20:22
cttsai-stripe and others added 3 commits August 6, 2026 15:37
…697)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
… Session (MOBILESDK-4697)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
…ountry, and wiring tests (MOBILESDK-4697)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-us-bank-account-tax-address branch from dad741e to 1fba781 Compare August 6, 2026 22:39
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4697-spm-tax-billing-filter branch from f884d2a to f482343 Compare August 6, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant