#pro-pooja_webhooks

1 messages · Page 1 of 1 (latest)

pliant glenBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1235257308058226711

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

spark plankBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

cobalt cave
#

Hello! When a new Subscription period starts a new Invoice is created, so it sounds like you want to listen for invoice.created which will have details about the amount due.

autumn nexus
#

How can I differentiate the invoice is for new billing cycle only, not created by other action

cobalt cave
autumn nexus
#

Another question I have is, how can I implement this?
if a customer has downgraded in the same month and adds the same amount £ of items in the same month, they wouldn’t be charged any additional money that month because they’ve returned to the same level plan. If they go above the plan amount they were on before with items they’d be charged immediately.

cobalt cave
autumn nexus
#

If I apply the proration, let's say I have 2 products a and b, user subscribes with 1a and 2b => total = 3 , then downgrades to 1a and 0b => total = 1 then user should not be charged anything, but again if user upgrades to 1a and 3b => total = 4 user should be charged for the difference, of max which 4-3 and charged for 1 item only. Proration is agian charging for 3 items.

cobalt cave
#

Is this behavior you're seeing in test mode? If so, do you have a specific question about it?

autumn nexus
#

yes, check this subscription - sub_1PBFvXGVCe8mF8QWo0iiS1G7

#

Here , Intially user paid , £30 for 2+3 => 5, then downgrades 0+3=> 3 charged nothing, then upgrades 3+3 = 6 and charged £15 , instead of £5 (Last max total was 5 - current total is 6 = 1)
Proration is not working in this scenarion

cobalt cave
#

Not sure I understand. The latest Invoice on this Subscription is charging them for quantity 3 of a 5.00 item, and the proration calculation is coming out to 14.996 behind the scenes because basically no time has passed, so that's being rounded up to the 15.00 they're being charged. This seems normal and expected to me.

autumn nexus
#

in this case, User has already paid £30.00 for 5 items and now after downgrading and upgrading users total is 6 items £35.00, which should be charged like £35.00 - £30.00 = £5, irrespective of the how much time is passed.

cobalt cave
#

One moment, grabbing someone who's better equipped to explain this in detail than I am. 🙂

jade badger
#

👋 hopping in here - the key thing to remember with prorations is that they're only calculated based on the most recent state of the Subscription. So if you were to do multiple upgrades like this:

  • downgrade from quantity 3 -> 1
  • upgrade from quantity 1 -> 3

The prorations we calculate for that last upgrade will be based on the Subscripton having quantity 1 when the upgrade occurs.

autumn nexus
#

Okay, then what is the workaround to charge customer as per the scenario I described

jade badger
#

Also I just want to clarify one thing - the way we calculate prorations wouldn't give you £5 irrespective of time in the scenario you laid out. Our prorations are calculated to the second, so for an upgrade from 5 -> 6 exactly halfway through the cycle you'd see something more like:

  • £15 credit back (£30 / 2 to credit back for the half of the cycle we paid at the £30 price since we're upgrading halfway)
  • £17.5 debit (£35 / 2 to debit for the half of the remaining cycle we're going to pay at the new £35 price since we're upgrading halfway)
#

To get the behavior you want you'd need to disable the prorations Stripe calculates/creates and calculate your own prorations. Based on those calculations you can create Invoice Items that you can choose to immediately Invoice for, or have them rolled into the next Invoice of the Subscription automatically

autumn nexus
#

If I create an invoice halfway through the month with new charges, will it affect the invoice for the next billing cycle?

jade badger
#

No, it shouldn't have any affect on the next Invoice that's automatically generated

autumn nexus
#

Are you there?

cobalt cave
#

I can jump back in and answer this one. What specifically is giving you trouble? What have you tried?

autumn nexus
#

What is the difference between this 2 apis?

cobalt cave
autumn nexus
cobalt cave
#

Yes.

autumn nexus
cobalt cave
#

I linked directly to it above.

autumn nexus
#

is it not mentioned in the doc, or I can't find it?

cobalt cave
#

That screenshot is from that link.

#

What do you see when you click on that link?

autumn nexus
#

Seeing it, thanks

pliant glenBOT
autumn nexus
#

How can I apply this tax id - txr_1NhXbEGVCe8mF8QWAiKDGU0h, while creating invoices item?

amber ether
#

What have you tried so far?

autumn nexus
#

is it tax_rates prameter

amber ether
#

Please take your time and be more clear with your wording. It's very difficult for us to respond to partial sentences without URLs to the API reference where the parameter you're talking about exists

autumn nexus
amber ether
#

Have you tried creating a test-mode Invoice Item with that Tax ID? What happens when you do?

autumn nexus
#

it applies 20% vat on invoice.

amber ether
#

It sounds like you already know: the value is a tax rate

#

Unless I'm missing something. Again, please explain more thoroughly. You passed a Tax Rate to the tax_rate parameter and it's showing the Tax Rate applied 20% VAT to your Invoice Item. All of this is very normal and expected, so if something is not looking correct, please try to be more descriptive.

autumn nexus
#

I haven't applied this tax rate while creating invoice I've applied it when creating a checkout session where the param name is different, so that wanted to confirm it is same or not?

amber ether
#

What do you mean by "the same"? Isn't the behavior what you would expect?

autumn nexus
#

Its same I just checked by applying

amber ether
#

Great!

autumn nexus
#

while I need to charge it immediately

#

$stripe->invoices->create([
'customer' => $customerId,
'collection_method' => 'charge_automatically',
]);

amber ether
autumn nexus
#

Yes, default payment method is card, currently in test mode, test card is attached.

amber ether
autumn nexus
#

$invoice = $this->stripe->invoices->create([
'customer' => $customerId,
'collection_method' => 'charge_automatically',
'subscription' => 'sub_1PBXKVGVCe8mF8QW4VMFUJJA',
]);
Tried this, invoice is attached to subscription but still in draft status

amber ether
#

Hold on, let's back up. This is a Subscription integration? What are you actually trying to do here? Why are you adding the Invoice to the Subscription instead of letting the Subscription create the Invoice automatically?