#MarkoBoras
1 messages · Page 1 of 1 (latest)
Hello 👋
Taking a step back, what's the intent behind that? Can you elaborate on your usecase a bit?
Yeah
I have this case which I want to improve (I am using stripe checkout,customer portal for payments), downgrade and cancel through my app via API
- User buys monthly plan successfully and pays for it in checkout. That card has become default payment method. (ALL GOOD)
- User decides to upgrade from monthly to yearly via portal and adds new credit card which is bad and gets error. That bad card has become default payment method of user.
I want to retrieve payment method from good invoice and set it as a default payment method again to user
Ah gotcha, thinking out loud here
Would it be easier to just list all of customer's attached payment method instead?
https://stripe.com/docs/api/payment_methods/customer_list
I thought of that
how can I know which one has money on it
hah
I want to set as a default payment method the card from which he has made successful payment
Okay so looks like the paid invoice should have an associated charge
https://stripe.com/docs/api/invoices/object#invoice_object-charge
and the charge will have the payment method that was used
https://stripe.com/docs/api/charges/object#charge_object-payment_method