Skip to content

Show payment method preview in Link inline verification view #5179

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mats-stripe
Copy link
Collaborator

@mats-stripe mats-stripe commented Jul 18, 2025

Summary

Adds the customer's payment method preview to the Link inline verification view.

Motivation

📈

Testing

Note that the Link logo doesn't show up on previews, so it's a blue box instead here:

No PM preview Card Bank
testLinkInlineVerificationView_NoPaymentMethodPreview@3x testLinkInlineVerificationView_WithVisaPaymentMethodPreview@3x testLinkInlineVerificationView_WithBankPaymentMethodPreview@3x

Changelog

N/a

Copy link

github-actions bot commented Jul 18, 2025

🚨 New dead code detected in this PR:

ConsumerSession+PublishableKey.swift:17 warning: Initializer 'init(consumerSession:publishableKey:displayablePaymentDetails:)' is unused

Please remove the dead code before merging.

If this is intentional, you can bypass this check by adding the label skip dead code check to this PR.

ℹ️ If this comment appears to be left in error, double check that the flagged code is actually used and/or make sure your branch is up-to-date with master.

@mats-stripe mats-stripe changed the title Pass customer_id to lookup request, model displayable_payment_details… Show payment method preview in Link inline verification view Jul 18, 2025
Comment on lines 42 to 45
let defaultCardBrand: String?
let defaultPaymentType: PaymentType?
let last4: String?
let numberOfSavedPaymentDetails: Int?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mats-stripe mats-stripe force-pushed the mats/lookup_with_customer_id branch from e1e1cbf to 0bc2bfa Compare July 23, 2025 19:43
@mats-stripe mats-stripe force-pushed the mats/lookup_with_customer_id branch from 4ff4d34 to 830629d Compare July 24, 2025 17:56
@mats-stripe
Copy link
Collaborator Author

Works now!

@mats-stripe mats-stripe marked this pull request as ready for review July 24, 2025 18:00
@mats-stripe mats-stripe requested review from a team as code owners July 24, 2025 18:00
Comment on lines +62 to +63
customerID: elementsSession.customer?.customerSession.customer,
shouldPassCustomerIdToLookup: shouldPassCustomerIdToLookup
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about we only pass the customer ID if shouldPassCustomerIdToLookup?

Suggested change
customerID: elementsSession.customer?.customerSession.customer,
shouldPassCustomerIdToLookup: shouldPassCustomerIdToLookup
customerID: shouldPassCustomerIdToLookup ? elementsSession.customer?.customerSession.customer : nil

@@ -27,12 +34,42 @@ struct LinkInlineVerificationView: View {
self.onComplete = onComplete
}

private var scaledSeparatorWidth: CGFloat {
max(Constants.baseSeparatorWidth, 0.5) // Ensure separator is always visible
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is always 1, no?

.resizable()
.scaledToFit()
.frame(height: 20)
HStack(spacing: scaledContentSpacing) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: The paymentMethodPreview.last4 doesn't seem to be properly aligned with the icon. In the screenshots, the text sits a little too high.

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.

2 participants