#Лена
1 messages · Page 1 of 1 (latest)
Hi there!
seems like it is not possible to create product updating/creating either subscription via subscription api.
I'm not sure I understand. Can you clarify exactly what you are trying to do?
when update subscription https://stripe.com/docs/api/subscriptions/update it requires product Id
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but i need it work same way as creating subscription with checkout session when you set product name, price options
Which part of the subscription do you want to update exactly?
i need either to update item with new product
So first you create a new product/price, and then you update the subscription with the new price. You can see some examples here: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
i know this and this is the issue. Products are being composed by customer, every time it will be a new one, so this is not what expected. The flow which occurs on creating checkout session (when product is created by stripe and set archived to avoid being in a list on active ones) seems more reasonable and handy
So you want to change the price of the subscription, but you don't want to use a price ID, instead you want to directly set the amount and description?
yeah, i would prefer to set directly new product name, price amount...
Well, you can! You can use items.price_data when updating the subscription to set a specific price amount. https://stripe.com/docs/api/subscriptions/update#update_subscription-items-price_data
but isn`t items.price_data.product requires productId, which means product should already exist?
Yes the product needs to exist that true. But it should be easy to create one (or update the name of an existing product)
it is not hard but not what is expected and not what we need as well. It will require additional requests (to create product, to archive it as we do not need it to be list of other active products ...)
and what about issue with checkout session. I read in docs:
In subscription mode, the customer’s default payment method will be used if it’s a card, and otherwise the most recent card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer’s card details.
my test customer has card and address detailes but it is not prefilled
It will require additional requests (to create product, to archive it as we do not need it to be list of other active products ...)
That's true. It's not ideal, but that's how the API works currently if you want to update the product of an existing subscription.
my test customer has card and address detailes but it is not prefilled
Can you share the customer ID (cus_xxx)?
I think it's because the default payment method doesn't have a name, email, and billing address.
ah, ok, so name, email, and billing address should be set to payment method but not to customer?
Like you said earlier:
A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer’s card details.
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!