#theasteve-charges-declines

1 messages · Page 1 of 1 (latest)

carmine hemlock
#

Is there a way to make both of these work?
Can you elaborate on what you mean here? What are you actually trying to do?

Getting a payment_intent from a Charge seems like an entirely separate issue if you're working with Payment Intents, so I feel like that might be a red herring.

solemn path
#

Hello. there, sorry for the confusion please bare with me. Currently we are using Stripe::Charge.create to process a payment after a user submits a their debit card information. However, we have noticed that when we try to submit a payment from the user the transaction fails because they dont have a balance to cover the charge. We would like to raise an error in our credit card form that says please use a different card if the user doesn't have a balance in the account to covert the cost. Currently we are using Stripe::Charge.create but it seems that this object doesn't raise the errors we want. We would like the https://stripe.com/docs/error-codes#insufficient-funds to be raised. But it seems this is only possible using the https://stripe.com/docs/api/payment_intents/object#payment_intent_object-last_payment_error from the PaymentIntent object

#

this leaves the following questions, A) PaymentIntents and Charges are two different things and can't work together? ( Meaning maybe I can validate using a card account using paymentIntent and if no errors move to charging that card)

#

B) I have to chose one or the other one, in which case I would have to remove the use of Charges for the use of PaymentIntent?

carmine hemlock
#

So I would advise against using Stripe::Charge.create, as that's a legacy flow.

A) PaymentIntents and Charges are two different things and can't work together? ( Meaning maybe I can validate using a card account using paymentIntent and if no errors move to charging that card)
Payment intents are built on top of charges. So every payment intent will have an underlying charge. You shouldn't need to interact very much with the underlying charge to do what you're trying to do.

#

B) I have to chose one or the other one, in which case I would have to remove the use of Charges for the use of PaymentIntent?
Don't use Charges explicitly. Use Payment Intents. Additionally, if all you want to do is surface payment errors (including insufficient_balance) then you should use the Payment Element (see here: https://stripe.com/docs/payments/quickstart) because it shows the customer those errors for you.

solemn path
#

@carmine hemlock I love you!