#theasteve - check balance
1 messages · Page 1 of 1 (latest)
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
Thanks @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
@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
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
@winged blade Im unable to see in the https://stripe.com/docs/api/payment_intents/object#payment_intent_object-last_payment_error object, insufficient amount error
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
oh I see For some errors that could be handled programmatically, a short string indicating the error code reported.
Good catch. Are you testing this with our "Insufficient funds" test card? https://stripe.com/docs/testing#declined-payments
That should make that error appear where it would in prod