#spanila

1 messages · Page 1 of 1 (latest)

split furnaceBOT
teal flume
#

hi again! can you clarify? I guess you are talking about the PaymentSheet in our iOS SDK?

outer bramble
#

hello gain, yes, exactly.

teal flume
#

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

outer bramble
#

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);

teal flume
#

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?

outer bramble
#

yes i guess, i wanted to see the card on ui, when i did all that work

teal flume
#

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

outer bramble
#

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

teal flume
#

what parameter?

outer bramble
#

payment_method

#

ID of the payment method (a PaymentMethod, Card, or compatible Source object) to attach to this PaymentIntent.

teal flume
#

I see. But yeah overall I don't think I would use the PaymentSheet at all here

outer bramble
#

oh, thats possible, is there other alternative?

teal flume
#

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

outer bramble
#

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.

teal flume
#
 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

outer bramble
#

and what abou additional verifications like - 3ds or such, do we need to implement that additionaly?

teal flume
#

confirmPayment presents any actions needed like 3ds

outer bramble
#

because the payment sheet was dealing with this

#

so it is able to show additional ui if needed?

teal flume
#

yes; that's why it takes a reference to self , so that it can present views on it

outer bramble
#

ok i was on the phone with ios dev and project lead, it looks like the right solution 🙂