#deathpote - custom IDs
1 messages · Page 1 of 1 (latest)
Unfortunately not. From what I understand custom IDs are still possible, but we recommend against them as they can be confusing if re-used and can sometimes make things harder to debug.
You will need to either store or retrieve these prices if you aren't using them. That being said, you can do something like store custom data as metadata and then build the map by listing your prices and/or looking them up one-by-one via their metadata. I get the reluctance to have a map like this but it can often be worth it.
custom IDs are still possible
based on the documentation, custom ids are still possible for Stripe Products, but not for Stripe Prices
source :
product : https://stripe.com/docs/api/products/create
price : https://stripe.com/docs/api/prices/create
(Old prices created with a custom price id keep their original custom id)
That being said, you can do something like store custom data as metadata
The price.lookup_key fits my need to retrieve a price based on a custom key, it's a shame it can't be used anywhere but as a filter for the get prices API.
Or I'll just store a map somewhere, but I really don't like storing maps of ids
Thanks for your confirmation and your time, I'll update my code to make it work, to be honest this is quite a disappointing deprecation. Removing a functionality because it's confusing when badly used is quite frustrating for people using it correctly
It still exists but is undocumented. If you create a price and explicitly pass price_id, it should create a price with the ID you specify
Oh, that's really nice to know, I'll use it for our current needs of new prices. I'll delay the code changes for the next time I have to create new price if this hidden feature is removed ! Thanks a lot !
is it possible to upvote somewhere to keep this feature in place ?
We don't make changes to existing API versions and we don't really break backwards compatibility so you should be good to use this for a while (as far as I know). I'll see if there is anywhere that I can upvote or +1 keeping the feature though honestly I do not know if there is somewhere to do that internally
Let's hope so ! thanks a lot for your time, have a nice day !
Of course, you too!
Seems like this feature is already disabled :
Status 400 ERR
ID req_oe8O6Qaed14QTo
Time 7/21/22, 4:35:19 PM
IP address XXXXXXXXXXX
API version 2020-08-27 Latest
Source Stripe/v1 PhpBindings/7.114.0
request :
{
"recurring": {
"interval": "month",
"interval_count": "1"
},
"unit_amount": "1",
"id": "test_custom_id"
,
"product": "prod_M6BI7DygOpIJ4x",
"currency": "usd"
}
response :
{
"error": {
"code": "parameter_unknown",
"doc_url": "https://stripe.com/docs/error-codes/parameter-unknown",
"message": "Received unknown parameter: id",
"param": "id",
"type": "invalid_request_error"
}
}
Testing with the API version "2018-02-28" and even "2011-06-21" doesn't work either, seems like a undocumented BC break 😭
Can you try it again but with price_id instead of just ID?
doesn't work either in 2020-08-27 or 2011-06-21 api versions
req_RIZKUimhT7iXKQ
req_OxWBeCBnZHAOXu
If I'm recalling it right, it may be because in the past we had only products, price are a "recent" addition to stripe.
maybe our prices with custom ids were just old products migrated to new price objects, using by default the old product custom id as price custom id ?
Thanks for testing, I could have sworn this was still possible. I had to help out in a few other threads but am focusing on this now
based on wayback machine, prices were introduced in 2020 without any reference to an id field when creating a price :
https://web.archive.org/web/20200607180742/https://stripe.com/docs/api/prices/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay, looking back in my logs, I see a price created in dec 15th 2021 :
req_vNzVOnLjCcsbwe
{
"product": "prod_KmXqVuTmLJ37Wf",
"id": "b2c_24m_fam_v7_online_support_v1",
"unit_amount_decimal": "12000",
"recurring": {
"interval": "year",
"interval_count": "1",
"trial_period_days": "0",
"usage_type": "licensed"
},
"nickname": "b2c_24m_fam_v7_online_support_v1",
"currency": "eur",
"billing_scheme": "per_unit",
"expand": [
"tiers"
]
}
Seems that the 'id' field was the correct one ! 2020-08-27 api version, from the Stripe dashboard
Ah I found it. This capability isn't turned on by default for accounts. You can write in to support to ask to enable it though I don't know how often we enable this now unfortunately https://support.stripe.com/?contact=true
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
! I should have started by this I'm so sorry, I tried to create those custom prices on a new account, not on my legacy account !
Good catch, I was wondering why that call succeeded but the ones from today didn't
The custom id field is even displayed in the dashboard on my old account 🤦♂️ sorry for bothering you with that !
I'll contact the support to enable this on my new account then, thank you a lot !
thanks for yours ! have a nice day !
Right back atcha