#Shybes

1 messages · Page 1 of 1 (latest)

nimble flowerBOT
elder hill
#

Sorry this got missed @bold sage -- are you still here?

#

If so @plain lava can help

stark fjord
#

Yup, sorry.

#

Just been a busy day

plain lava
#

Gotcha, and again apologies we missed your followup.

#

Can you tell me a bit about what you were looking at for those sessions in the last thread?

stark fjord
#

yup, here let me see if i can find the thread and give you a screenshot

celest coral
#

Hi, stepping in here and catching up

#

I'm still unsure what the issue is here. Can you summarize the outstanding question here please? What are you expecting to see vs. what you're seeing?

stark fjord
#

Sure! Basically when applying the discount code for the free trial, we're noticing the the UI does not reflect that discount anywhere. But, if we apply the same discount code into the regular subscription, it shows up fine.

celest coral
#

So you're expecting to see 'Then $49.00 per year' on thet 7 day free trial screenshot?

stark fjord
#

Either that, or, to see $99.00 crossed out and replaced with 49$ per year.

#

Just some method of knowing that the discount is accurately applying for the free trial, for both ourselves, and our potential users.

keen cedar
#

👋 quick question - how are you applying the discount code? In both the examples you gave I'm not seeing a discount applied to either of them

stark fjord
#

@keen cedar we created a coupon & include that coupon id in the discount field when we do checkout.session.create()

keen cedar
#

The Checkout Session IDs you gave don't include any coupon or discount though - did you maybe send over the wrong ones?

stark fjord
#

I don't think so? This is the image where it's accurately applying.

keen cedar
#

Which CHeckout Session is that for? When I look at the CHeckout session for cs_test_a1NZBOt99NujWdJGG02a7tvXjQaOrFO9OxVd4iFwMskiHBkPpMySVkRal1 I see this:

stark fjord
#

Also, to follow up on the subscription scheduler, what event can we capture with the webhook to check if the user actually renewed their subscription instead of cancelling?

#

oh. odd, I'll see if i can grab another one, but it might take a little bit. We pivoted onto some other work.

#

seems like i sent over the wrong test checkout session

keen cedar
#

Are you asking which event you need to listen to to know that a subscription renewal was paid for?

#

I'm not fully following what you mean by "instead of cancelling"

stark fjord
#

Correct, and, in the circumstance where their renewal was not paid for - how we can catch that interaction so we can demote their user tier on our backend.

keen cedar
#

You can listen for the invoice.paid webhook event to know that a Subscription invoice has been paid for

#

And the invoice.payment_failed for when a user hasn't paid and need to demote them

stark fjord
#

im still struggling a little with knowing if they canceled before free trial ended (because trial ending isn't listed as something that triggers subscription.updated), or knowing what they bought when the complete checkout.

keen cedar
#

Is it important for you to be able to distinguish whether the subscription was cancelled before or after the trial? And a trial ending would definitely trigger a customer.subscription.updated event

stark fjord
#

ah, if it triggers the customer.subscription.updated event that definitely makes things easier

#

but yeah it should be important to distinguish if their subscription was cancelled before or after, since once requires immediate demotion of their subscription tier, whereas the other requires waiting till the end of their subscription period

keen cedar
#

Yeah a customer.subscription.updated will be triggered for ANY change that is reflected on the subscription - a subscription changing statuses (like trial -> canceled or trial -> active) would all have those updated events

stark fjord
#

Also, just to confirm :

  • subscription.updated to see if trial ended
  • subscription.canceled to see if user canceled
  • subscription.past_due / invoice.failed to see if they didn't pay to renew subscription but didn't cancel?
keen cedar
#

yup!

stark fjord
#

great

#

you're damn helpful lol

keen cedar
#

And just to be clear - a lot of these events can be used for different things (in particular, the customer.subscription.updated event can be used for a lot of different applications because it's triggered for all changes)

#

So I'd start with the events we suggested, test them out and see how they're working for you, and if there are any that don't quite work you can see which other events are a good alternative

stark fjord
#

awesome

#

while i still have ya

#

I still don't know how to get the product from the checkout session completion which I think I have to do because I need see if they did pay for the 2 years upfront, but shouldn't I be able to use subscription.created for that? (since i create subscription for 2yr w/ free trial when they buy the 2 years upfront)

keen cedar
stark fjord
#

perfect

#

thank you so much!

#

this was a little bit of a headache at first but definitely feelin much better about some of this stuff lol

keen cedar
#

glad we could help a bit!

#

and if you get a chance to share those different checkout session ID feel free - I tried reproducing your issue on my end and am seeing coupon being reflected correctly with a trial, so seeing your specific checkout sessions would help

stark fjord
#

Let me see if i can pivot over

#

btw, when i did ./stripe trigger checkout.session.completed it seemed like there were no line items in event.data

#

ex :
elif event.type == "checkout.session.completed":
        print(event.data)

keen cedar
stark fjord
#

Gotcha

#

yeah that definitely makes sense

#

Okay, here ya go

#

cs_test_a1fjUZnk9g9u66pIV9a9zCNgda6wXWrbQAqI1ibZG4xJsG6Ko5xFPgHVxz

#

doesn't seem like there's any mention of the coupon anywhere

keen cedar
#

Your checkout session request isn't passing in anything for discount when it's creating the Checkout Session - if you look at the CHeckout Session creation request here (https://dashboard.stripe.com/test/logs/req_r9R6VQvDHAk4Mb) you can see you don't pass in the discount/coupon anywhere

stark fjord
#

gotcha

#

Okay, thank you!

#

That should be everything from me, really appreciate your help once again.

stark fjord
#

annnyways, feel free to close out this thread whenever 🙂