#jm-update-subscription-pm

1 messages · Page 1 of 1 (latest)

thin prism
#

Hello 👋
Give me a moment to take a look

buoyant thorn
#

I am not using Stripe Checkout but Stripe Elements

thin prism
#

ah okay!
The idea is the same as you can set it as default PM as suggested above

buoyant thorn
#

Do I need to create a new checkout session only to update the payment method, I better no redirect my user, I was thinking using the PaymentMethods API instead, is that possible?

thin prism
#

Oh! sorry for the confusion. You can certainly use the API. I was pointing towards the two options in order to update PM for future invoices.

buoyant thorn
#

It is ok. So returning to the original question, if I plan to use the PaymentMethods API, I need an Intent to use with Elements, do I create a new setup intent or I better use the existing one from latest_invoice.payment_intent from the subscription?

thin prism
#

You'd probably want to use a new setup intent as you're setting the payment method up for off_session usage

buoyant thorn
#

Got it, then what configuration does the new setup intent needs to have?

thin prism
#

Not sure what you mean by configuration here
Can you clarify? 😄

buoyant thorn
#

Let's say that off_session is one configuration parameter for the setup intent, do I need to set more parameters?

thin prism
#

Not really but you could add more information into the metadata so that its easier to identify and link the SetupIntent back to subscription and/or customer. You don't have to though.

      customer_id: 'cus_FOsk5sbh3ZQpAU',
      subscription_id: 'sub_8epEF0PuRhmltU',
    },
buoyant thorn
#

And then, return the intent to the front end to create the Elements inputs, create a new PaymentMethod with the Elements, and send it to the backend to update the customer's or the subscription's default_payment_method, am I right?

thin prism
#

yup, correct

buoyant thorn
#

Awesome!

#

What about updating a payment method, like the zip address or card expiry?

thin prism
#

as in for the same payment method i.e. card ?

buoyant thorn
#

Right now, yes, but I plan to add new payment methods like Apple Pay or Google Pay

#

And I would like to let the user update those methods as well

thin prism
#

Gotcha. You could compare the fingerprint of the card object to check if it already exists and then update the associated payment method
https://stripe.com/docs/api/cards/object#card_object-fingerprint
https://stripe.com/docs/api/payment_methods/update

buoyant thorn
#

This needs to be updated using Elements or with a normal input forms?

thin prism
#

I believe you can use a normal form for this

buoyant thorn
#

Got it, what about Apple Pay and Google Pay, those could be updated?

thin prism
#

You should be able to
Let me check if we have any public resources on this

buoyant thorn
#

Great

thin prism
#

Not finding any public docs on this but Apple Pay creates a card token behind the scenes that can be used to create or update a PaymentMethod

#

Same thing for Google Pay