#justin - schedules + promo codes

1 messages ยท Page 1 of 1 (latest)

narrow timber
#

Hello, good question. I am not sure our recommended way to apply promo codes for subscriptions on a schedule but am looking in to it.

brisk stratus
#

cool cool, at least I'm not crazy!

narrow timber
#

Can you try adding the promo code again and send me the request ID (req_123) from the call that gets that error?

#

Yeah no worries, subscription schedules are one of our most complex API concepts

brisk stratus
#

you want me to try adding a promo code to a subscription schedule you mean?

#

the error I was talking about in the above was when I was trying to apply a discount to an invoice like so (using ruby): Stripe::Invoice.update('in_1LUx5LHZaSBcFk7iOXaL0dwM', discounts: [{discount: 'di_1LUxHRHZaSBcFk7iw69tEA1p'}])

resulting in req_4iqqRICn8NAPHv

but that was a very last-ditch attempt to solve this problem, it doesn't feel right anyway

narrow timber
#

There we go, thank you. Not 100% if that will be relevant in the end but I wanted to make sure to have it on hand

brisk stratus
#

sounds good! it feels like the missing piece here is having SubscriptionSchedules take a promotion_code parameter. I guess I want to confirm that doing so is impossible right now, and if that's the case figure out what the next best thing will be.

And thanks for your help

narrow timber
#

Still looking in to this but a quick update: I think the reason that the discount isn't applying is that the discount was added after the invoice was generated. I will probably need to look in to how to apply them to existing subscriptions like this in a moment/

#

And it looks like the way to apply the discount would be by setting coupon in the phase(s) for your subscription, but I forget if you need to apply it to each phase or just the first one and it won't be overwritten as long as you don't specify coupon in another phase

#

Do you have a quick test that you can run now to try adding coupon to just the first phase?

brisk stratus
#

yeah that was actually my original approach. it seemed to work but then didn't:

  • Create SubscriptionSchedule with coupon (this makes the invoice work)
  • Update the Subscription created by the SubscriptionSchedule with promotion_code

but the problem was that it redeemed the coupon, and then redeemed the promo code, and it was set to "one redemption per customer" (so this method results in double-redemption)

#

using a coupon in the first phase works beautifully, but the missing piece there is the promo code redemption.

what kind of test would you like me to run?

#

here's one with coupon in the first phase of the SubscriptionSchedule and the Subscription subsequently updated with a promotion_code: sub_1LUytgHZaSBcFk7ibf2BdjyY

narrow timber
#

Thank you for the info. Can you elaborate on why the second call to add the promotion code is necessary? Is the counter not updated correctly if you only use the coupon code in a phase?

brisk stratus
#

that's exactly right

#

the second call is my attempt to redeem the promo code, but the issue I ran into is that it literally redeems the promo code/coupon twice

narrow timber
#

Gotcha. I am having trouble finding if there is a good way to do this myself at the moment so I am reaching out to my colleagues for help. I'll let you know what we can find

brisk stratus
#

thanks, I've set liberal notifications on this thread

narrow timber
#

So it turns out you are correct, this is not currently possible in the API. It is on the roadmap but in the meantime you will need to track this redemption count yourself

brisk stratus
#

is it possible to go about this from another angle? for example, applying the promo code to the invoice generated for the Subscription when the SubscriptionSchedule is created?

cyan fossil
#

Hi there ๐Ÿ‘‹ taking over for @narrow timber

Give me a few minutes to get caught up.

#

for example, applying the promo code to the invoice generated for the Subscription when the SubscriptionSchedule is created?
I think this would run into other problems. If I understand correctly, I think the redemptions would work as expected, but the coupon would be applied to the invoice and then there would be no subsequent applications of it for any other invoices/subscriptions

brisk stratus
#

the discount object represents a single application of a coupon or promo code right?

I only want the promo code to apply to the first phase of the SubscriptionSchedule anyway. but when I tried to do this, I got the error described above (#1006652318156062741 message)

cyan fossil
#

Ahhh, right right. Sorry about that oversight. I completely forgot that it doesn't work like that on the invoice level.

#

I can't think of another way to get this to work the way you're hoping. Hate to give that answer, but I don't know if this is possible without tracking redemptions on your end

brisk stratus
#

so you think I can't apply a promo code directly to an invoice?

cyan fossil
#

Correct. For invoice-level discounts you would either have to use Customer Balances, add negative invoice items, or add a second price that is a cheaper version of a product's usual price.

brisk stratus
#

well crud. as far as this being on the roadmap, is that on the order of years away?

cyan fossil
#

I would be really surprised if it wasn't released before the end of the year. I can't really elaborate beyond that, as it's not obvious what the release timeline is. I'm just judging by the work I can see that's been done on it already.

brisk stratus
#

cool I appreciate it

#

will track manually for now. have a good one

cyan fossil
#

Likewise! Cheers

brisk stratus
#

oh actually, if I could ask one followup?

#

I used SubscriptionSchedules because I needed to:

  • Apply one price in the first month of the subscription
  • Apply another price for all subsequent months

is there a better way to do this? The only alternative I could think of was to have my own scheduled job for updating the subscription but that seemed a lot more error-prone than letting Stripe deal with it for me

cyan fossil
#

Subscription Schedules is definitely the best way to do that without having to meticulously curate a whole (likely pretty fragile) workflow to handle the switch from the first price to the second. Plus all the issues with proration that come along with that.

brisk stratus
#

yeah that's what I thought too. if only it took promo codes hahah

#

alright that's all from me for real this time ๐Ÿ™‚