Skip to content

CryptoOnramp SDK: Adds Ability to Receive L0 KYC Info From Apple Pay#6230

Merged
Twigz merged 18 commits into
masterfrom
mliberatore/crypto-onramp-apple-pay-kyc
Apr 8, 2026
Merged

CryptoOnramp SDK: Adds Ability to Receive L0 KYC Info From Apple Pay#6230
Twigz merged 18 commits into
masterfrom
mliberatore/crypto-onramp-apple-pay-kyc

Conversation

@mliberatore

@mliberatore mliberatore commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

When a client's PKPaymentRequest specifies collection of name .name and or .postalAddress in 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 call attachKYCInfo passing in the resulting KycInfo instance.

This change required:

  • New return type (CollectPaymentMethodResult) on collectPaymentMethod. This also brings cancelation more in line with other *Result types where cancelation is modeled as one of the possible enum cases, rather than relying on return type optionality. This is a breaking change.
  • Adding (non-public) helper extensions to convert the data collected by Apple Pay into KycInfo.
  • Minimally adapting the example app to migrate to the new return type. The example app does not implement usage of the new KycInfo being returned. More info on that in the Testing section below.
  • Minor README update.

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 e0a517e09a0a4e5a215bcab45de703bbd15803d1 and fixed conflicts (including the change from completedWithKycInfo to completed in attachKycInfoIfNeeded. Then:

  1. Launched the app and selected L0 KYC Mode from the menu on the sign in screen.
  2. Created a new account and filled out the OTP.
  3. Saw that the KYC collection step was skipped.
  4. Added a wallet address.
  5. Selected a small $ amount from the payment screen.
  6. Selected Apple Pay and completed payment (my contact has relevant billing details).
  7. Saw an onramp session creation failure. This is expected as L0 KYC session creation does not work in testmode.
  8. Checked my customer info to confirm that those fields were collected successfully and I became KYC verified.
Simulator.Screen.Recording.-.iPhone.17.-.2026-03-19.at.11.48.35.mov
  1. Ran through the same test again with a large $ amount selected in step 5 above.
  2. After auto-attaching KYC, this triggered KYC step-up from L0 to L2.
  3. Filled out just SSN + DOB, and completed ID document verification.
  4. Tapped the menu option to fetch and display KYC info to ensure the name and address appeared appropriately.
  5. Checked my customer info to confirm that those fields were collected successfully and I became KYC verified.
Simulator.Screen.Recording.-.iPhone.17.-.2026-03-19.at.11.10.48.mov

Changelog

N/A, Alpha SDK

@github-actions

github-actions Bot commented Mar 25, 2026

Copy link
Copy Markdown

⚠️ Public API changes detected:

StripeCryptoOnramp

SPI 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:

  • Do these APIs need to be public or can they be protected with @_spi(STP)?
  • If these APIs need to be public, assess whether they require an API review.

If you are modifying or removing a public API:

  • Does this require a breaking version change?
  • Do these changes require API review?

If you confirm these APIs need to be added/updated and have undergone necessary review, add the label modifies public API to this PR to acknowledge the interface change.
Additionally, if you modified or removed an existing API, ensure you update the changelog to reflect the necessary version bump for your changes. Regular public API changes require a MAJOR version bump, and SPI API changes (other than @_spi(STP)-only declarations) require a MINOR or MAJOR version bump.

ℹ️ If this comment appears to be left in error, make sure your branch is up-to-date with master.

@Twigz Twigz marked this pull request as ready for review March 25, 2026 19:46
@Twigz Twigz requested review from a team as code owners March 25, 2026 19:46
@Twigz Twigz requested a review from silasbw March 25, 2026 19:46

@jeanregisser jeanregisser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work 🎉
Clean API, defensive input handling, and solid test coverage. A few suggestions below, mostly around simplifying the enum and tightening state management.

Comment thread StripeCryptoOnramp/StripeCryptoOnrampTests/Unit/KycInfoTests.swift
@Twigz Twigz requested a review from jeanregisser March 31, 2026 21:32
jeanregisser
jeanregisser previously approved these changes Apr 2, 2026

@jeanregisser jeanregisser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🚀

@jeanregisser jeanregisser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🚀

@Twigz Twigz merged commit 031e3a4 into master Apr 8, 2026
8 of 9 checks passed
@Twigz Twigz deleted the mliberatore/crypto-onramp-apple-pay-kyc branch April 8, 2026 15:40
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.

3 participants