#mason-00_best-practices

1 messages ยท Page 1 of 1 (latest)

rocky baneBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1394495776557629521

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

sullen pagoda
#

Hi! How are you collecting the payment method?

sharp laurel
#

Hello! We are collecting through the payment element on web, mobile customer sheet and mobile payment sheet

sullen pagoda
#

Regarding the customer being allowed to change their payment method, how are they doing it? Is it via your website or Stripe customer portal?

sharp laurel
#

Thank you! It is through the payment element, and the mobile customer sheet

sullen pagoda
sharp laurel
#

Right, but what if the customer deletes that saved card and we attempt to charge it off session?

sullen pagoda
#

I will need your help with your end to end flow. You create a Payment Element / Mobile payment sheet to for the customer to fill in their payment method details โ†’ you save the payment method for future use โ†’ from this point, how is the customer allowed to edit / delete their payment method?

#

Do you present another Payment Element / Mobile payment sheet to them? Or can they do it on your website? Or do you use the customer portal?

sharp laurel
#

Sure. So all management is from within our applications. Either in our web app or mobile app. For our web app they can manage their saved card from within a new instance of the payment element (from a new booking flow), because we have AllowRedisplay enabled. For our mobile app they can manage it using the mobile payment sheet for the same reason, or using the mobile customer sheet. We do not use the customer portal.

#

Because ideally, we want to enable saving payment for ease of use as well.

sullen pagoda
#

Noted! Give me a moment.

sharp laurel
#

Sure thanks so much!

sullen pagoda
#

Thanks for waiting! I tested this. So if you only create a Payment Element with the payment method having allow_redisplay set to always then the customer is not able to edit the payment method. They can just decide if they wish to use it or use another payment method. They can only update the payment method if you are to use customer sessin [0, 1]

[0] https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements#save-payment-methods
[1] https://docs.stripe.com/api/customer_sessions/object#customer_session_object-components-payment_element

sharp laurel
#

You are absolutely correct, I just saw the PaymentMethodRemove param in the payment element params. So sorry I didn't see this earlier.

#

So to allow for card deletion, what would you recommend?

#

My initial thought is to check if they have multiple cards, and only allow deletion if at least 1 is present.

sullen pagoda
#

But if you were to show them the option to remove their payment method, assuming there is more than 1, they can delete all of them.

sharp laurel
#

Haha right.

#

And ideally we don't build a custom implementation to display cards, and check the case for deletion though our own backend

#

What if we disabled deletion for x number of days until their latest booking has passed?

#

After which card deletion is enabled

sullen pagoda
#

Yeap you can do that but it will be a logic you will need to determine on your end.

#

So you only create a payment element with a customer session allowing removal of the payment methods once their stay is over and you have charged any additional fee.

sharp laurel
#

Right if applicable. Giving the "host" for this example time to file a claim

#

From what you've seen is this how this use case is usually handed?

sullen pagoda
#

This is the first that I have encountered such a use case. But what you mentioned seems to be the way if you want to continue to use Stripe UI instead of your custom implementation.

sharp laurel
#

Okay, I think we'll go ahead with that implementation at least for now. The only issue I see is that this will lock all payment methods regardless of when they were individually used. But I don't think there is anything I can do about that, right?

sullen pagoda
#

What do you mean by "lock all payment methods regardless of when they were individually used"?

sharp laurel
#

Meaning If card X was used a year ago and is technically allowed to be deleted, but card Y was used yesterday both will not be deletable.

sullen pagoda
#

Yes

sharp laurel
#

Gotcha. Thanks so much for your help!