#spanila

1 messages ยท Page 1 of 1 (latest)

proper prairieBOT
worthy apex
#

how about adding another card?
You'd follow the same Setup Intent flow to allow users to add multiple PMs

foggy violet
#

but i thought i will be using setupintent only in case user doesnt have payment method already

#

so i can create paymentintent

#

so first time user pays i create customer, setupintent add payment method, clone it into connected account and create paymentintent for direct charge

worthy apex
foggy violet
#

and if i want to add another card, we need to do ui ourselves?

worthy apex
#

but i thought i will be using setupintent only in case user doesnt have payment method already
You'd utilise a Setup Intent in any scenario where you want to add a new PM, regardless of whether they have an existing PM or not

worthy apex
foggy violet
#

basicaly only by hitting "pay" button.

worthy apex
#

Ok, but I mean which UIs/APIs?

foggy violet
#

node and ios sdk

#

utilizing paymentshhet i think

#

im not ios dev...

worthy apex
#

I guess via the Payment Sheet, so you can just re-use that same flow to allow customers to add additional PMs

#

Is there a specific concern or something preventing you from doing that?

foggy violet
#

yes its regarding that shared platform customers that complicates everything i think

#

i cant save the info automaticaly, i need the setupintent to do it on platform customer right?

#

so i cant use paymentintent to manage cards in any way

proper prairieBOT
worthy apex
foggy violet
#

ok and then i would somehow disable card management in PaymentSheet, and add button to add new card elsewhere for instance?

#

and that button will call new setupintent for platform customer...

worthy apex
#

AFAIK, you can't disable card management (removal) in the Payment Sheet currently if you're using Customer objects

foggy violet
worthy apex
#

Hmm, is that not likely the new card saved during the payment? Can you share an example PI? Curious to see what parameters you use on creation

foggy violet
#

paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'usd',
customer: clonedCustomer? clonedCustomer.id : null,
automatic_payment_methods: {enabled: true},
application_fee_amount: fee,
use_stripe_sdk: true,
capture_method: 'manual',
setup_future_usage: 'on_session',
description: event.course.name + ' ' + U.formatDatetime(event.datetime, event.trainer?.user?.timezone),
metadata: {
eventID: event.id,
userID: self.user.id,
eventAttendanceType: U.getEventUserAttendanceTypeByCode(params.eventAttendanceType),
}
}, stripeOptions);

#

const stripeOptions = {
stripeAccount: trainerUser.paymentInfo.connectedAccountID,
apiVersion: CONFIG('stripe_api_version')
};

but this will be called ONLY if customer has paymentMethod attached.

#

otherwise i generate this

setupIntent = await stripe.setupIntents.create({
customer: user.paymentInfo.customerID,
automatic_payment_methods: {
enabled: true,
},
});

worthy apex
#

Right, but in the scenario you described you're:

  • Presenting the Payment Sheet
  • Customer deletes existing payment method(s)
  • They complete the purchase with a new card

Because of the setup_future_usage parameter you pass on PI creation, the PM used during that payment will also be saved separate to the Setup Intent

foggy violet
#

yes, that may be a mishup on my part. we already tried this and i cant really use paymentintent to store cards as paymentmethod lives in connected account and customer is platform.

worthy apex
#

s_f_u essentially allows you to save payment details during a payment with a PI, separate to a SI where there's no actual initial payment (you're just saving the card)

foggy violet
#

and if the card attaches itself into cloned customer, i cant copy it to platform customer

worthy apex
#

Assuming you're correctly saved/setup the card on the platform with a Setup Intent and cloned it to the connected account, s_f_u is redundant

foggy violet
#

ok, i understand, removing it...

worthy apex
#

Especially in your Connect scenario as you describe it

foggy violet
#

so we have adding the first card solved i think. it should work via initial payment.

#

by using setupintent and only after that using paymentintent

#

and now the adding another or removing cards - can i use some sdk view for this, or do i need to do ui with list of paymentmethods with option to remove and button to add another?

worthy apex
#

The deletion aspect that is

#

The adding another PM would jsut be the same Setup Intent and Payment Sheet flow

foggy violet
#

yea i get it, for adding, i need another endpoint that generates setupintent ๐Ÿ™‚

#

ok last hurdle is then to not allow card management via payment sheet

worthy apex
#

Yeah as I said I don't think you can prevent that currently

foggy violet
#

wel, i guess its just a ui bug, not affecting flow or anything.

#

we can say were "working on it" and when you implement it we can "fix" it ๐Ÿ˜„

worthy apex
#

That won't prevent customers from paying it just means that if they open the Payment Sheet and delete a card, then pay with a new card, that new card won't be saved

foggy violet
#

yes, they should use our ui when they want to save it. unfortunate but not deal breaker

#

and last question - when connected account creates refund - via web ui on stipe, we would like to return app_fee

#

is there any setting i can enable so its done automatically?

#

probably not, so does listening to event refund.create and then create feerefund sounds right?

worthy apex
foggy violet
#

ok, other event then. that sounds better actually, what if it failed ofc... thank you very much for help. you saved me days!!!

worthy apex
#

you're welcome

foggy violet
#

you guys have too much stuff and options, hard to navigate the docs ๐Ÿ˜„