#gecko - update price

1 messages · Page 1 of 1 (latest)

cloud crow
#

Hi!

charred pulsar
#

hi pgskc

#

i don't have any customers tethered to this subscription

cloud crow
#

taking a look here, give me a second please

charred pulsar
#

can I edit it, by adding a billing cycle anchor to it?

#

stripe CLI or something equivalent

cloud crow
#

Are yo able to add more context into what you're really trying to do?

charred pulsar
#

i created a subscription price. I've subsequently learned that in order for me to specify the recurring day it issues, I need to use this parameter

#

so my question is can I edit an existing one, or I have to create new?

#

clearer?

oblique fern
#

@charred pulsar when you create the subscription you pass the billing_cycle_anchor you want along with the price ID for the subscription

charred pulsar
#

so what I've done before is create my prices via the website, and there's just a "recurring" menu pull down, but not the anchor as an additinoal option. So....this would be a first for me @oblique fern ...I create a price first ,and then a subscription from the priceID that's first created? if so, can I just use existing price ID's and not create a new one?

oblique fern
#

Yeah so prices only have a period, you can set it to monthly, yearly, etc. It has no effect on the day that the subscription will actually bill, and you can't set the billing_cycle_anchor on the price itself.

Create the price with the term you want (assuming monthly)
Then when you create the subscription, you will pass that price, along with the billing_cycle_anchor (https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_cycle_anchor) which will be a timestamp representing the date you want the billing day to be

#

So let's say you create a subscription today, but you want it to bill on the first of the month every month. You'd pass billing_cycle_anchor=1651363200

#

(1651363200 is the UTC timestamp for May 1 @ 12 AM)

verbal gale
charred pulsar
#

so here's my simple case....I have a $5 price. I want to offer a $5/monthly subscription. (I have a subscription already created for this, but without the anchor)

#

so, I would delete/archive the existing subscription, and create a new one, or modify the existing one....

#

i have no customers on this subscription, so it seems like I could just use the API to modify the existing subscription. right?

cloud crow
charred pulsar
#

the price, when I set it up, can be a single point purchase only, or a recurring purchase.

#

price_1KNrHxDeb8L7gMecCehwwS9o

#

this is an example, of what I setup as a recurring price, and there were no customers before hand...that seems chicken and egg to me

#

so...can I just modify this price and move the anchor?

cloud crow
#

You cannot modify the price with billing_cycle_anchor as that is not a parameter for updating a price. You would create the price and when you're creating the subscription with billing_cycle_anchor you'd use that price. The billing_cycle_anchor is a parameter on the subscription and not set on the price. So to directly answer your question, no.

charred pulsar
#

So what exactly is that price then I provided? It was setup as a recurring price. That’s not a subscription

cloud crow
#

Correct, that is not a subscription. Rather a recurring price.

#

To create a subscription, you'd leverage that price

charred pulsar
#

So previously I exposed a recurring price, to a customer and they did a checkout on it. It set up a recurring billing. Was a subscription object then created automatically?

cloud crow
#

Yes, that is correct

charred pulsar
#

and thus...you're saying that the subscription is the only place to set the anchor...and thus I need to handle customer subscription creation events, and change the anchor, to the day I want, for each and every customer, and not something I can setup specific to the product/price. correct?

cloud crow
#

That is correct.

charred pulsar
#

ok...and if I get the event, which I believe is, "subscription_schedule.created"....then I simply modify the anchor to be the next cycle date in the future (like May 1 as the example from Nick above)...and I do this once, and not every cycle (monthly in my case)...right?

#

your docs seem clear on this, so yes I think I'm right

#

With this approach, you most likely want the default behavior of setting proration_behavior to create_prorations—as in the code sample—so the customer isn’t overcharged for unused time in the previous cycle.

#

i don't want a proration for the current cycle. how to ensure this default behavior is not enabled?

#

'none'?

verbal gale
#

Jumping in as my teammate needs to step away soon. It doesn't sound like you're working with Subscription Schedules (those are different objects than Subscriptions) so I don't think that's the event you want. Instead you'd want to look for customer.subscription.created events.

#

To shift the billing_cycle_anchor to a specific date/time, you'll need to update the subscription with a trial period as mentioned in the documentation that I linked earlier.

charred pulsar
#

the flow I understand: I have a product with a price. customer goes to checkout and selects recurring price. that creates a customer subscription object. (event customer.subscription.created)

verbal gale
#

You'll also need to keep in mind that you need to continually calculate what the billing_cycle_anchor should be set to as you'll run into problems if you try to use a date that's in the past.

charred pulsar
#

I can, at that point, edit the subscription?

verbal gale
#

Correct.

charred pulsar
#

yes I understand I need to be future looking on the epoch calc

#

🙂

#

thanks

#

as for trial, I don't want a trial

#

if they sign up some time in the month, I want the full bill immediately, regardless of when in the month

#

what to do about the trial you say is mandatory?

verbal gale
#

So if you don't set the trial initially, then the checkout session will charge for a full period immediately. The trial is added afterwards behind the scenes to move the billing_cycle_anchor, though you will want to play with the various prorations settings to ensure you find the setting that matches your desired flow.