#yuichi-hamamoto_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ 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/1385133138790846567
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- yuichi-hamamoto_api, 5 days ago, 21 messages
To change the price of a product, we recommend that you create a new price for the new amount, then archive the existing price by setting active to false. Instead of changing the unit_amount on the existing price, you need to create a new price to make sure that we keep the existing price as an immutable record of past transactions [0].
Yes I understand that I need to recreate as I mentioned in the intial post
The problem here is how do I search the price?
Let's say I have a product with two prices,
lookup_key: "monthly"
lookup_key: "yearly"
When I recreate the prices I can't use same lookup_key
Should I not use lookup_key to look for price>
?
Got it.
If you're using lookup_key you'll want for it to be more descriptive for each price.
- Original Price:
lookup_key: "monthly" - Updated Price
lookup_key: "monthly20250619"
Or something along those lines.
List API will returns a list of your active prices.
I guess I'm not clear on your ask here
but I can list price with specific lookup_key
No you cannot.
yes you can
Sorry, you're right. I'm looking at the doc now.
When you create the price, you'll need to provide the lookup_key
I was gonna use lookup_key to switch the price for the product, which some documents suggest but not sure if it's good idea
Or update the existing prices to include them
The problem is I can only update its metadata and the status which indicate the price is active or not
The prupose of the lookup_key is to aid in price retrieval
Right
Looking at the docs, you should be able to update price with the lookup_key [0]
Let me quickly test on my end.
You are right, I can update lookup_key with api, but I can't from the dashboard?
You should be able to do it via the Dashboard as well. I just tested it
Head to the price you're looking to updated, click on edit and scroll to the bottom of the page. You should see "Lookup key"
Oh true
But do you think using a lookup key to switch the price for the product, whether monthly or yearly, is a good idea?
When I change the price for monthly, let's call them monthly_old and monthly_new
For those who newly subscribe the product is fine
but then I need to update all subscription to monthly_new too
That means at some point monthly_old and monthly_new need to exist right
Then I feel updating lookup_key is not smart idea
Both do not need to exist because we recommend you archive old prices before you create new ones.
That way if you're using List, for example, you can list all of the active prices at the time and not have to worry about archived ones.
What happens if renewing the subscription happens after archiving the price and before creating a new price?
They can still make invoice with archived price?
Oh, no they will not. However, you should be creating the new price prior to archiving the existing price.
Right
So update old lookup key=> create new one=> update all the subscriptions with old price to new one=> archive?
If you're going to archive the old price then you may not need to add the look up.
If you're keeping both prices active that's when look up key is beneficial
But I was gonna use lookup key to find price for monthly and yearly
not to differenciate old and new one
But I think I understood how I should update the price
Thank you
Understood. Apologies, if I didn't really understand what you're looking to achieve.,