#issambd - Reuse Payment Methods
1 messages · Page 1 of 1 (latest)
this is the cusomer : cus_KxVqbdBqfYItfC
this is the pm : pm_1KHcTfLzSPzAEiPD2HpWj3Fy
the request : req_maKkMx8m4VzYQn
so you're trying to pay on that page? That shouldn't have a saved card so I'm confused
can you share a screenshot of what you see?
yes it does have a saved card, but when I click on confirm payment the error appears
sending screenshot
yeah there's no "confirm button" and that PM is not on the customer so I don't really follow what you describe
I just tried to pay that invoice and it worked
I don't understand which page you are on
That is weird, now it says that it is paid
yeah since I paid
Can you do another invoice and take detailed screenshots before/after
I don't get how you end up with that "pre-filled card"
I literally just refreshed the page
wait you used a different card to pay
I am using a card that requires 3d authorization
lemme try to reproduce the error again
Hello! I'm taking over for @bold quail, getting caught up now...
Hello, thank you
I just tried to reproduce the error, the authorization and payment went smoothly, it's weird the I got that error earlier
you can still see the error on the screenshot or if you check the request, I sent the ID earlier
Okay, so you created a Customer, created a Subscription for that Customer, created a Payment Method... I think I missing a piece. Do you have the request ID where you attached the Payment Method to the Customer?
Oh, never mind, I found it. You specified a Customer when you created the Setup Intent...
Let's see here...
I was mid testing different cards so sorry for the messy logs
No worries.
Okay, so it looks like you tried to use a Payment Method you detached from the Customer earlier in this request: https://dashboard.stripe.com/test/logs/req_ALH23iqXzc3ozO (fixed link)
So it makes sense that it would fail with that error, as it has been detached.
So there is no way to pay an invoice using the host invoice link after detaching that pm that was assigned to the invoice?
var options = new CustomerUpdateOptions
{
InvoiceSettings = new CustomerInvoiceSettingsOptions
{
DefaultPaymentMethod =
newPaymentMethode.Id
}
};
this is how I am making the pm default
Detaching a Payment Method from a Customer means it can no longer be used for any purpose.
It's similar to deletion, except we keep it around for record keeping/archiving purposes.
and doesn't the hosted invoice url use the new default pm ?
It should, yes, but you would need to reload the page after the changes are made.
nope, didn't work, I just reproduced the error
- created an invoice with the default pm
- dettached the pm and attached a new one
- opened the invoice
- opened the invoice
- tried to pay, error
Ah, okay, I can reproduce the error on that page. Hang on while I investigate. Please do not alter this Invoice, Customer, or anything else associated with it. 🙂
yes sir
We're still investigating this, but in the meantime can you tell me why you're detaching these Payment Methods before the Invoice is paid? What's your use case?
our db model dictate that we save one pm methode per user, so when a user adds a new pm, that's the new default and the old one should be dettached
a new payment methode is for example added when an invoice can't be paid due to insufficient funds
so a user adds a new pm to pay that one invoice
I strongly recommend against that. Can you leave the previous one attached and set the new one as the default in the Customer's Invoice settings?
If that's the only possibility there is, but does that mean the invoice will be paid using the new pm ?
there is usually a good reason the customer changes their pm, so there is no point for keeping the old pm if it does not work
FYI, in my previous implementation the pm would be attached to teh subscription object, as we only allowed a costumer one subscription, but a colleage of yours (in a previous conversation) suggested that it's good practice to attach the pm to the customer instead
in that implementation this error did not occur
The Payment Method needs to be attached to the Customer regardless. A Payment Method can only be reused if it's attached to a Customer.
It does not need to be their default, though, just attached.
so what do you suggest ?
Just to make sure I understand your desired flow: you want to have only a single Payment Method attached to a Customer at a time, and there are situations where your Customers will have an outstanding Invoice and replace their Payment Method with a new one before paying that Invoice?
exactly
Gotcha. Give us a few minutes to discuss/investigate internally.
okay thank you
Okay, so we're going to work on improving this on our end so detaching a Payment Method prevents the Invoice payment page from showing it sooner. Of note: the Invoice page will eventually do the correct thing, it's just not immediate. The link you provided earlier where you could reproduce the error is now showing a payment form, for example.
I can't say when this will be fixed, so in the meantime I recommend either leaving the Payment Methods attached if possible or waiting a while between detaching and sending them to the Invoice page (which may not be practical).
Happy to help! Sorry about the trouble!