这是indexloc提供的服务,不要输入任何密码
Skip to content

Collect phone and email from Apple Pay when required #5199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 23, 2025

Conversation

davidme-stripe
Copy link
Contributor

Summary

  • Update Apple Pay payment request to collect phone and email through requiredShippingContactFields instead of requiredBillingContactFields
  • Maintain existing logic in BillingDetails+ApplePay.swift that extracts phone/email from shippingContact when not available in billingContact
  • Add comprehensive tests for both payment request configuration and billing details extraction

Changes Made

  1. STPApplePayContext+PaymentSheet.swift: Split billing contact fields - phone/email now go to shipping contact fields
  2. Comprehensive test coverage: Added tests for various billing configuration scenarios and BillingDetails extraction logic

Test plan

  • Added unit tests for payment request configuration with different billing collection settings
  • Added unit tests for BillingDetails extraction from PKPayment with various contact combinations
  • Verified existing functionality is preserved (billing contact takes precedence when available)
  • Build passes successfully

🤖 Generated with Claude Code

@davidme-stripe davidme-stripe requested review from a team as code owners July 23, 2025 15:34
- Add tests for requiredShippingContactFields configuration
- Add tests for BillingDetails extraction from PKPayment
- Verify phone/email are collected through shipping contact
- Test fallback logic when billing contact lacks phone/email

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@davidme-stripe davidme-stripe force-pushed the apple-pay-phone-email-collection branch from 1662b06 to 1002657 Compare July 23, 2025 15:34
Add entry documenting that Apple Pay now properly collects phone number
and email address when marked as required in PaymentSheetConfig.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
CHANGELOG.md Outdated
@@ -6,6 +6,7 @@
* [Added] Added `Appearance.EmbeddedPaymentElement.Row.titleFont` to customize the font of EmbeddedPaymentElement payment method row titles.
* [Changed] Renamed `PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Style.flatWithChevron` to `PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Style.flatWithDisclosure` and added an experimental `disclosureImage` property to customize the chevron icon displayed in EmbeddedPaymentElement payment method rows when the row style is flatWithDisclosure.
* [Fixed] `EmbeddedPaymentElementDelegate` `didUpdateHeight` now accommodates cases where the embedded view can't change height until after `didUpdateHeight` is called, like inside a UITableViewCell.
* [Fixed] Apple Pay now properly collects phone number and email address when marked as required in PaymentSheetConfig billing details collection configuration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [Fixed] Apple Pay now properly collects phone number and email address when marked as required in PaymentSheetConfig billing details collection configuration.
* [Fixed] Apple Pay now properly collects phone number and email address when marked as required in `PaymentSheet.BillingDetailsCollectionConfiguration`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that too, just fixed it!

@davidme-stripe davidme-stripe merged commit d1e5335 into master Jul 23, 2025
6 checks passed
@davidme-stripe davidme-stripe deleted the apple-pay-phone-email-collection branch July 23, 2025 17:01
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.

2 participants