#gabor

1 messages ยท Page 1 of 1 (latest)

rare cryptBOT
steel rapids
#

Good question. Can you show me what you are doing in the API now and what error you get?

hybrid gull
#

Sure, just a sec.

#

stripe subscriptions update sub_1MrPeHIW2fFx6PmmZuvxm1U3 --coupon=referral-monthly

#

Then I still have "discount": null in the subscription object.

steel rapids
#

Oh interesting. So we don't error out but it still doesn't get set

hybrid gull
#

it seems like

#

I also tried with a clock, in different months, and got the same result.

steel rapids
#

Do you have the request ID from a time you tried this? (req_123)

#

Looking through your logs but if you have it on hand that would be easier

hybrid gull
#

Where can I find it?

steel rapids
#
hybrid gull
#

I can just do one more request, so that will be the newest.

steel rapids
#

Yes please much appreciated

hybrid gull
#

I've just done one that set the discount object. Hm.

steel rapids
hybrid gull
#

It might be because I used a different coupon than in the last one?

steel rapids
#

Exactly my thoughts

#

Can you try advancing the test clock and doing the same coupon?

hybrid gull
#

Yes, I was going to say the same thing. Just a sec.

#

done

#

no discount added this time

steel rapids
#

I think this is a bug. I will file a report. Can try to think of workarounds in the mean time if you need this now.

hybrid gull
#

Thank you! I will try, but not really sure if it will work without the once coupons. The problem is that it's not possible to remove coupons from a subscription manually, if I'm right.

#

I'm building a reward system. I have 13 different coupons in the system. One 100% coupon for the monthly plan, and twelve others like 8.33%, 16.67% etc. to 100% for yearly plan, so that we can give away multiple free months.

#

I built a logic that would updated the attached coupon dynamically, based on the available reward points in our db.

#

once coupons work for this, because they are removed from the subscription after used up when the invoice paid. So, if there is no free month for next month, there is no coupon.

#

I'm not sure if it is possible to do this with the forever coupons, if deleting them from subscriptions is not possible via the API.

steel rapids
#

Testing this now, you can remove coupons from subscriptions via the API by passing coupon=""

hybrid gull
#

Oh, that's great, thanks for that!

steel rapids
#

Yeah, so that may help work around or get other functionality that you are looking for. I was just able to use it to unapply and then apply a one time coupon.

hybrid gull
#

Yes, that sounds good, it's going to work for me, probably! Thanks again for your help!

#

I have one more question, if that's okay:

steel rapids
#

Glad I could help. And like I said I will file a bug report so needing to do that should go away

#

And sounds good what is your question? As a heads up I'm about to leave but @sturdy raptor is here

hybrid gull
#

No problem. My other question is about events. When is it best time to add a new coupon to the subscription after the previous one was used? I tried invoice.finalized, but didn't work. It's possible though that the once problem caused it (what we've just discussed).

sturdy raptor
#

Hello ๐Ÿ‘‹
The invoice can only be modified when it is in draft status. You can't update it once it has been finalized. So you'd likely want to rely on invoice.created webhook events instead.

hybrid gull
#

Hi @sturdy raptor ,
I mean I'd like to create a new coupon once a period ended, and the previous coupon was used.

#

I'm planning to update the coupons at three events in the system:

  • when the customer receives a new reward point (one free month)
  • when the invoice is paid (a period ended)
  • at plan switch (from monthly to yearly)
sturdy raptor
#

Ah, sorry for the misunderstanding.

#

Maybe invoice.paid event then?

hybrid gull
#

No problem

#

So, if I create a new coupon when got invoice.paid, will that discount belong to the next payment period?

#

It sounds logical

sturdy raptor
#

Yup ๐Ÿ™‚ Since you already have an integration running, you can test it out quickly w/ test clocks

hybrid gull
#

Great! I will, just wanted to ask before I continue, because ran into some errors previously. But it's likely they happened because of what we discussed above.

#

I have one more question about plan switch, but I will ask that later. First I will do some tests and see how things work that way.

#

Thank you for your help!

sturdy raptor
#

Sounds good! Good luck ๐Ÿ˜„

hybrid gull
#

Thanks ๐Ÿ™‚