#shaon

1 messages · Page 1 of 1 (latest)

open sequoiaBOT
coarse plank
#

Hi there!

#

What do you mean by "get the payment intent from stripe"?

hybrid rose
#

So I'm using stripe elements in a checkout screen whereby the user enters in some credit card details. Historically I've used the following:

stripe.Subscription.retrieve(
subscription_id,
stripe_account=stripe_app_id,
expand=["latest_invoice.payment_intent"],
api_key=api_key,
)

payment_intent = subscription["latest_invoice"]["payment_intent"]

But this will only get me the payment intent from the last time the user paid but not the new payment method the user just used

coarse plank
#

What is your end goal? To create a new subscription?

hybrid rose
#

Yes correct

coarse plank
#

Do you have an existing payment method you want to reuse, or you want to collect a new payment method from the customer?

hybrid rose
#

Yes exactly

#

So what will happen sometimes is a user will have paid for something but then they want to change their plan

open sequoiaBOT
hybrid rose
#

but pay with a new credit card that is different to the one they used for the last invoice

#

currently my implementation will just use the last invoice's payment method but i would like to use the new one they just entered in checkout instead

cursive tartan
#

if it's not attached, then you can't use it. So it depends how you built the ability for them to pay, since it's possible to do a one-time payment that does not the save the card. It's hard to understand your setup without a specific example you share.

hybrid rose
#

ok i'll have a think about how to use the customer payment methods list you've mentioned for my use case