#Jordy

1 messages · Page 1 of 1 (latest)

crisp solarBOT
fair karma
#

Hey Rubeus

fringe ore
#

Hello! Are you setting an order_id when you create the Subscription?

fair karma
#

No

#

I'm building this in bubble, but I'm using subscription id and customer id for id fields

fringe ore
#

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?

fair karma
#

Haha, I don't know then. I just thought it was required for the curl call

#

You're right

fringe ore
#

Where did you see a curl call doing that?

fair karma
#

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

fringe ore
#

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.

fair karma
fringe ore
#

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.

fair karma
#

ok, thank you Rubeus. Sorry it's such a simple thing to not know

fringe ore
#

Are you familiar with passing form data to a URL using curl?

fair karma
#

Yes I've done it several times actually but not enough that I can do it without reading a lot of documentation first

fringe ore
#

Is there a reason you want to do this with curl instead of in the Dashboard?

fair karma
#

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?

fringe ore
#

What do you mean by "automated"?

fair karma
#

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

fringe ore
#

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?

fair karma
#

I'm using a no-code platform called bubble

fringe ore
#

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?

fair karma
#

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

fringe ore
#

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

fair karma
#

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?

analog agate
#

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