#kanohian-subscription-payment

1 messages · Page 1 of 1 (latest)

scarlet zincBOT
queen sparrow
#

Can you rephrase your question? I'm not sure what you mean by "invoice with other than zero charge"

molten bear
#

ok

#

Customer is purchasing a subscription, he has no money in his card and stripe charges it to his credit. Good until here ?

queen sparrow
#

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?

molten bear
#

I mean stripe ballance

scarlet zincBOT
elfin vault
#

kanohian-subscription-payment

molten bear
#

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?

elfin vault
#

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

molten bear
#

so, cost never charges to customer ballance instead?

#

when purchasing subscription I mean

elfin vault
molten bear
#

in that case

#

what happens with the customer latest_invoice ?

elfin vault
#

In what case?

molten bear
#

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

elfin vault
#

I'm sorry I don't really understand any of this

restive kayak
#

create your own billing system server side

elfin vault
#

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

molten bear
#

I need to grab one subscription final cost(after all discounts, taxes, etcc)

elfin vault
#

that's what the Invoice API is here for

restive kayak
#

Correct, their APIs can return the data you need to develop your predicted outcome

molten bear
#

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 ?

elfin vault
#

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?

molten bear
#

credit card

elfin vault
#

The Subscription cost $100. The Invoice is for $100. The customer only has $80 in their bank account => The $100 payment fails completely

restive kayak
#

Correct

#

You cannot hold unavailable funds for the fulla mount

molten bear
#

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 ?

elfin vault
#

It's really hard to say. I'm sorry, we have been speaking for a while and al of it has been really cryptic 😦

molten bear
#

yes, my bad

elfin vault
#

An Invoice can be $0 for a lot of reasons, past credit balance, coupons, proration, $0 Price, etc.

molten bear
#

right there

#

in those cases

#

(assume price is not zero)

restive kayak
#

Maybe create test script to show error and Git it

molten bear
#

past credit balance, coupons, proration, should I check upcoming invoice as well ?

restive kayak
#

use some new test api creds too

molten bear
#

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

elfin vault
#

yeah that is when you test with low amount often because you think amount: 30 is $30 USD but it's $0.30 USD

molten bear
#

with credit

elfin vault
#

that's an edge-case that almost no one ever encounters in production because it's uncommon to have a $0.30/month Price

molten bear
#

yes

#

but it can make the latest invoice zero

#

and in consequence, the cost of the subscription would be zero

elfin vault
#

yes that's all entirely expected

molten bear
#

exactly

#

so

#

is there a way of obtaining the final cost of the subscription regardless all these stuff

elfin vault
#

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

molten bear
#

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

elfin vault
#

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.

molten bear
#

that hurts

#

sorry the headache my bro

elfin vault
#

Do you have a concrete example of a Subscription/Invoice in your account?

molten bear
#

I used to

elfin vault
#

I think it might make things a lot easier/clearer if we both look at the same objects

molten bear
#

but we migrated and now cant reproduce it

elfin vault
#

😅

molten bear
#

life is tough

elfin vault
#

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

molten bear
#

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

elfin vault
#

yeah that's fair! But that's not something that exists today unfortunately

molten bear
#

okok thanks a lot