Default payment does not work
Summary
when I set a new default card for a user ( either stripe dashboard or API), the new default card doesn't set for user on PaymentSheet
Code to reproduce
StripeAPI.defaultPublishableKey = paymentDetail.publishableKey
var configuration = PaymentSheet.Configuration()
configuration.merchantDisplayName = "XXX Test"
configuration.customer = .init(id: customerId, ephemeralKeySecret: ephemeralKeySecret)
configuration.returnURL = "\(Constants.paymentURLScheme)://stripe-redirect"
configuration.defaultBillingDetails.address.country = "GR"
configuration.applePay = .init(merchantId: "merchant.gr.thelistapp", merchantCountryCode: "GR")
let paymentSheet = PaymentSheet(paymentIntentClientSecret: paymentIntentClientSecret, configuration: configuration)
paymentSheet.present(from: self) { [weak self] (paymentResult) in
switch paymentResult {
case .completed:
print("success")
case .canceled:
break
case .failed(let error):
print("faliure")
}
}
iOS version
iOS 15 ( deployment target 11 and more)
Installation method
Cocoapods
SDK version
21.12.0
Other information
Hi @Mohsenkhodadadzadehthelist, thanks for the feedback! The last selected card preference in PaymentSheet is only maintained locally — it isn't synced with the default card for billing in the Dashboard and API. You can set this yourself from your backend using a SetupIntent. If you'd like more help with your integration, I'd recommend reaching out to https://support.stripe.com/.
@davidme-stripe thanks for your response, as you wrote the payment sheet doesn't update with changes related to default card on the server, so could you elaborate me how to modify selected card on the payment sheet manually ? ( I couldn't find my answer on the link you mentioned)