#gecko - Subscription Events

1 messages · Page 1 of 1 (latest)

fathom kiln
#

Hello!

#

I don't think incomplete_expired would be possible. For canceled let me think about that a moment...

crystal glacier
#

well...here's my problem:

#

case 'customer.subscription.created':

#

this is an event type i switch on, from webhook handler

#

and I'm getting those as error conditions

#

when I look at the docs, it doesn't show these as part of the enum

fathom kiln
#

I do think canceled would be possible in certain situations if your payment retry settings were configured in a certain way.

#

Which docs are you looking at?

crystal glacier
#

so I wonder A) why this is showing up in this event, and B) what are the possible enum values overall, so I can handle them appropriately

fathom kiln
#

That's a Checkout Session. A customer.subscription.created event contains a Subscription object, not a Checkout Session.

crystal glacier
#

oh yes wrong tab....hang on

fathom kiln
crystal glacier
#

status
enum
Possible values are incomplete, incomplete_expired, trialing, active, past_due, canceled, or unpaid.

#

this is for the customer subscription status....if I'm reading right....I check here, right?

#

and of all these, only "active" represents a "paid" scenario?

#

or does trialing count as "paid" too?

fathom kiln
#

Trialing means there's a free trial, so nothing has been paid yet, but the Subscription should be considered in good standing.

crystal glacier
#

got it

#

in this case, I'm trying to adjust the subscription, and was advised here previously for a new subscription, to move the trial_end to my date desired. and this update is failing because I'm trying to do it on invalid enum cases

#

so I think i just need this for "trialing" cases, and "active" ones don't?

fathom kiln
#

Not sure I understand, can you provide more details about why the update is failing? Do you have request ID showing the error?

crystal glacier
#

sure

#

req_7ZhZyxV8jxieea

#

this case of why it failed, I understand...it's an incomplete transaction that timed out

fathom kiln
#

Ah, gotcha.

crystal glacier
#

but my question is about these new subscriptions

#

I have a customer who signs up today, and I want recurring to be 1st of the month

fathom kiln
crystal glacier
#

so I was told to set trial-end to be the right epoch i want

#

and set proration to none

#

which is what I want

#

so when....does "active' status get used in an event context? will a customer.subscription.created have 'active' and 'trialing' to me? when do these occur, in what order....hopefully this makes sense

#

A subscription that is currently in a trial period is trialing and moves to active when the trial period is over.

#

this implies to me that all would start as a trial, regardless?

#

i create a checkout sesion with mode set to subscription, but nothing about a trial....it's started this way for me....so what comes first, trial, even though they've paid?

#

sorry it's just non-obvious, the flow for me

fathom kiln
#

Any Subscription that starts with a trial period will have a status of trialing. Any Subscription that's created without a trial and has successfully been paid, or if there's no payment due, will start with active.

#

Does that help?

crystal glacier
#

hmm

#

maybe

#

I do a create checkout, subscription mode, and no trial in any parameter. in this case, the status will be active, as soon as payment is successful?

fathom kiln
#

Yes.

crystal glacier
#

ok good.

#

now if I "update" a subscription, will this trigger a 'trialing' status?

#

i.e. can it go from active to trialing?

fathom kiln
#

Yes, that's possible, if you add a trial like you're talking about above.

crystal glacier
#

ok, got it. thanks.

#

now as a recurring subsciption occurs (renewal)....will this cause a checkout.session.completed type event, and not a customer.subscription.xxx type event...right?

fathom kiln
#

No.

crystal glacier
#

ah...checkout is only for the setup or the one-time....thanks!

fathom kiln
#

Yep!

crystal glacier
#

so if I want to catch the renewal events, I can listen for 'invoice.paid', right?

uncut furnace
crystal glacier
#

wouldn't subscription status tell me that...by trialing or by active?

uncut furnace
#

maybe can you share more on what you're trying to achieve here by trying to catch the "renewal events"?

crystal glacier
#

let's stay on invoices

#

invoice.pad event: invoice.billing_reason === subscription_create is a payment succeeded for the first time a subscription is created. and invoice.billing_reason === subscription_cycle is for payment succeeding on the subsequent renewal cycles. right?

uncut furnace
#

yes, that's correct

crystal glacier
#

ok thx much! support here is always top notch!!!!