#elianbraja
1 messages · Page 1 of 1 (latest)
it's generally not possible(setting the id of the Price object to your own String), but some accounts have access to do that since they used to do it before we tried to remove usage of that 'feature'.
so is impossible to do it now?
should be! use metadata or lookup_key on the Price instead
args = {
:customer => stripe_customer.id,
:plan => params[:listing_type] + "-" + params[:payment_interval]
}
subscription = Stripe::Subscription.create(args)
The idea is that I want to use the price name on the subscription create like this
yeah that won't work since you should not be setting/using a name like that
the Plan(or Price) object in Stripe is its own object and it has a plan_xxxx or price_xxx ID
you should store in a database or look up in the API the Plan/Price object that you want to use, and pass the ID of the at object.
see https://stripe.com/docs/products-prices/manage-prices#lookup-keys (as I mentioned earlier) for a way to do this
but how can I get rid of the id and instead always work with a name like lookup key. Can I use the lookup key in the creation of a subscription?
but how can I get rid of the id and instead always work with a name like lookup key
you don't
like I said that's not really a feature, it's something that older accounts might have access to but we don't want to support as it has a number of downsides. You would use solutions like the ones I mentioned
ok, so I can use a lookup key
Can I use the lookup key in the creation of a subscription?
no, you use the lookup_key to find the Price from the List Price API call, and then pass the ID of the Price
ok
so this can be a solution
finding first the price using the lookup key
and then passing the id to the create subscription
I also want to mention that I am using Stripe 2.0.0 gem in my Ruby app. Is there any way I can access the documentation regarding this gem version?
as in, v2 from 2017 https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md#200---2017-02-14 ?
In general no, we don't keep documentation for older versions of the library but if you have a specific problem we could look(but the advice would mostly be to try using the latest version and see if that fixes a problem).