#kanohian-subscription-payment
1 messages · Page 1 of 1 (latest)
Can you rephrase your question? I'm not sure what you mean by "invoice with other than zero charge"
ok
Customer is purchasing a subscription, he has no money in his card and stripe charges it to his credit. Good until here ?
What do you mean by "stripe charges it to his credit"? Are you just talking about a regular credit card and the charge to create the subscription goes through successfully?
I mean stripe ballance
kanohian-subscription-payment
he has no money for billing now, wo stripe charges the price to his ballance in order to charge it in next invoice
isn't?
You create a Subscription for say $10/month. Every month, an Invoice is created for $10 and we try to charge their card on file. If they have no money, the payment is declined and there's a payment failure on the Invoice and after N failed payments we cancel the Subscription
so, cost never charges to customer ballance instead?
when purchasing subscription I mean
There's https://stripe.com/docs/billing/customer/balance if that's what you mean? But you would have had to put some credit there first
In what case?
ok let me ask my real question
I need to grab one subscription cost after coupons/promocodes
problem is sometimes, when purchasing one subscription, its latest invoice is zero
since it seems that subscription charges to customer ballance to be billed in next invoice
so, how can I get this subscription cost after discounts, independently of its latest invoice
I'm sorry I don't really understand any of this
create your own billing system server side
A "Subscription cost" depends on a lot of factors. You can look at the latest invoice, or you can use the Retrieve Upcoming Invoice API https://stripe.com/docs/api/invoices/upcoming
I'm struggling to grasp what you are trying to calculate and what having no money on your card has to do with it
I need to grab one subscription final cost(after all discounts, taxes, etcc)
that's what the Invoice API is here for
Correct, their APIs can return the data you need to develop your predicted outcome
latest_invoice will give you the already paid invoice
and the incoming invoice any pending payment
mmmh
so if subscription costs 100 and customer had only 80
latest invoice will have 80 and upcoming invoice 20 ?
what does that mean "had only 80". Had only 80 where? In their bank account? On their credit card? Or in your own credit balance locally that you maintain?
credit card
The Subscription cost $100. The Invoice is for $100. The customer only has $80 in their bank account => The $100 payment fails completely
problem was, when testing subscription purchase sometimes latest_invoice was zero
in thosecases, the amount was charged as debit and included in the upcoming invoice
any idea when does this might happen ?
It's really hard to say. I'm sorry, we have been speaking for a while and al of it has been really cryptic 😦
yes, my bad
An Invoice can be $0 for a lot of reasons, past credit balance, coupons, proration, $0 Price, etc.
Maybe create test script to show error and Git it
past credit balance, coupons, proration, should I check upcoming invoice as well ?
use some new test api creds too
When the amount due on an invoice is less than the minimum chargeable amount the invoice is marked as paid and the amount owed moved to the credit balance as a debit. This functionality only occurs for customers without a cash_balance.
this is what I was refering to
yeah that is when you test with low amount often because you think amount: 30 is $30 USD but it's $0.30 USD
with credit
that's an edge-case that almost no one ever encounters in production because it's uncommon to have a $0.30/month Price
yes
but it can make the latest invoice zero
and in consequence, the cost of the subscription would be zero
yes that's all entirely expected
exactly
so
is there a way of obtaining the final cost of the subscription regardless all these stuff
Damn I'm sorry but this is so confusing
The Subscription has one or multiple Price(s) associated. You can look at the Invoice amounts. There are many separate properties that tell you everything
I need a way of getting the final cost without checking the latest_invoice, then the upcomingi invoice if latest_invoice happens to be zero,..
something like subscription.total
The latest Invoice would have that information. Total, subtotal, all the line items, what was added or removed from the credit balance, it's all on the Invoice object: https://stripe.com/docs/api/invoices/object
There is no "total" at a Subscription level.
Do you have a concrete example of a Subscription/Invoice in your account?
I used to
I think it might make things a lot easier/clearer if we both look at the same objects
but we migrated and now cant reproduce it
😅
life is tough
I mean you can add credit to a customer balance before creating the Subscription. Or use a Price that is below $0.50 if it's about the credit balance
yeah but (An Invoice can be $0 for a lot of reasons, past credit balance, coupons, proration, $0 Price, etc.) adds a lot of work
should be nice something like subscription.finalCost
yeah that's fair! But that's not something that exists today unfortunately
okok thanks a lot