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

Remove support for non-Card Sources from SDK #5100

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

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

davidme-stripe
Copy link
Contributor

@davidme-stripe davidme-stripe commented Jul 2, 2025

Summary

This PR removes deprecated Sources API support from the Stripe iOS SDK. The Sources API has been decommissioned and replaced by the modern PaymentMethods API.

Changes Made

  • Core API Classes: Removed support for all non-card source types from STPSource, STPSourceParams, and STPSourceEnums
  • Supporting Infrastructure: Removed STPSourcePoller, STPRedirectContext, and related polling/redirect handling
  • Test Coverage: Removed test files and mock data for deprecated source types
  • Analytics: Cleaned up source creation tracking references
  • Examples: Removed deprecated Sources API examples while preserving all PaymentMethod-based examples

Preserved Functionality

  • Card sources (still supported)
  • All PaymentMethods API functionality (unaffected)
  • PaymentSheet integration (unaffected)

Files Removed

  • 12 source type-specific classes (Bancontact, iDEAL, SEPA Debit, Sofort, Alipay, P24, EPS, Multibanco, WeChat Pay, Klarna sources)
  • STPSourcePoller and STPRedirectContext infrastructure
  • 124 test files and mock JSON data
  • 3 deprecated Sources API example view controllers

🤖 Generated with Claude Code

davidme-stripe and others added 4 commits June 30, 2025 10:49
Remove support for all non-card payment methods from the legacy Sources API, as these have been removed from the Stripe API. This includes:

- Source types: Bancontact, iDEAL, SEPA Debit, Sofort, Alipay, P24, EPS, Multibanco, WeChat Pay, Klarna
- Supporting infrastructure: STPRedirectContext, STPSourcePoller, flow handling
- Test files and mock data for non-card sources
- Non-Card Payment Examples project
- Analytics tracking for source creation

Card sources and 3D Secure sources remain fully supported. PaymentSheet and the modern PaymentMethods API are unaffected.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@davidme-stripe davidme-stripe requested review from a team as code owners July 2, 2025 16:53
@davidme-stripe davidme-stripe marked this pull request as draft July 2, 2025 16:55
davidme-stripe and others added 4 commits July 2, 2025 10:54
- Removed Sofort Sources, WeChat Pay Sources, and Klarna Sources example files
- Updated BrowseExamplesViewController to remove references to deleted Sources examples
- Renumbered remaining examples and updated row count from 35 to 32
- Preserved all PaymentMethod-based examples which use the modern API

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Removed deprecated STPSourceFlow tests from STPSourceTest.swift
- Removed references to removed non-card source types from STPSourceParamsTest.swift
- Removed flow property assertions that no longer exist

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

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

github-actions bot commented Jul 2, 2025

⚠️ Public API changes detected:

StripePayments

- public var flow: StripePayments.STPSourceFlow {
- get
- }
- get
- }
- public var owner: StripePayments.STPSourceOwner? {
- get
- }
- public var receiver: StripePayments.STPSourceReceiver? {
- get
- }
- public var redirect: StripePayments.STPSourceRedirect? {
- public var verification: StripePayments.STPSourceVerification? {
- get
- }
- public var klarnaDetails: StripePayments.STPSourceKlarnaDetails? {
- get
- }
- public var sepaDebitDetails: StripePayments.STPSourceSEPADebitDetails? {
- get
- }
- public var weChatPayDetails: StripePayments.STPSourceWeChatPayDetails? {
- get
- }
- case none
- case redirect
- case codeVerification
- case receiver
- case unknown
- public init?(rawValue: Swift.Int)
- public typealias RawValue = Swift.Int
- public var rawValue: Swift.Int {
- get
- }
- case bancontact
- case giropay
- @objc(STPSourceTypeiDEAL) case iDEAL
- case SEPADebit
- case sofort
- case alipay
- case P24
- case EPS
- case multibanco
- case weChatPay
- case klarna
- case none
- case payIn4
- case installments
- case payIn4OrInstallments
- public init?(rawValue: Swift.Int)
- public typealias RawValue = Swift.Int
- public var rawValue: Swift.Int {
- get
- }
- public var address: StripePayments.STPAddress? {
- get
- }
- public var email: Swift.String? {
- get
- }
- public var name: Swift.String? {
- get
- }
- public var phone: Swift.String? {
- get
- }
- public var verifiedAddress: StripePayments.STPAddress? {
- get
- }
- public var verifiedEmail: Swift.String? {
- get
- }
- public var verifiedName: Swift.String? {
- get
- }
- public var verifiedPhone: Swift.String? {
- get
- }
- public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- public class func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
- @objc deinit
- public var flow: StripePayments.STPSourceFlow
- public var redirect: [Swift.AnyHashable : Any]?
- public class func bancontactParams(withAmount amount: Swift.Int, name: Swift.String, returnURL: Swift.String, statementDescriptor: Swift.String?) -> StripePayments.STPSourceParams
- public class func giropayParams(withAmount amount: Swift.Int, name: Swift.String, returnURL: Swift.String, statementDescriptor: Swift.String?) -> StripePayments.STPSourceParams
- public class func idealParams(withAmount amount: Swift.Int, name: Swift.String?, returnURL: Swift.String, statementDescriptor: Swift.String?, bank: Swift.String?) -> StripePayments.STPSourceParams
- public class func sepaDebitParams(withName name: Swift.String, iban: Swift.String, addressLine1: Swift.String?, city: Swift.String?, postalCode: Swift.String?, country: Swift.String?) -> StripePayments.STPSourceParams
- public class func sofortParams(withAmount amount: Swift.Int, returnURL: Swift.String, country: Swift.String, statementDescriptor: Swift.String?) -> StripePayments.STPSourceParams
- @available(swift, obsoleted: 1.0)
- public class func objc_klarnaParams(withReturnURL returnURL: Swift.String, currency: Swift.String, purchaseCountry: Swift.String, items: [StripePayments.STPKlarnaLineItem], customPaymentMethods: [Foundation.NSNumber], billingAddress address: StripePayments.STPAddress?, billingFirstName firstName: Swift.String?, billingLastName lastName: Swift.String?, billingDOB dateOfBirth: StripePayments.STPDateOfBirth?) -> StripePayments.STPSourceParams
- public class func klarnaParams(withReturnURL returnURL: Swift.String, currency: Swift.String, purchaseCountry: Swift.String, items: [StripePayments.STPKlarnaLineItem], customPaymentMethods: [StripePayments.STPKlarnaPaymentMethods], billingAddress address: StripePayments.STPAddress? = nil, billingFirstName firstName: Swift.String? = nil, billingLastName lastName: Swift.String? = nil, billingDOB dateOfBirth: StripePayments.STPDateOfBirth? = nil) -> StripePayments.STPSourceParams
- @available(swift, obsoleted: 1.0)
- public class func objc_klarnaParams(withReturnURL returnURL: Swift.String, currency: Swift.String, purchaseCountry: Swift.String, items: [StripePayments.STPKlarnaLineItem], customPaymentMethods: [Foundation.NSNumber]) -> StripePayments.STPSourceParams
- public class func klarnaParams(withReturnURL returnURL: Swift.String, currency: Swift.String, purchaseCountry: Swift.String, items: [StripePayments.STPKlarnaLineItem], customPaymentMethods: [StripePayments.STPKlarnaPaymentMethods]) -> StripePayments.STPSourceParams
- public class func alipayParams(withAmount amount: Swift.Int, currency: Swift.String, returnURL: Swift.String) -> StripePayments.STPSourceParams
- public class func alipayReusableParams(withCurrency currency: Swift.String, returnURL: Swift.String) -> StripePayments.STPSourceParams
- public class func p24Params(withAmount amount: Swift.Int, currency: Swift.String, email: Swift.String, name: Swift.String?, returnURL: Swift.String) -> StripePayments.STPSourceParams
- public class func epsParams(withAmount amount: Swift.Int, name: Swift.String, returnURL: Swift.String, statementDescriptor: Swift.String?) -> StripePayments.STPSourceParams
- public class func multibancoParams(withAmount amount: Swift.Int, returnURL: Swift.String, email: Swift.String) -> StripePayments.STPSourceParams
- public class func wechatPay(withAmount amount: Swift.Int, currency: Swift.String, appId: Swift.String, statementDescriptor: Swift.String?) -> StripePayments.STPSourceParams
- public func redirectDictionaryWithMerchantNameIfNecessary() -> [Swift.AnyHashable : Any]
- public var address: Swift.String? {
- get
- }
- public var amountCharged: Foundation.NSNumber? {
- get
- }
- public var amountReceived: Foundation.NSNumber? {
- get
- }
- public var amountReturned: Foundation.NSNumber? {
- get
- }
- public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- public var description: Swift.String {
- @objc get
- }
- public class func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
- @objc deinit
- case pending
- case succeeded
- case failed
- case notRequired
- case unknown
- public init?(rawValue: Swift.Int)
- public typealias RawValue = Swift.Int
- public var rawValue: Swift.Int {
- get
- }
- public var returnURL: Foundation.URL {
- get
- }
- public var status: StripePayments.STPSourceRedirectStatus {
- get
- }
- public var url: Foundation.URL {
- get
- }
- public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- public var description: Swift.String {
- @objc get
- }
- public class func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
- @objc deinit
- case pending
- case succeeded
- case failed
- case unknown
- public init?(rawValue: Swift.Int)
- public typealias RawValue = Swift.Int
- public var rawValue: Swift.Int {
- get
- }
- public var attemptsRemaining: Foundation.NSNumber? {
- get
- }
- public var status: StripePayments.STPSourceVerificationStatus {
- get
- }
- public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- public var description: Swift.String {
- @objc get
- }
- public class func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
- @objc deinit
- case SKU
- case tax
- case shipping
- public init?(rawValue: Swift.Int)
- public typealias RawValue = Swift.Int
- public var rawValue: Swift.Int {
- get
- }
- public var itemType: StripePayments.STPKlarnaLineItemType
- public var itemDescription: Swift.String
- public var quantity: Foundation.NSNumber
- public var totalAmount: Foundation.NSNumber
- public init(itemType: StripePayments.STPKlarnaLineItemType, itemDescription: Swift.String, quantity: Foundation.NSNumber, totalAmount: Foundation.NSNumber)
- @objc deinit
- @objc deinit
- public var clientToken: Swift.String? {
- get
- }
- public var purchaseCountry: Swift.String? {
- get
- }
- public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- public var description: Swift.String {
- @objc get
- }
- public class func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
- @objc deinit
- public var last4: Swift.String? {
- get
- }
- public var bankCode: Swift.String? {
- get
- }
- public var country: Swift.String? {
- get
- }
- public var fingerprint: Swift.String? {
- get
- }
- public var mandateReference: Swift.String? {
- get
- }
- public var mandateURL: Foundation.URL? {
- get
- }
- public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- public var description: Swift.String {
- @objc get
- }
- public class func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
- public var weChatAppURL: Swift.String? {
- get
- }
- public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- public var description: Swift.String {
- @objc get
- }
- public class func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self?
- @objc deinit
- public func startPollingSource(withId identifier: Swift.String, clientSecret secret: Swift.String, timeout: Foundation.TimeInterval, completion: @escaping StripePayments.STPSourceCompletionBlock)
- public func stopPollingSource(withId identifier: Swift.String)
- @objc(STPRedirectContextAppRedirectError) case appRedirectError
- public init?(rawValue: Swift.Int)
- public typealias RawValue = Swift.Int
- public var rawValue: Swift.Int {
- get
- }
- case notStarted
- case inProgress
- case cancelled
- case completed
- public init?(rawValue: Swift.Int)
- public typealias RawValue = Swift.Int
- public var rawValue: Swift.Int {
- get
- }
- public static let STPRedirectContextErrorDomain: Swift.String
- public var state: StripePayments.STPRedirectContextState {
- get
- }
- public init?(source: StripePayments.STPSource, completion: @escaping StripePayments.STPRedirectContextSourceCompletionBlock)
- public init?(paymentIntent: StripePayments.STPPaymentIntent, completion: @escaping StripePayments.STPRedirectContextPaymentIntentCompletionBlock)
- public func startRedirectFlow(from presentingViewController: UIKit.UIViewController)
- public func startSafariViewControllerRedirectFlow(from presentingViewController: UIKit.UIViewController)
- public func startSafariAppRedirectFlow()
- public func cancel()
- @objc deinit
- public func presentationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController?, source: UIKit.UIViewController) -> UIKit.UIPresentationController?
- public func safariViewControllerDidFinish(_ controller: SafariServices.SFSafariViewController)
- public func safariViewController(_ controller: SafariServices.SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Swift.Bool)
- public func safariViewController(_ controller: SafariServices.SFSafariViewController, initialLoadDidRedirectTo URL: Foundation.URL)
- public var description: Swift.String {
- get
- }
- public var description: Swift.String {
- get
- }
- public var description: Swift.String {
- get
- }
- public var description: Swift.String {
- get
- }
- public var description: Swift.String {
- get
- }
- public var description: Swift.String {
- get
- }
- public var description: Swift.String {
- get
- }

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 and bypass this check.

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

Copy link

github-actions bot commented Jul 2, 2025

🚨 New dead code detected in this PR:

STPSourceParams.swift:10 warning: Imported module 'StripeCore' is unused
STPSourceParams.swift:124 warning: Parameter 'returnURL' 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.

Copy link

emerge-tools bot commented Jul 2, 2025

8 builds decreased size

Name Version Download Change Install Change Approval
StripeSize
com.stripe.StripeSize
1.0 (1) 2.1 MB ⬇️ 52.4 kB (-2.41%) 6.9 MB ⬇️ 158.3 kB (-2.24%) N/A
StripePaymentsSize
com.stripe.StripePaymentsSize
1.0 (1) 1.2 MB ⬇️ 49.6 kB (-4.01%) 4.2 MB ⬇️ 161.6 kB (-3.78%) N/A
StripePaymentsUISize
com.stripe.StripePaymentsUISize
1.0 (1) 1.9 MB ⬇️ 50.7 kB (-2.56%) 6.4 MB ⬇️ 158.3 kB (-2.44%) N/A
StripePaymentSheetSize
com.stripe.StripePaymentSheetSize
1.0 (1) 4.1 MB ⬇️ 48.9 kB (-1.17%) 12.0 MB ⬇️ 156.9 kB (-1.29%) N/A
StripeIdentitySize
com.stripe.StripeIdentitySize
1.0 (1) 1.4 MB ⬇️ 798 B (-0.06%) 4.4 MB ⬇️ 1.7 kB (-0.04%) N/A
StripeApplePaySize
com.stripe.StripeApplePaySize
1.0 (1) 503.2 kB ⬇️ 733 B (-0.15%) 1.7 MB ⬇️ 1.7 kB (-0.1%) N/A
StripeFinancialConnectionsSize
com.stripe.StripeFinancialConnectionsSize
1.0 (1) 1.6 MB ⬇️ 693 B (-0.04%) 5.0 MB ⬇️ 1.7 kB (-0.03%) N/A
StripeConnectSize
com.stripe.StripeConnectSize
1.0 (1) 1.8 MB ⬇️ 889 B (-0.05%) 5.9 MB ⬇️ 1.7 kB (-0.03%) N/A

StripeSize 1.0 (1)
com.stripe.StripeSize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 158.3 kB (-2.24%)
Total download size change: ⬇️ 52.4 kB (-2.41%)

Largest size changes

Item Install Size Change
🗑 StripePayments.STPRedirectContext ⬇️ -19.5 kB
DYLD.Exports ⬇️ -13.4 kB
🗑 StripePayments.STPSourceParams.klarnaParams(withReturnURL,currenc... ⬇️ -9.2 kB
🗑 StripePayments.STPSourceRedirect ⬇️ -6.5 kB
🗑 StripePayments.STPSourceSEPADebitDetails ⬇️ -6.4 kB
View Treemap

Image of diff

StripePaymentsSize 1.0 (1)
com.stripe.StripePaymentsSize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 161.6 kB (-3.78%)
Total download size change: ⬇️ 49.6 kB (-4.01%)

Largest size changes

Item Install Size Change
🗑 StripePayments.STPRedirectContext ⬇️ -19.5 kB
DYLD.Exports ⬇️ -15.9 kB
🗑 StripePayments.STPSourceParams.klarnaParams(withReturnURL,currenc... ⬇️ -9.2 kB
🗑 StripePayments.STPSourceRedirect ⬇️ -6.5 kB
🗑 StripePayments.STPSourceSEPADebitDetails ⬇️ -6.4 kB
View Treemap

Image of diff

StripePaymentsUISize 1.0 (1)
com.stripe.StripePaymentsUISize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 158.3 kB (-2.44%)
Total download size change: ⬇️ 50.7 kB (-2.56%)

Largest size changes

Item Install Size Change
🗑 StripePayments.STPRedirectContext ⬇️ -19.5 kB
DYLD.Exports ⬇️ -13.2 kB
🗑 StripePayments.STPSourceParams.klarnaParams(withReturnURL,currenc... ⬇️ -9.2 kB
🗑 StripePayments.STPSourceRedirect ⬇️ -6.5 kB
🗑 StripePayments.STPSourceSEPADebitDetails ⬇️ -6.4 kB
View Treemap

Image of diff

StripePaymentSheetSize 1.0 (1)
com.stripe.StripePaymentSheetSize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 156.9 kB (-1.29%)
Total download size change: ⬇️ 48.9 kB (-1.17%)

Largest size changes

Item Install Size Change
🗑 StripePayments.STPRedirectContext ⬇️ -19.5 kB
DYLD.Exports ⬇️ -13.4 kB
🗑 StripePayments.STPSourceParams.klarnaParams(withReturnURL,currenc... ⬇️ -9.2 kB
🗑 StripePayments.STPSourceRedirect ⬇️ -6.5 kB
🗑 StripePayments.STPSourceSEPADebitDetails ⬇️ -6.4 kB
View Treemap

Image of diff

StripeIdentitySize 1.0 (1)
com.stripe.StripeIdentitySize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 1.7 kB (-0.04%)
Total download size change: ⬇️ 798 B (-0.06%)

Largest size changes

Item Install Size Change
StripeCore.STPAPIClient.STPAPIClient ⬇️ -764 B
Other ⬇️ -982 B
View Treemap

Image of diff

StripeApplePaySize 1.0 (1)
com.stripe.StripeApplePaySize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 1.7 kB (-0.1%)
Total download size change: ⬇️ 733 B (-0.15%)

Largest size changes

Item Install Size Change
StripeCore.STPAPIClient.STPAPIClient ⬇️ -764 B
Other ⬇️ -982 B
View Treemap

Image of diff

StripeFinancialConnectionsSize 1.0 (1)
com.stripe.StripeFinancialConnectionsSize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 1.7 kB (-0.03%)
Total download size change: ⬇️ 693 B (-0.04%)

Largest size changes

Item Install Size Change
StripeCore.STPAPIClient.STPAPIClient ⬇️ -764 B
Other ⬇️ -974 B
View Treemap

Image of diff

StripeConnectSize 1.0 (1)
com.stripe.StripeConnectSize

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬇️ 1.7 kB (-0.03%)
Total download size change: ⬇️ 889 B (-0.05%)

Largest size changes

Item Install Size Change
StripeCore.STPAPIClient.STPAPIClient ⬇️ -764 B
Other ⬇️ -974 B
View Treemap

Image of diff


🛸 Powered by Emerge Tools

Comment trigger: Size diff threshold of 100.00kB exceeded

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.

1 participant