#codingwisely

1 messages ยท Page 1 of 1 (latest)

prisma flickerBOT
severe tundra
#

hello vanya, i wish you a very pleasent day

wanton tendon
#

Hi! Let me help you with this.

severe tundra
#

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:

wanton tendon
#

Please remove your Stripe key from the chat

severe tundra
#

its a test key

#

updated ๐Ÿ™‚

wanton tendon
severe tundra
#

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$$$$####
wanton tendon
prisma flickerBOT
severe tundra
#

this did not work

#

its still monthly subscription

wanton tendon
severe tundra
#

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 ๐Ÿ˜„

quick cliff
#

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?

severe tundra
#

sure, i can provide anything you need to help you to help me ๐Ÿ™‚

#

so, i have two Subsriptions:

  1. name: Monthly Subscrption- sub_ser4xxx
  2. 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? ๐Ÿ™‚

quick cliff
#

Oh, I see

#

So in your call for req_aZUz6wbu3OEdTJ

#

You passed another monthly price

severe tundra
#

but i dont have anither monthly price ๐Ÿ™‚

#

this is price for annual

#

i have 2 subscritions, named 1) monthly, 2) Annual

quick cliff
severe tundra
#

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)

quick cliff
#

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

severe tundra
#

ok, right away

#

amazing!

#

thank you, i will debug it now to fix wrong price id

#

thank you

#

dud, i simply made mistake in mu code regarding price_id ๐Ÿ˜„

#

thank you

#

have a wonderful day