Skip to content

Fix vending card art by fixing pre-caching image#6338

Open
wooj-stripe wants to merge 2 commits intomasterfrom
wooj/fixVending
Open

Fix vending card art by fixing pre-caching image#6338
wooj-stripe wants to merge 2 commits intomasterfrom
wooj/fixVending

Conversation

@wooj-stripe
Copy link
Copy Markdown
Collaborator

@wooj-stripe wooj-stripe commented Apr 14, 2026

Summary

Fixes vending card art through our APIs by prefetching on load or when accessed on CustomerSheet retrievePaymentOptionSelection() api. When vending, APIs return back what we currently have in cache. Approach is "best-effort" to reduce impact on loading payment sheet/customersheet.

Motivation

Currently working only if the image happens to make itself into the cache

Testing

Updated tests & manual testing

Changelog

@wooj-stripe wooj-stripe requested a review from yuki-stripe April 14, 2026 22:13
@wooj-stripe wooj-stripe marked this pull request as ready for review April 14, 2026 22:35
@wooj-stripe wooj-stripe requested review from a team as code owners April 14, 2026 22:35
guard let matchingPaymentMethod = paymentMethods.first(where: { $0.stripeId == paymentMethodId }) else {
return nil
}
matchingPaymentMethod.preloadCardArtImage(cardArtEnabled: configuration.appearance.cardArtEnabled)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I thought the idea was to block this on downloading the card art, since it's already async?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Doing so would slow down this function as well as be inconsistent with the behavior of payment sheet, so I ultimately decided against doing this.

defaultPaymentMethod: elementsSession.customer?.getDefaultPaymentMethod()
)

// Pre-fetch card art without waiting for this to finish
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you said pre-loading payment option images in general was broken, is that still true?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Correct in FlowController.swift, _ = flowController.paymentOption does not seem to have any effect.

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