#nacho_446
1 messages · Page 1 of 1 (latest)
Hello! That product (prod_OkFwOttW2bTFpZ) was originally created by setting price_data.product_data when creating a Checkout Session. When you create a price/product that way it's only meant for one-time use (so we archive the product immediately after the Checkout session is successful
If you want to use the product repeatedly you need to create it separately, not as part of the Checkout Session creation
So what do I do now if I want to update a subscription the user is on
Updating the price or the interval
You'd need to create a new Product (either through the API or the dashboard) and then use that in your update request w/ price_data
Hmm this I implemented was he help I got today from your support showing me the upgrade-downgrade docs
If I do something like this ?
items: [
{
id: '{{SUB_ITEM_ID}}',
deleted: true,
},
{
price: '{{NEW_PRICE_ID}}',
},
],
Sorry let me be a bit more clear - the smallest change you'd need to make is just change the Product ID you pass in to your update request. Right now you're passing in a Product ID that's already been archived. If you create a new Product (through the API or dashboard) and pass that in instead your request should succeed
You don't need to switch how you're doing the upgrade/downgrade, it's just about the specific product you're using
We've got this doc: https://stripe.com/docs/invoicing/products-prices
and it may be helpful to l ook at the API reference as well: https://stripe.com/docs/api/products/create
Doing it like this what about the prorate
Is there something specific you're worried about? Prorations should work fine when using a different product - if you try it out you can see how it works
Do I have to take the user to a page to pay ?
Or it still retains the old details
What webhook do I listen too for this
If the Subscription has default_payment_method or the Customer has invoice_settings.default_payment_method then payments will be attempted automatically using that payment method (you wouldn't need to take the user to a page to pay)
Can you be more specific about your question - you asked what webhook, but you didn't give specifics about what situation you're trying to listen for
What event because it changes the productID and I want to inform the user by creating a transaction saying the upgrade is successful
You'll want to listen for the customer.subscription.updated webhook event for that. That event gets triggered for ANY changes the subscription, so if you want to know what specifically changed you can check data.previous_attributes (https://stripe.com/docs/api/events/object#event_object-data-previous_attributes)
The metadata of the Subscription? Yup! You should be able to update that - you can test all of this out in the API
Yea the api works I can see the returned data are different for the price and interval
Can I used that same event to check for when I receive recurring payments? Customer.subscription.updated
It'd be better to listen for invoice.paid instead - the customer.subscription.updated event wouldn't tell you specifically when payment was successful or not