#theasteve - check balance

1 messages · Page 1 of 1 (latest)

winged blade
#

I'm unable to find in the Stripe API documentation if there is a way to check from the Stripe token, if there is enough money in the balance? I see this https://stripe.com/docs/error-codes#balance-insufficient error code, but no guidance on how to retrieve from the token
Hello, good question. I believe that you can't do this with Tokens themselves but you can do this with our Financial Connections API. Looking in to that and will get back to you

static moth
#

Thanks @winged blade

winged blade
#

Hello, I misunderstood your question. Unfortunately I don't think it is possible to check the balance on a card before attempting to charge them here. You would need to create the subscription and check the status of the first payment to see if it got declined for insufficient balance

static moth
#

@winged blade Can you guide me to where in the documentation I can find how to do what you described?

#

What is the object that has the error of a insufficient balance?

#

Maybe I already have access to it but Im unable to find this information in the Stripe documentation

winged blade
#

For subscriptions, the best place to see this would be the payment_intent that is on the Invoice that your subscription created. So you can listen to the invoice.payment_failed event[1], retrieve the payment_intent on the invoice by its ID[2] and check its latest_payment_error property[3] to check why the payment failed.
[1] https://stripe.com/docs/billing/subscriptions/overview#subscription-events
[2] https://stripe.com/docs/api/payment_intents/retrieve#retrieve_payment_intent
[3] https://stripe.com/docs/api/payment_intents/object#payment_intent_object-last_payment_error

static moth
#

oh I see For some errors that could be handled programmatically, a short string indicating the error code reported.

winged blade
#

That should make that error appear where it would in prod