#Whip-PaymentIntent
1 messages · Page 1 of 1 (latest)
pi_3KhVg4JyuisDiUpl0Gf42qGu Look at the logs, it's now successful as I used another card on it but you'll find the error in the timeline
When your card gets declined in the first payment attempt, the PaymentIntent status will become requires_payment_method and that's why you are getting error message saying missing a payment method.
You can use last_payment_error hash to get the payment error message. In this case it's Your card was declined.
Why does the php library throw an invalid exception on this? Shouldn't it be a card exception?
It's invalid because the request (i..e, confirming a PaymentIntent when its status is requires_payment_method) is invalid.
Can I somehow test the scenario that the card fails once, but on retry the same card succeeds?
It's a possible use case but I can't find a test card to simulate it.
Alright
Hi @sage trout can you elaborate more on the default paymentMethod on customer?
If you want to use an attached PaymentMethod when creating a PaymentIntent, you need to explicitly specify it in the API. see https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Well I followed this guide (https://stripe.com/docs/payments/save-and-reuse) to setup an intent. It all works but the card that I used is not set as default (event when its the only one on the customer). Can I add a property somewhere in this process that not only attaches the payment method to the customer but also sets it as the default?
You can specify the invoice_settings.default_payment_method to set up a default payment for subscriptions and invoices.
However, there's no way to set a default payment_method for one-time payment, you always need to specify the customer and the payment_method in the PaymentIntent creation API.
This is the setupintent api. I want to basically know if there's a way to set invoice_settings.default_payment_method on the customer without an extra call.
I'm afraid not, you need to make one API call to set the invoice_settings.default_payment_method
ok. thanks for your support