#spanila
1 messages · Page 1 of 1 (latest)
hi again! can you clarify? I guess you are talking about the PaymentSheet in our iOS SDK?
hello gain, yes, exactly.
the PaymentSheet shows payment methods attached to the customer you provide it with (via the ephemeral key you create)
I guess screenshots of what you see versus what you expect to see would help here
but there is no customer, we agreed that customer is not really needed
paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'usd',
payment_method: clonedPaymentMethod.id,
automatic_payment_methods: {enabled: true},
application_fee_amount: fee,
use_stripe_sdk: true,
capture_method: 'manual',
description: event.course.name + ' - ' + U.formatDatetime(event.datetime, event.trainer?.user?.timezone) + ' - ' + user.name + ' ' + user.surname + ' ('+user.email+')',
metadata: {
eventID: event.id,
userID: self.user.id,
eventAttendanceType: U.getEventUserAttendanceTypeByCode(params.eventAttendanceType),
}
}, stripeOptions);
just clonedPaymentMethod
clonedPaymentMethod = await stripe.paymentMethods.create({
customer: user.paymentInfo.customerID,
payment_method: customer.invoice_settings.default_payment_method,
}, stripeOptions);
I think your question really is that you expect the PaymentSheet to show the payment_method that you set on the PaymentIntent, when you send the PaymentIntent client_secret to the app?
yes i guess, i wanted to see the card on ui, when i did all that work
to be honest I have no idea if it does that or not, I'll check. But usually the idea of the PaymentSheet is it lists the methods attached to the customer and lets them enter a new one
I don't know if it is designed to work with a PaymentIntent that you already attach a PaymentMethod to, looking
sure, please try. i dont understand what is that parameter even for then in PaymentIntent. if it needs customer then it should just show customer details and not need PM.... imho
what parameter?
payment_method
ID of the payment method (a PaymentMethod, Card, or compatible Source object) to attach to this PaymentIntent.
I see. But yeah overall I don't think I would use the PaymentSheet at all here
oh, thats possible, is there other alternative?
you already know the PaymentMethod you want to use so you can call a function on the frontend to directly confirm the PaymentIntent with it
I'll look it up, but for example on the web you'd call https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-existing
i see, so instead of using that ui we would show maybe confirmation dialog, and if user really wants, frontend ios confirms, then calls server and server captures.
let paymentIntentParams = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret) // from server
// you can do this, or it's not needed if you already set payment_method when creating the PI on the backend
paymentIntentParams.paymentMethodId = "pm_xxx"; // from server
STPPaymentHandler.shared().confirmPayment(withParams: paymentIntentParams, authenticationContext: self) { (handlerStatus, paymentIntent, error) in
....
....
something like that should work
and what abou additional verifications like - 3ds or such, do we need to implement that additionaly?
confirmPayment presents any actions needed like 3ds
because the payment sheet was dealing with this
so it is able to show additional ui if needed?
yes; that's why it takes a reference to self , so that it can present views on it
your view needs to inherit from STPAuthenticationContext and implement a function but it's pretty trivial and XCode should suggest everything
https://stripe.dev/stripe-ios/stripe/documentation/stripe/stpauthenticationcontext
ok i was on the phone with ios dev and project lead, it looks like the right solution 🙂