Skip to content

Commit

Permalink
Improve error handling for payment sheet w/out returnURL (stripe#3057)
Browse files Browse the repository at this point in the history
  • Loading branch information
wooj-stripe authored Nov 28, 2023
1 parent eaa2244 commit d3f328c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AddPaymentMethodViewController: UIViewController {
let paymentMethodTypes = PaymentSheet.PaymentMethodType.filteredPaymentMethodTypes(
from: intent,
configuration: configuration,
logAvailability: true
logAvailability: false
)
assert(!paymentMethodTypes.isEmpty, "At least one payment method type must be available.")
return paymentMethodTypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ extension PaymentSheetError: CustomDebugStringConvertible {
case .linkSignUpNotRequired:
return "Don't call sign up if not needed"
case .noPaymentMethodTypesAvailable(intentPaymentMethods: let intentPaymentMethods):
return "None of the payment methods on the PaymentIntent/SetupIntent can be used in PaymentSheet: \(intentPaymentMethods). You may need to set `allowsDelayedPaymentMethods` or `allowsPaymentMethodsRequiringShippingAddress` in your PaymentSheet.Configuration object."
return "None of the payment methods on the PaymentIntent/SetupIntent can be used in PaymentSheet: \(intentPaymentMethods). You may need to set `allowsDelayedPaymentMethods` or `allowsPaymentMethodsRequiringShippingAddress` or set `returnURL` in your PaymentSheet.Configuration object."
case .linkCallVerifyNotRequired:
return "Don't call verify if not needed"
case .linkingWithoutValidSession:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ final class PaymentSheetLoader {
}
}
// Ensure that there's at least 1 payment method type available for the intent and configuration.
let paymentMethodTypes = PaymentSheet.PaymentMethodType.filteredPaymentMethodTypes(from: intent, configuration: configuration)
let paymentMethodTypes = PaymentSheet.PaymentMethodType.filteredPaymentMethodTypes(from: intent, configuration: configuration, logAvailability: true)
guard !paymentMethodTypes.isEmpty else {
throw PaymentSheetError.noPaymentMethodTypesAvailable(intentPaymentMethods: intent.recommendedPaymentMethodTypes)
}
Expand Down

0 comments on commit d3f328c

Please sign in to comment.