-
Notifications
You must be signed in to change notification settings - Fork 952
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
Instant Debits: first iteration of Instant Debits in Payment Sheet #3528
Conversation
11c541c
to
0d9cc61
Compare
StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentMethodType.swift
Outdated
Show resolved
Hide resolved
if case .new(let confirmParams) = paymentOption { | ||
if let paymentMethodId = confirmParams.instantDebitsLinkedBank?.paymentMethodId { | ||
params.paymentMethodId = paymentMethodId | ||
params.paymentMethodParams = nil | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might need updating
if case .new(let confirmParams) = paymentOption { | ||
if let paymentMethodId = confirmParams.instantDebitsLinkedBank?.paymentMethodId { | ||
setupIntentParams.paymentMethodID = paymentMethodId | ||
setupIntentParams.paymentMethodParams = nil | ||
|
||
let mandateCustomerAcceptanceParams = STPMandateCustomerAcceptanceParams() | ||
let onlineParams = STPMandateOnlineParams(ipAddress: "", userAgent: "") | ||
// Tell Stripe to infer mandate info from client | ||
onlineParams.inferFromClient = true | ||
mandateCustomerAcceptanceParams.onlineParams = onlineParams | ||
mandateCustomerAcceptanceParams.type = .online | ||
setupIntentParams.mandateData = STPMandateDataParams(customerAcceptance: mandateCustomerAcceptanceParams) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might need updating
...StripePaymentSheet/Source/PaymentSheet/PaymentSheetFormFactory/PaymentSheetFormFactory.swift
Outdated
Show resolved
Hide resolved
...StripePaymentSheet/Source/PaymentSheet/USBankAccount/InstantDebitsPaymentMethodElement.swift
Outdated
Show resolved
Hide resolved
StripePayments/StripePayments/Source/PaymentHandler/STPPaymentHandler.swift
Show resolved
Hide resolved
0d9cc61
to
f61d6a2
Compare
StripePayments/StripePayments/Source/API Bindings/Models/ACH/STPCollectBankAccountParams.swift
Outdated
Show resolved
Hide resolved
...yments/StripePayments/Source/API Bindings/Models/PaymentMethods/STPPaymentMethodParams.swift
Show resolved
Hide resolved
f61d6a2
to
e7a81a8
Compare
|
Name | Version | Download | Change | Install | Change | Approval |
---|---|---|---|---|---|---|
StripeApplePaySize com.stripe.StripeApplePaySize |
1.0 (1) | 422.3 kB | ⬆️ 240 B (0.06%) | 1.5 MB | ⬆️ 1.7 kB (0.11%) | N/A |
StripePaymentsSize com.stripe.StripePaymentsSize |
1.0 (1) | 1.1 MB | ⬆️ 856 B (0.08%) | 3.9 MB | ⬆️ 2.6 kB (0.07%) | N/A |
StripePaymentSheetSize com.stripe.StripePaymentSheetSize |
1.0 (1) | 3.2 MB | ⬆️ 10.8 kB (0.34%) | 9.6 MB | ⬆️ 27.3 kB (0.29%) | N/A |
StripeSize com.stripe.StripeSize |
1.0 (1) | 2.3 MB | ⬆️ 1.3 kB (0.05%) | 7.6 MB | ⬆️ 2.6 kB (0.03%) | N/A |
StripePaymentsUISize com.stripe.StripePaymentsUISize |
1.0 (1) | 1.8 MB | ⬆️ 1.3 kB (0.07%) | 6.1 MB | ⬆️ 3.0 kB (0.05%) | N/A |
StripeFinancialConnectionsSize com.stripe.StripeFinancialConnectionsSize |
1.0 (1) | 1.2 MB | ⬆️ 9.8 kB (0.84%) | 3.9 MB | ⬆️ 23.5 kB (0.61%) | N/A |
StripeApplePaySize 1.0 (1)
com.stripe.StripeApplePaySize
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 1.7 kB (0.11%)
Total download size change: ⬆️ 240 B (0.06%)
Largest size changes
Item | Install Size Change |
---|---|
📝 StripeCore.FinancialConnectionsSDKResult.Completed.value witness | ⬆️ 624 B |
Other | ⬆️ 1.0 kB |
StripePaymentsSize 1.0 (1)
com.stripe.StripePaymentsSize
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 2.6 kB (0.07%)
Total download size change: ⬆️ 856 B (0.08%)
Largest size changes
Item | Install Size Change |
---|---|
🗑 StripePayments.StubbedLinkedBank | ⬇️ -1.2 kB |
📝 StripePayments.StubbedFinancialConnectionsLinkedBank.value witnes... | ⬆️ 740 B |
📝 StripeCore.FinancialConnectionsSDKResult.Completed.value witness | ⬆️ 624 B |
StripePayments.STPAPIClient.linkAccountSessions(endpoint,clientSe... | ⬆️ 536 B |
Other | ⬆️ 1.9 kB |
StripePaymentSheetSize 1.0 (1)
com.stripe.StripePaymentSheetSize
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 27.3 kB (0.29%)
Total download size change: ⬆️ 10.8 kB (0.34%)
Largest size changes
Item | Install Size Change |
---|---|
📝 StripePaymentSheet.AddPaymentMethodViewController.handleCollectIn... | ⬆️ 2.7 kB |
📝 StripePaymentSheet.PaymentSheetFormFactory.makeInstantDebits | ⬆️ 2.0 kB |
📝 StripePaymentSheet.InstantDebitsPaymentMethodElement.didTapXIcon | ⬆️ 1.5 kB |
📝 StripePaymentSheet.InstantDebitsPaymentMethodElement.init(configu... | ⬆️ 1.5 kB |
🗑 StripePayments.StubbedLinkedBank | ⬇️ -1.2 kB |
StripeSize 1.0 (1)
com.stripe.StripeSize
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 2.6 kB (0.03%)
Total download size change: ⬆️ 1.3 kB (0.05%)
Largest size changes
Item | Install Size Change |
---|---|
🗑 StripePayments.StubbedLinkedBank | ⬇️ -1.2 kB |
📝 StripePayments.StubbedFinancialConnectionsLinkedBank.value witnes... | ⬆️ 740 B |
📝 StripeCore.FinancialConnectionsSDKResult.Completed.value witness | ⬆️ 624 B |
StripePayments.STPAPIClient.linkAccountSessions(endpoint,clientSe... | ⬆️ 536 B |
Other | ⬆️ 1.9 kB |
StripePaymentsUISize 1.0 (1)
com.stripe.StripePaymentsUISize
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 3.0 kB (0.05%)
Total download size change: ⬆️ 1.3 kB (0.07%)
Largest size changes
Item | Install Size Change |
---|---|
🗑 StripePayments.StubbedLinkedBank | ⬇️ -1.2 kB |
📝 StripePayments.StubbedFinancialConnectionsLinkedBank.value witnes... | ⬆️ 740 B |
📝 StripeCore.FinancialConnectionsSDKResult.Completed.value witness | ⬆️ 624 B |
StripePayments.STPAPIClient.linkAccountSessions(endpoint,clientSe... | ⬆️ 536 B |
Other | ⬆️ 2.3 kB |
StripeFinancialConnectionsSize 1.0 (1)
com.stripe.StripeFinancialConnectionsSize
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 23.5 kB (0.61%)
Total download size change: ⬆️ 9.8 kB (0.84%)
Largest size changes
Item | Install Size Change |
---|---|
📝 StripeFinancialConnections.HostControllerResult.value witness | ⬆️ 3.9 kB |
📝 StripeFinancialConnections.HostControllerResult.Completed.value w... | ⬆️ 3.6 kB |
📝 StripeFinancialConnections.FinancialConnectionsWebFlowViewControl... | ⬆️ 1.4 kB |
StripeFinancialConnections.HostController.hostViewController(didF... | ⬆️ 1.4 kB |
📝 StripeFinancialConnections.FinancialConnectionsWebFlowViewControl... | ⬆️ 1.3 kB |
🛸 Powered by Emerge Tools
0763e43
to
5eb722c
Compare
StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentMethodType.swift
Outdated
Show resolved
Hide resolved
6529b1c
to
98735d2
Compare
StripePayments- get
- }
- @objc public var mobilePay: StripePayments.STPPaymentMethodMobilePay? {
+ case instantDebits
- @objc deinit
- @objc public var allResponseFields: [Swift.AnyHashable : Any] {
- get
- }
- @objc override dynamic public var description: Swift.String {
- @objc get
- }
- @objc public static func decodedObject(fromAPIResponse response: [Swift.AnyHashable : Any]?) -> Self? StripeCore+ public enum Name : Swift.String {
+ case open
+ case manualEntryInitiated
+ case consentAcquired
+ case searchInitiated
+ case institutionSelected
+ case institutionAuthorized
+ case accountsSelected
+ case success
+ case error
+ case cancel
+ case flowLaunchedInBrowser
+ public init?(rawValue: Swift.String)
+ public typealias RawValue = Swift.String
+ public var rawValue: Swift.String {
+ get
+ }
+ }
+ public struct Metadata {
+ public let dictionary: [Swift.String : Any]
+ public var manualEntry: Swift.Bool? {
+ get
+ }
+ public var institutionName: Swift.String? {
+ get
+ }
+ public var errorCode: StripeCore.FinancialConnectionsEvent.ErrorCode? {
+ get
+ }
+ }
+ public enum ErrorCode : Swift.String {
+ case accountNumbersUnavailable
+ case accountsUnavailable
+ case noDebitableAccount
+ case authorizationFailed
+ case institutionUnavailablePlanned
+ case institutionUnavailableUnplanned
+ case institutionTimeout
+ case unexpectedError
+ case sessionExpired
+ case failedBotDetection
+ public init?(rawValue: Swift.String)
+ public typealias RawValue = Swift.String
+ public var rawValue: Swift.String {
+ get
+ }
+ }
+ public let name: StripeCore.FinancialConnectionsEvent.Name
+ public let metadata: StripeCore.FinancialConnectionsEvent.Metadata
- public enum Name : Swift.String {
- case open
- case manualEntryInitiated
- case consentAcquired
- case searchInitiated
- case institutionSelected
- case institutionAuthorized
- case accountsSelected
- case success
- case error
- case cancel
- case flowLaunchedInBrowser
- public init?(rawValue: Swift.String)
- public typealias RawValue = Swift.String
- public var rawValue: Swift.String {
- get
- }
- }
- public struct Metadata {
- public let dictionary: [Swift.String : Any]
- public var manualEntry: Swift.Bool? {
- get
- }
- public var institutionName: Swift.String? {
- get
- }
- public var errorCode: StripeCore.FinancialConnectionsEvent.ErrorCode? {
- get
- }
- }
- public enum ErrorCode : Swift.String {
- case accountNumbersUnavailable
- case accountsUnavailable
- case noDebitableAccount
- case authorizationFailed
- case institutionUnavailablePlanned
- case institutionUnavailableUnplanned
- case institutionTimeout
- case unexpectedError
- case sessionExpired
- case failedBotDetection
- public init?(rawValue: Swift.String)
- public typealias RawValue = Swift.String
- public var rawValue: Swift.String {
- get
- }
- }
- public let name: StripeCore.FinancialConnectionsEvent.Name
- public let metadata: StripeCore.FinancialConnectionsEvent.Metadata 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 |
98735d2
to
2e565e1
Compare
intent.supportsLink, | ||
!recommendedStripePaymentMethodTypes.contains(.USBankAccount), | ||
!intent.isDeferredIntent, | ||
intent.linkFundingSources?.contains(.bankAccount) == true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for .bankAccount
to appear in linkFundingSources
has a bunch of extra controls so this if-statement is unlikely to be "accidentally" executed
for example, there's a special flag that needs to be enabled for this mobile Instant Debits feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried this might cause older SDK versions to see a half-finished version of Instant Debits when this rolls out more widely. We'll want to make sure to check server-side that the request has the minimum SDK version (the one you end up GA-ing in) or a flag before returning .bankAccount
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes great point! We will make sure to account for this (this is quite common in Financial Connections too - and we even have some custom backend code/"library" to handle this type of versioning easier across platforms). It's a little sad our flag system does not seem to support versioning as well.
@@ -445,6 +445,7 @@ extension PlaygroundController { | |||
"use_link": settings.linkEnabled == .on, | |||
"use_manual_confirmation": settings.integrationType == .deferred_mc, | |||
"require_cvc_recollection": settings.requireCVCRecollection == .on, | |||
// "supported_payment_methods": ["card", "link"], // Uncomment to override payment methods (also make sure Automatic PM's is off) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now, this needs to be uncommented for Instant Debits to show up via playground
there's a precedent for it below (😁 ):
// "set_shipping_address": true // Uncomment to make server vend PI with shipping address populated
likely not the end state we want but its OK for now given the state of the project (still iterating on design etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does turning the Link flag on work? That should set [card, link]
as the PMs. If this is necessary, might be nice to make it a switch, it's not too difficult to add a new one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the Link flag? Or, in other words, given the current state, what would I change/do to try turning the Link flag on? (also asked some other folks in the meanwhile too)
I do see this (...but doesn't seem to do the intended):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be it — if it's on
, the backend should send [card, link, (a few others)]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that on...
in:
static func filteredPaymentMethodTypes(from intent: Intent, configuration: Configuration, logAvailability: Bool = false) -> [PaymentMethodType]
intent.recommendedPaymentMethodTypes
returns:
(lldb) po intent.recommendedPaymentMethodTypes
▿ 7 elements
- 0 : card
- 1 : link
- 2 : afterpayClearpay
- 3 : USBankAccount
- 4 : klarna
- 5 : Amazon Pay
- 6 : affirm
they key problem, as I understand it, is that the "USBankAccount" is returned (where if that exists, Instant Debits is disabled - by intent.linkFundingSources?.contains(.bankAccount) == true
NOT being true)
LMK if there's other easy way around this, right now Android added a comma-separated list to the playground app to support this through the UI and the current plan was to just copy it: stripe/stripe-android#8428
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, got it! That makes sense to me.
// TODO(kgaidis): localize | ||
string = "By continuing, you agree to authorize payments pursuant to <terms>these terms</terms>." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not the end state we want but its OK for now given the state of the project (still iterating on design, API's are private, feature behind a flag etc.)
…ts in payment sheet which also connections to financial connections SDK.
2e565e1
to
2de23f5
Compare
2de23f5
to
1b9fbd7
Compare
## Summary my [recently merged PR](#3528) intersected with another [recently merged PR](#3592) so right now there are build errors on `master` ## Testing Build now succeeds & make sure tests pass on the PR (this Instant Debits feature is actually unreleased and am still iterating on it as we speak so will be testing it a lot in [other PR's](#3585) too)
## Summary This PR adds tests for Instant Debits in Payment Sheet. This was the PR that introduced Instant Debits: - #3528 This PR also introduces a new field in the Payment Sheet app ("supported payment methods"). It's a little funky, but I copied what Android did: - stripe/stripe-android#8428 ## Testing Tests passed in PR/bitrise (https://app.bitrise.io/build/18ab4632-a2fb-4740-905e-43b319c79fd7): ``` ✔ testPaymentIntent_instantDebits on 'Clone 2 of iPhone 12 mini - PaymentSheetUITest-Runner (18516)' (41.433 seconds) ✔ testSetupIntent_instantDebits on 'Clone 2 of iPhone 12 mini - PaymentSheetUITest-Runner (18516)' (44.803 seconds) ``` Tests passed in Xcode: ![Screenshot 2024-05-16 at 1 24 50 PM](https://github.com/stripe/stripe-ios/assets/105514761/ad9f814d-088d-41f5-a33a-d6f5ab4131ef) This is the new field: ![Simulator Screenshot - Clone 1 of iPhone 12 mini - 2024-05-16 at 13 21 57](https://github.com/stripe/stripe-ios/assets/105514761/20c7e128-f1a5-4165-8ec3-2af5ab4a9012)
Summary
This PR implements the first iteration of Instant Debits in the Payment Sheet. The PR:
Testing
See two videos:
PaymentIntent Succeeds
payment_intent.mp4
SetupIntent Succeeds
setup_intent.mp4
Financial Connections Still Works
https://app.bitrise.io/build/30cd250d-0695-4af1-bd81-5c5de2f882f3