#nsad__
1 messages · Page 1 of 1 (latest)
Hello my friend
when i try:
stripe.Price.modify(
instance.stripe_plan_id,
product=instance.product.stripe_product_id,
nickname=instance.nickname,
unit_amount=instance.price,
currency=instance.currency,
recurring={"interval": instance.interval},
active=instance.is_active,
)
show:
stripe.error.InvalidRequestError: Request req_h31P5mLKZLnOgk: Received unknown parameters: unit_amount, product, currency
but when i try just some fields, like this, works normally:
stripe.Price.modify(
instance.stripe_plan_id,
product=instance.product.stripe_product_id,
nickname=instance.nickname,
active=instance.is_active,
)
this happen in creation too
So what you want to do is look at the request: https://dashboard.stripe.com/test/logs/req_h31P5mLKZLnOgk and check the available parameters for the API method you are using (https://stripe.com/docs/api/prices/update for Price update)
You can't update unit_amount for a Price for instance
Prices are generally immutable
If you want to update them you should mostly be creating a new one
but why this happen in create price?
plan = stripe.Price.create(
product=instance.product.stripe_product_id,
nickname=instance.nickname,
unit_amount=instance.price,
currency=instance.currency,
recurring={"interval": instance.interval},
active=instance.is_active
)
What is the error for that?
You should see a request ID that you can look at
Feel free to share that request ID here as well and I can look at it
give the same error:
stripe.error.InvalidRequestError: Request req_1nOZZNylchbgks: Received unknown parameters: unit_amount, product, currency
id = price_1NxX5eLzQK7EQjsIOrSpeeKP
That is not a Price creation request
That is an update request
You can see that it is a POST request to /v1/prices/price_1NxX1aLzQK7EQjsI4epzraH0 which indicates you are attempting to update price_1NxX1aLzQK7EQjsI4epzraH0
so my signals was with problem, i remove if with modify
so when i need change price, and this price already use, how change?
need use lookup?
Well if you want to change something like the amount then you would create a new Price
If you just want to change one of the mutable pieces then you would retrieve it and then update it, yes.
a okay, thanks so much! Have a nice day!