#codingwisely
1 messages ยท Page 1 of 1 (latest)
hello vanya, i wish you a very pleasent day
Hi! Let me help you with this.
You can update Subscriptions and change the Price for a give Subscription Item: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
Then, depending on the proration_behaviour parameter, the proration will be billed immeditely, applied to the next invoice or ignored: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#proration
let me have a look and then come back to you if its ok with you?
if i understand this update/downgrade same subscription? does this mean it is one subscription with two price?
i have been reading this part before
or this applies for two different subscriptions?
i am honestly confused ๐
this is what i did follwoing docs:
$stripe = new \Stripe\StripeClient('sk_test_51Nofx4EEictfD8E48OOuD84XpI2HL5kUlxN9mWl0NUypTDXsCFhufNo7NnfqjSUMm9Yno4LMaCbAVk15bphSe39D00eP1xJ3mk');
$subscriptions = $stripe->subscriptions->all(['customer' => auth()->user()->stripe_id]);
and this dd() following:
Please remove your Stripe key from the chat
Yes, you work with the same Subscription object. And if you want to change the billing period (monthly -> annual), you need to replace the Price ID on the given Subscription Item.
like this? $stripe->subscriptionItems->update('si_xxxxxxxxx', ['price' => '{{NEW_PRICE_ID}}']);
so here i get this:
dd($subscriptions->data[0]->items->data[0]->id);```
I get this si_ks$$$$####
Yes, you can either update the Subscription Item directly, or update the Subscription items.price property (don't forget to provide the item ID here too): https://stripe.com/docs/api/subscriptions/update#update_subscription-items-id
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
yes i can
there is as i see 2 request hapened
first one: req_aZUz6wbu3OEdTJ
and immediately after this one: req_KcHxIdxCFVAvvt
what is very confusing to me is that i am supposed to update item.price , but these are two different subscription, monthly with sub_xxxxx and Annual with anbother sub_xxxx
so when i pull customer->subscriptions() i get always only one, as he is subscribed to either one or another.
it blows my head ๐
The result of that update subscription item request shows that the price was actually changed. Can you tell me more about what that call didn't do that you were trying to do with it?
sure, i can provide anything you need to help you to help me ๐
so, i have two Subsriptions:
- name: Monthly Subscrption- sub_ser4xxx
- name: Annual Subscription- sub_987xxxx
Customer click to change from Monthly to Annual and i trigger this code that you saw above, and you said that price has been changed.
Howver, in Customer portal i still see MOnthly Subcription and everythign as it was.
this now shall be Annual Subscription, not a Monthly Subscription ^^
did i manage to explain it now? ๐
but i dont have anither monthly price ๐
this is price for annual
i have 2 subscritions, named 1) monthly, 2) Annual
I think you should double check that. From what I can see on our side that price is set to recur monthly https://dashboard.stripe.com/test/prices/price_1NsUoSEEictfD8E45HOVjPp6
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Ok, let me try different to explain
I have two recurring Subscritions
A and B
A recurrs montly, by 6.99$
B recurs annualy, by 79.99$
Customer is subscribed to A and he wants to switch to B.
Does this makes sense? ๐
So he started Plan A yesyerday and he was charged 6.99/
TOday, he wants to switch to Plan B, 79.99.
I want to charge him only 79.99-6.99
Both, Plan A and Plan B are recurring
they only recurrs in differnt times, one monthly and another annualy
Did i manage to explain it better now?
i think all above maybe is if i have ONE Plan, with two different prices perhpas.
(i am gonna hate if i will need to redo UI and stripe catalog lol)
Yep, I get what you are going for. So now that I look at it again, the subscription item's price was already price_1NsUoSEEictfD8E45HOVjPp6, so the "update" didn't change anything. I think you should try this same code again but change the price ID in your update code. It will work if you pass in the proper price ID for the yearly subscription