#darth-paymentelement-savedpm

1 messages ยท Page 1 of 1 (latest)

jolly elkBOT
hasty sable
#

What do you mean? Updates are handled the same way they would be if there were no dynamic payment items on the Subscription

distant swan
#

Hello

#

I mean usually when having a subscription.update to change the user subscription from sub_1 to sub_2

#

this can be applied also when dealing with subscription witch have a dynamic price created by the user?

#

also regarding this process how paying with a given payment method should be handled? Let's say the customer has 3 pm's and you wanna let him choose to not pay with the default payment method how you do this?

hasty sable
#

Let's focus on one question at a time

distant swan
#

yes, sure.

hasty sable
#

Can you rephrase your question? I'm not sure what you're asking. Subscriptions with these dynamic prices are handled like any other subscription

distant swan
#

So

#

the platform we are building has a pay-what-you-want pricing model witch users subscribe with what price they choose

#

our issue now is if the user wants to change the subscription to a higher price or lower how can we update his subscription

hasty sable
#

It sounds like you have the right direction. Do you have more specific questions?

#

Sorry, I'm just not sure what you're asking as it sounds like you already know what to do

distant swan
#

Ok, i was not sure if what I'm thinking so that's why I've thought ask first :))

hasty sable
#

It sounds like you're on the right direction. Just have to test and see what happens.

distant swan
#

My second question is how can we allow users choose the pm they wanna when they have multiple pm added?

#

I don't see while looking over the the 2 links above no parameters that I can pass with the desired pm I wanna buy

#

am I "blind" or this is not supported?

hasty sable
distant swan
#

ok, yes, but how can then I confirm the payment method with a certain payment method, since I might not wanna use the default_payment_method

hasty sable
#

I don't understand the question. Can you rephrase?

distant swan
#

One customer can have multiple payment methods, right?

#

in the custom checkout flow if we display the payment methods how can we specify witch payment method to be charged instead of by default having the default_payment_method

hasty sable
#

What are you using to charge them? Some API endpoints accept a Payment Method ID for charging, while others (namely Subscription-based payment flows) will relyo n the default

distant swan
#

to charge the user I'm using the stripe.confirmPayment method exposed by the @stripe/react-stripe-js package

hasty sable
#

Are you passing in a Payment Intent client secret to the confirmPayment() call? Or are you passing in an elements instance?

distant swan
#

using in a elements instance

hasty sable
#

Are you sure? If you're passing in an Elements instance, then your customer will have entered a new Payment Method and the confirmPayment method will automatically use the Payment Method that gets created as a result of the customer's action in the Payment Element.

jolly elkBOT
distant swan
#

yes

#

this is how now it's implemented

#

but for subscription updates would be easier to just let the customer choose the pm

#

not to type again the card

#

make sense?

hasty sable
#

I'm confused. You're accepting a new payment method from your customer (because why else would you use the Payment Element?), but you want them to be able to choose a different payment method other than the one they just entered?

distant swan
#

Oh, so you're saying the PaymentElement is intended to be only used when you're making purchases and wanna also collected maybe the payment method but cannot support like pre-adding the card details or something

frail nymph
#

correct

#

darth-paymentelement-savedpm

#

Today you use PaymentElement to collect new payment method details. And you have your own UI to show previously saved PaymentMethods

#

We are working on combining the two but it's in beta right now so not publicly accessible

distant swan
#

Ok,I see

#

Would make sense to make this with the same component yah, I though asking since would make sense

#

but if it's not ready it's fine

frail nymph
#

you can ask for beta access to our support team maybe: https://support.stripe.com/contact
But today most websites have like a list of saved PaymentMethods and a "add new" button, even Amazon really

distant swan
#

yah, I have the same

#

a mock-up of what we have

frail nymph
#

yep that makes sense

distant swan
#

my confusion was with updating the customer subscription but also providing a payment method to be used

frail nymph
#

Unfortunately that's really vague

distant swan
#

Ok, so what we would like to have is:

  1. Show a UI where we display the payment methods the customer has
  2. Allow choosing a payment method to be used for completing the subscription update
frail nymph
#

sorry let's pause

#

Please focus purely on the API and ask the exact question about the API. Not the meta question about your UI. You seem to want to do something you can't figure out but you are too abstract

distant swan
#

Does the API support subscription updates with a specific payment method?

frail nymph
#

that's still a really vague question :p

distant swan
#

:))

distant swan
#

User A wants to change his subscription A to subscription B and does not wanna use his customer default_payment_method

#

How can I specify witch pm to be charged

frail nymph
#

yeah sorry, I'm a bit pushy because all of this would take you seconds looking at the docs

distant swan
frail nymph
#

Why are you looking at the SubscriptionItem Update API?

distant swan
#

Updates the plan or quantity of an item on a current subscription.

#

this is not supposed to work in this scenario?

frail nymph
#

That API method only updates one specific SubscriptionItem on a Subscription so no you can't also change things about the Subscription itself at the same time.

#

Sorry you are avoiding your real question which makes it really hard to help as a lot of it is me guessing

distant swan
#

Ok, got it

frail nymph
#

Your real question is: When updating a SubscriptionItem directly, how can I set the default PaymentMethod id that I want the Subscription to use?
Is that correct? And if it is then the answer is you can't

distant swan
#

Yap

#

so the answer is to use the subscription update endpoint

#

it I wanna achive this

frail nymph
#

yes

distant swan
#

Ok, got it

#

thank you

#

sorry if I stressed you out guys

#

๐Ÿ˜ฆ

frail nymph
#

No stress, just trying to push you to take a step back and ask a clear question.

distant swan
#

Yah, I was thinking many things and I wasn't clear with exactly what I wanted

#

my bad

#

I have another quick question if possible?

frail nymph
#

sure

distant swan
#

I saw in the docs stripe recommends to create each time when the user is in your checkout flow a client secret, am I right? And not reuse the first one ever created for that customer over and over

frail nymph
#

That's not really true no

distant swan
#

Ok, why? And how it's recommend

frail nymph
#

sorry, really vague again, you have a real concrete question you are not askign at all ๐Ÿ˜ฆ

#

If you have a Customer, they come, try to pay, give up, come back an hour later, then you should use the original PaymentIntent's client_secret

distant swan
#

Ok, so the first PaymentIntent client_secret ever created to a customer should be save somewhere (db probably) and used for any action witch require a PaymentIntent client_secret

frail nymph
#

I mean only if this is the same person trying to order the same thing. No point using a PaymentIntent from 2 years ago. Do what seem reasonable about their own payment attempt/order overall

distant swan
#

yaya, if it's the same customer reuse the one you first created and saved somewhere

#

if it's somebody else create one for him yah

#

But in my scenario with the pay-what-you-want pricing model I have to create a new one when the price changes, right?

frail nymph
#

๐Ÿ˜…

#

Are you using Billing and Subscriptions? Because you don't say so in your questions and I'm lost. If you do, then you don't control the PaymentIntent itself, it's the result of the Subcription's Invoice so you have no way to modify it. Plus incomplete Subscriptions expire after 24 hours.
So I'm really struggling to help you with those disconnected questions unfortunately

distant swan
#

Are you using Billing and Subscriptions? -> YES

frail nymph
#

So does my explanation already answer your question?