#montero_invoice-pay
1 messages ยท Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- igmontero_best-practices, 6 days ago, 6 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!
โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1214598914628517949
๐ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
Hey, just for some more info, this is how I'm creating the invoice initially for the customer.
What I'm trying to do now is that the user clicks a "Pay Invoice" button, and we trigger something in the back-end so the invoice is paid with the payment method they initially entered.
I know that they should be able to pay through the invoice url too, but I want to facilitate the process so we use their current payment method.
Hi ๐ how are you creating the customer's Payment Method that you're trying to use for this?
Hey, sec let me find the code
I'm collecting the bank information in the front-end.
Then, in the back-end I'm attaching that payment method to the customer
Here as you can see, it's working properly
Hm, do you have the ID of a Payment Method from your testing that you can share?
Sure, sec
pm_1Oktd6EJRALi1vex0rwrF5WP
This is the error message I'm getting. Something about a mandate. When running this code.
It looks like the Mandate that existed for that PM either expired or was cancelled:
https://dashboard.stripe.com/test/events/evt_1Oo3WREJRALi1vex5WYARAtT
It is not clear to me the mandate part -- I'm showing a mandate in the front-end that I've made manually. Is there a way to show it programatically using a Stripe specific function, or something?
I don't think I'm grasping what you mean. A Mandate was created on 2/17, then some action was taken that caused it to expire (not sure exactly what offhand) on 2/26. That Mandate moving to an inactive state is why payments can't proceed.
I don't think the endpoint to pay an Invoice will let you do so, but if you still have the details of the mandate, can you try confirming the underlying Payment Intent and populate mandate_data with those details:
https://docs.stripe.com/api/payment_intents/confirm#confirm_payment_intent-mandate_data
Oh -- another question.
I've already tested this same code, and if I run the pay invoice function right after creating the invoice, it works properly.
Could that be the reason? Waiting too long?
My intention is to send an invoice to the client, and give them 15 days to pay it
The problem is the mandate is being moved to an inactive state, once that happens the Payment Method cannot be used until a new Mandate is created in an active state.
https://docs.stripe.com/api/mandates/object#mandate_object-status
But why when I tried to pay it manually in Stripe Dashboard by pressing "Retry Payment", it worked?
What did, do you have specific IDs?
That used a different payment method, one which had an active mandate.
But why did it use a different payment method? Shoudn't it use the customer default pm?
I don't know, I don't know exactly what you did. My guess is the dashboard UI you used allowed you to select a Payment Method, and a different one was selected than was used before.
montero_invoice-pay
Okay I see. Looks like the customer has multple payment methods attached. The default one happens to be inactive. To be honest I don't know why it has multiple and why the default one has an expired mandate