#DeputyCheese

1 messages · Page 1 of 1 (latest)

olive craterBOT
flint hedge
#

What event are you looking for?

slim vigil
#

invoice.paid

#

I received the invoice.paid event yesterday, when I initiated the subscription via our booking form

#

Now I'm waiting for the subscription to be renewed + paid and to receive the invoice.paid event so I can renew/extend the subscription on our side.

#

The subscription is set to daily and the setup was at 12:17 yesterday. I should receive the webhook event before 12:17 today, right? Otherwise the subscription would have been expired.

flint hedge
slim vigil
flint hedge
#

Yup, an invoice has to be created in order to charge the customer

slim vigil
#

But that happens automatically, right?

flint hedge
slim vigil
#

Yes, that's what we are using

flint hedge
#

Then the invoice will be charged automatically with collection_method: charge_automatically

slim vigil
#

Will this always happen on the day of the expiration and at the exact same time? In this case today at 12:17?

lyric stream
#

Hi! I'm taking over this thread.

#

If you have a daily subscription, then yes the next invoice will be created at about the same time every day.

#

Note that the invoices are created in draft, and then are finaliazed by Stripe automatically one hour later. But you can finalize the invoices yourself if you don't want that delay.

slim vigil
#

Okay thanks, I got it.

#

One more question:

#

I am not using prices in the stripe dashboard but submit them dynamically (because based on the given user the price can be different and also change during the subscription).

#

How can I afterwards change a price?

#

But it looks like I only can change meta data etc.

#

I would need to change the price itself though (for example: someone subscribes for 5€ in the first month, but based on his inputs the price can be 4€ in the second month and so on)

lyric stream
slim vigil
#

Okay, this is no downgrade/upgrade though. For example: the user initiates a subscription, but adds his vat afterwards. The the second month has to have a lower price than the first one, even if it's the same product/subscription (because the user would get an invoice without vat for the second month, but not for the first month, because he added it after it was already created). How would I do this?

#

I cannot immediately charge him too because this change only applies to the second month (+ the following months) but he has already paid for the first one.

lyric stream
#

So you would like to change the price of the subscription the next time the subscription renews?

slim vigil
#

Exactly

lyric stream
slim vigil
#

Mmmh it's not really a phase/scheduled subscription but only something tax related. Isn't it possible to change the price when invoice.created is called or something like that?

#

I also cannot predict when (+ if) the user adds his tax information

lyric stream
#

the user initiates a subscription, but adds his vat afterwards
Can you clarify how the user add his vat? Is this related to Stripe Tax or something your compute on your end?

slim vigil
#

That's something on our end. We have a lot of business clients with valid vat numbers. Those clients can add their vat number on our end, so they will receive an invoice excluding sales tax.

#

Now it could happen that they add their vat number after they already submitted the subscription. In that case we would like to give them a correct invoice in the following month/renewal.

#

We are not using stripe invoices but our own.

#

Another use case would be if we decide to change the price of our subscription in the future (same product).

#

Then we also would need to make a price change of running subscriptions

lyric stream
#

We are not using stripe invoices but our own.
Can you clarify this?
Another use case would be if we decide to change the price of our subscription in the future (same product).
Like I mentioned earlier, if you want to make change to a subscription in the future, you have to use subscription schedules.

slim vigil
#

Yes, we got our own invoicing system and we cannot use stripe invoices, so the user will get invoices directly from us and not the ones from stripe in our dashboard. We have to merge invoices + products from different sources so we cannot use the ones from stripe.

#

I changed the price, it was 4.16€ in the first month and now is 4.99€

lyric stream
#

Yes, we got our own invoicing system and we cannot use stripe invoices
So you use Stripe subscription to charge the customer, but you don't use the actual Stripe invoices (you built your own)?

slim vigil
#

Yes

#

Stripe invoices are created though but we don't send them to the user, instead he receives them from us.

lyric stream
#

Okay, makes sense!

slim vigil
#

You see the first month was 4.16€. The next invoice will be 4.99€ though.

sterile cairn
#

👋 taking over for my colleague. Let me catch up.

#

taking a look at the subscription

#

it would be a minute

slim vigil
#

no problem, thanks

#

Fyi I am using stripe->subscriptionItems->update for the price change

#

1.) Getting the subscription (subscriptions->retrieve($subscriptionId))

#

2.) Getting the subscription item ($subscription->items->data[0])

#

3.) Updating the price of the subscription item (subscriptionItems->update($subscriptionItem->id,['price_data' => ...]))

sterile cairn
#

ok

slim vigil
sterile cairn
#

what is the Q really?

slim vigil
#

The first month was 4.16€ and I now changed it to 4.99€

slim vigil
# sterile cairn what is the Q really?

The basic question was how I can change a price of a running subscription when it's not an immediate upgrade/downgrade and the subscription stays the same EXCEPT for that price change. Your colleague said I have to use schedules but it seems to work the way I described it too.

#

The use case is: a user creates a monthly subscription and is billed 4.99€ in the first month. Now the user adds his vat afterwards and therefore doesn't have to pay the 4.99€ anymore but instead the net price (4.16€ for example) because of reverse-charge.

#

In that case (or also just with price changes in our subscription) I would have to change the price for a subscription dynamically.

sterile cairn
#

so you want to refund the already paid VAT?

slim vigil
#

nope

#

I just want to change the price for the future months

#

And I think I found the way (see above) but I'm just confused because your colleague told me I have to use schedules and that this is the only way.

#

I just want to make sure it's correct

sterile cairn
#

what you did creates an immediate invoice

#

which is not what you're looking for

slim vigil
#

Okay, let's say we've got a lot of subscriptions. And in 5 years we are changing our pricing, so everything will be +1€. How can we do this?

#

So from January 1st everything is 5.99€

#

Then there are users whos subscription ends at January 14th for example. And with the renewal we would have to raise the price.

sterile cairn
slim vigil
#

Please give me a second, I'm testing it right now.

#

I changed the interval to weekly so we can better see when the next invoice will be issued

#

Nope, somehow now the item is added

sterile cairn
slim vigil
sterile cairn
#

I agree, I just wanted to mention this while I take a look at your subscription

#

I know what happened

#

you are trying to update the Subscription Item instead of the Subscription itself

#

you need to create a Subscription and in items you can mention the (already created) subscription item id to update it

slim vigil
#

Ah sorry, my mistake

#

I forgot to define the subscription item id in the subscription update items key

#

I'm updating the price via:

$stripe->subscriptions->update($subscriptionId, [
'cancel_at_period_end' => false,
'proration_behavior' => 'none',
'billing_cycle_anchor' => 'unchanged',
'items' => [
[
'id' => $subscription->items->data[0], // there's always only one item in subscriptions
'price_data' => [
'unit_amount' => $price,
'currency' => 'eur',
'product' => $productId,
'recurring' => [
'interval' => 'week',
],
]
],
],
]);

#

So in sub_1LxpKyClDK2O5WMjNFmnDbDA we got 4.99€ for the week october 28th - november 3rd and then 4.16€ for nov 4th - nov 11th, right?

sterile cairn
#

let me check on that

#

yes that's correct

slim vigil
#

Great

#

And the invoice for the week 4th-11th isn't issued right now, but later short before renewal, right?

#

So it's not immediate like the way I changed the price before, right?

slim vigil
#

Peeerfect, thank you so much! That's exactly what I needed 😄

#

You've been a great help, thank you very much

sterile cairn
#

let me know if you need any more help

slim vigil
#

Yeah one more question 😄

#

I only received customer.subscription.updated though

#

The renewal invoice is still in draft and the invoice.paid hook was not called at all

#

I would have expected that the invoice.paid event would have been called by now to confirm the renewal + that the user paid?

sterile cairn
#

this is why I suggested using test clocks

#

so you can advance in time and see the changes instantly

sterile cairn
slim vigil
sterile cairn
#

not related

#

collection_method is by default charge_automatically but that doesn't mean it will charge immediately

#

if you want your customer to be charge immediately you would go back to the previous model

#

your first use-case

slim vigil
#

I thought the user only has to enter his credentials and pay an invoice once he starts his subscription, and after that the rest runs automatically -> every month a new invoice is created and the amount is automatically deducted from his credit card?

sterile cairn
slim vigil
sterile cairn
#

yes true

slim vigil
#

I want the charge to happen automatically

sterile cairn
#

the charge is happening automatically

#

it's just not immediate

#

you have to wait till the next invoice gets generated and it will be paid using the payment method attached to customer or subscription

slim vigil
#

Okay, but in this case the payment has not been made but the time was running out

#

Because now the subscription has ended but payment has not been made for the next interval

#

(in that example the interval is 1 day)

cerulean oak
#

taking a look, but what happens at the end of a cycle is we generate an invoice and wait an hour

slim vigil
cerulean oak
#

that's one way of looking at it I suppose yes. The billing period is all correct, it's just that the payment itself can happen a little later

slim vigil
cerulean oak
slim vigil
#

Because right now the state would be, that the user has no access to the service because he hasn't paid for the 2nd day

cerulean oak
#

in your case if it's a daily plan I suppose you don't want days of leeway, but a few hours, sure

slim vigil
slim vigil
cerulean oak
#

seems fine. depends too what retry schedule you have configured for invoice retries and how you want to treat giving access in those cases

slim vigil
#

Okay thanks for your help

#

One last question:

#

Will stripe contact our clients directly to pay an invoice if that fails?

#

Or only if we pass their e-mail address?

cerulean oak
#

I think it depends, if it's collection_method:charge_automatically I don't think we email them, we just retry the charge per the settings you configure on https://dashboard.stripe.com/settings/billing/automatic, we'd only email invoice links for send_invoice invoices that are passing due dates

slim vigil
#

Okay thanks

#

I think if a payment fails I will just cancel his subscription via the api and ask him to create a new subscription.