#vienklett_best-practices

1 messages ยท Page 1 of 1 (latest)

velvet badgeBOT
#

๐Ÿ‘‹ 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/1288236989275045908

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

novel zephyr
violet spear
#

example: I have this subcription: sub_1PgA4HH5ocKrGenqn7PCSW47 which has Staging Linq Pro Plus - price_1OrORyH5ocKrGenqsZr1D6m0. Now i want to remove Staging Linq Pro Plus - price_1OrORyH5ocKrGenqsZr1D6m0 from subscription and add Linq One - price_1Q0UkcH5ocKrGenqGrYE9p4S

#

i need to do it through my code

novel zephyr
#

Yeah the doc I shared above should have additional info on using the API too

violet spear
#

i look at the doc and i dont even know how to do it

#

doesnt clearly say what i am supposed to do

#

look like i need to do on subscription item level

novel zephyr
#

What doc are you looking at?

violet spear
#

i need to update product_id and price_id in the subscription

velvet badgeBOT
violet spear
#

so i think i should use the subscription item.

novel zephyr
violet spear
#

thanks

#

appreciate your help

violet spear
#

i need help with code. should i create new thread with code help?

bronze eagle
#

๐Ÿ‘‹ We can chat here

violet spear
#

subscription_id = "sub_1Pcw1ZH5ocKrGenqXorZjlU6"
item_id = "si_QTtpbAULjJ9lpY"
Stripe::Subscription.update(
subscription_id,
{
items: [
{
id: item_id,
deleted: true,
},
{
price: "price_1Q0UkcH5ocKrGenqGrYE9p4S",
quantity: 3,
},
],
discounts: [{
coupon: 'L6lE9sbB',
}],
}
)

#

i have this

#

but it give me wrong price.

#

not sure where Remaining time on 3 ร— Linq One (with $249.00 off) after 24 Sep 2024 come from.

#

this plan was on Staging Linq Pro Plus. and i wanna switch to Linq one - quantity 3.

#

also coupon was applied and removed.

bronze eagle
violet spear
#

I expect user have to pay 442.06 - 106.51(unused time) = 335.55

#

idk which part i did wrong

bronze eagle
#

Let's see, let me look at the invoice

#

Ah, I see what's going on here