#drewtester-ios
1 messages · Page 1 of 1 (latest)
When displaying the drop in ui on the iOS app we are prompted with a list of payment methods along with a button that says add card that then prompts the user to add card information. Is there a way to directly display the add card info scene and effectively skip the list of payment methods?
You're referring to the list of saved payment methods, right?
TLDR we want to use the drop in ui just to collect payment information and aren’t really concerned with the result of the setup intetent
Yes
Is your integration currently using Customer and Ephemeral Keys when setting up the Payment Sheet? I believe if you omit those then we won't show saved payment methods
Yes it is and we tried omitting those keys but then the sheet doesn’t show up at all
Can you show me what you omitted?
When initializing the customer on the payment sheet it takes in a non optional ephemeral key string value as well
Can you show me your specific code?
It looks like so
if let configuration = requestState.response {
STPAPIClient.shared.publishableKey = configuration.publishableKey
guard let id = configuration.stripeCustomerId,
let intent = configuration.setupIntent,
let ephemeralKey = configuration.ephemeralKey else {
return
}
var paymentSheetConfiguration = PaymentSheet.Configuration()
paymentSheetConfiguration.merchantDisplayName = "LLC,"
paymentSheetConfiguration.customer = .init(id: id, ephemeralKeySecret: ephemeralKey)
paymentSheetConfiguration.allowsDelayedPaymentMethods = true
$0.paymentSheet = PaymentSheet(setupIntentClientSecret: intent, configuration: paymentSheetConfiguration)
}
so what we did was change it to paymentSheetConfiguration.customer = .init(id: id, ephemeralKeySecret: "")
and that no longer works for the drop in UI
You should just remove that line entirely - so don't set paymentSheetConfiguration.customer at all
Will that still attach the new payment method to the customer though?
Btw giving it a run now!
If won't allow you to select the "Save this card ..." checkbox in the UI anymore (I believe we won't display it), but when you create the Setup Intent as long as you pass in a Customer (https://stripe.com/docs/api/setup_intents/object?event_types-payment_intent.payment_failed#setup_intent_object-customer) then the Payment Method should get automatically attached to the customer
Awesome this is working great, thank you much!