#Jordy
1 messages · Page 1 of 1 (latest)
Hello! Are you setting an order_id when you create the Subscription?
No
I'm building this in bubble, but I'm using subscription id and customer id for id fields
Not sure I understand. Metadata is for attaching your own arbitrary data to Stripe objects. If you're not setting an order_id in the metadata then where are you expecting order_id to come from?
Haha, I don't know then. I just thought it was required for the curl call
You're right
Where did you see a curl call doing that?
https://stripe.com/docs/api/subscriptions/update
What I'm trying to do, big picture, is have a subscription that was previously cancelled be activated again if the person decides to change plans. At the moment it still says it'll be canceled at the end of the month even though the plan has been switched to a new plan so I thought this api call would do that
I know just enough to be dangerous as you can probably tell
Ah, gotcha. If a Subscription has already been canceled it cannot be reactivated, you would need to create a new Subscription to replace it. If a Subscription has cancel_at_period_end or a cancel_at date set then you can clear those by updating the Subscription before it cancels itself.
Ok, yes it's currently set up to cancel at the period end. So I would use that curl here then to update the subscripiton:
https://stripe.com/docs/api/subscriptions/update
Is that correct?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The curl example shown there is just an example, and not specific to changing the property you want. You would need to modify the command to change cancel_at_period_end to false.
ok, thank you Rubeus. Sorry it's such a simple thing to not know
Are you familiar with passing form data to a URL using curl?
Yes I've done it several times actually but not enough that I can do it without reading a lot of documentation first
Is there a reason you want to do this with curl instead of in the Dashboard?
No reason. I'm open to learning the best way. I thought I could automate it with curl, can it be automated through the dashboard?
What do you mean by "automated"?
The user clicks a button and they're resubscribed rather than the admin needing to resubscribe a user
A button within the app I'm building
Gotcha. You would need to write code for that, you wouldn't use the Dashboard or curl really.
What language are you writing your app in?
I'm using a no-code platform called bubble
Ah, okay. Unfortunately that's not something we can help with here. Does bubble provide support for this kind of thing? Do they have Stripe-specific features or anything like that?
Or does it just let you run curl commands?
They have a stripe plugin (published by bubble) plus an api connector that will run curl commands. Support is to be desired. There's only one company like Stripe and newbies like me are very appreciative.
Within the stripe plugin I can create or update a subscription item but ti doesn't seem to be giving me the desired outcome I'm looking for
You need to update the Subscription, not the Subscription Item.
The ID of the object you're updating should start with sub_.
And for curl the argument would be -d cancel_at_period_end=false
Make sense. What about for webhooks? I'm currently listening for:
customer.subscription.deleted
customer.subscription.resumed
customer.subscription.updated
Should I add another one to track when a customer cancels because I can't currently tell until the end of the period. Shouldn't I know the same day the person cancels?
Hello, I can help in a minute. Catching up now...
cancel_at_period_end should be covered by the customer.subscription.updated event. If it helps, events have a previous_attributes hash that shows what fields changed for this update, so you should be able to use that to tell if that updated event is about the cancellation