CryptoOnramp SDK: Adds Ability to Receive L0 KYC Info From Apple Pay#6230
Merged
Conversation
StripeCryptoOnrampSPI API+ @_spi(CryptoOnrampAlpha) get
- @_spi(CryptoOnrampAlpha) @_Concurrency.MainActor final public func collectPaymentMethod(type: StripeCryptoOnramp.PaymentMethodType, from viewController: UIKit.UIViewController) async throws -> StripeCryptoOnramp.PaymentMethodDisplayData?
+ @_spi(CryptoOnrampAlpha) @_Concurrency.MainActor final public func collectPaymentMethod(type: StripeCryptoOnramp.PaymentMethodType, from viewController: UIKit.UIViewController) async throws -> StripeCryptoOnramp.CollectPaymentMethodResult
+ @_spi(CryptoOnrampAlpha) case canceled
+ @_spi(CryptoOnrampAlpha) case completed(displayData: StripeCryptoOnramp.PaymentMethodDisplayData, kycInfo: StripeCryptoOnramp.KycInfo?)
+ @_spi(CryptoOnrampAlpha) public var displayData: StripeCryptoOnramp.PaymentMethodDisplayData? {
+@_spi(CryptoOnrampAlpha) extension StripeCryptoOnramp.CollectPaymentMethodResult {
+@_spi(CryptoOnrampAlpha) public enum CollectPaymentMethodResult {If you are adding a new public API consider the following:
If you are modifying or removing a public API:
If you confirm these APIs need to be added/updated and have undergone necessary review, add the label ℹ️ If this comment appears to be left in error, make sure your branch is up-to-date with |
Merged
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a client's
PKPaymentRequestspecifies collection of name.nameand or.postalAddressin its billing contact fields, this information is passed back to the caller on success of payment method collection. This would allow clients to skip L0 KYC collection before a collecting payment method, and when Apple Paying, they could choose to either pre-fill a KYC data collection form, or simply callattachKYCInfopassing in the resultingKycInfoinstance.This change required:
CollectPaymentMethodResult) oncollectPaymentMethod. This also brings cancelation more in line with other*Resulttypes where cancelation is modeled as one of the possible enum cases, rather than relying on return type optionality. This is a breaking change.public) helper extensions to convert the data collected by Apple Pay intoKycInfo.KycInfobeing returned. More info on that in the Testing section below.READMEupdate.Motivation
I don’t have a PRD for this, but this comes via request from the crypto team. To open the link in Stripe Slack, paste/send this Lickability Slack link to Slackbot and it should convert it.
Testing
Adding the ability to exercise this from the example app requires more thinking and more work. We currently support
livemode, a new L0 KYC Mode introduced in #6198, and to support filling KYC details via Apple pay, we'd need to skip KYC info collection after auth, so that would require a new mutually exclusive mode to L0 KYC Mode. I want to avoid adding heavier conditional logic to accomplish this for the time being, to keep the example app from becoming too complex as a reference point.I did test this feature with the example app, however, by applying temporary changes to the example app to allow for this to be exercised, which can be seen in commit 43b06aa. To test, I ran
git revert -n e0a517e09a0a4e5a215bcab45de703bbd15803d1and fixed conflicts (including the change fromcompletedWithKycInfotocompletedinattachKycInfoIfNeeded. Then:Simulator.Screen.Recording.-.iPhone.17.-.2026-03-19.at.11.48.35.mov
Simulator.Screen.Recording.-.iPhone.17.-.2026-03-19.at.11.10.48.mov
Changelog
N/A, Alpha SDK