#๐Ÿ• (Luca)

1 messages ยท Page 1 of 1 (latest)

brazen heraldBOT
vivid nova
#

Is there a particular limitation that is preventing you from using the Stripe coupons?

cyan prairie
#

thank you for the help.
I'm checking coupons.
So, you are saying that I can apply trial to a subscription that had a trial before?
What happens if the user tries to redeem a code and the subscription is in incomplete status? Is the status changed to trialing again?

#

Regarding coupons, we don't want the user to input the coupon during checkout

#

We want the user to redeem free months for the subscription before the end of the subscription

vivid nova
#

So, you are saying that I can apply trial to a subscription that had a trial before?
Correct, yep. You can apply trial to an active subscription at any point
What happens if the user tries to redeem a code and the subscription is in incomplete status? Is the status changed to trialing again?
No, it'll error:

{
    "error": {
        "message": "You cannot update a subscription in `incomplete` status in a way that results in a new invoice or invoice items. Only minor attributes, like `metadata` or `default_payment_method`, can be updated on such subscriptions.",
        "request_log_url": "https://dashboard.stripe.com/test/logs/req_cE3L1vO3xeiAkD?t=1668159201",
        "type": "invalid_request_error"
    }
}
#

We want the user to redeem free months for the subscription before the end of the subscription
You can apply a Stripe coupon/promotion code at any point โ€“ it doesn't need to be during creation/checkout

cyan prairie
#

ok so I will need to update a subscription attaching a coupon to it, correct?
How can I define a coupon that will give the user X months for free?

vivid nova
cyan prairie
#

oh perfect! this is so helpful thank you!
So while editing a subscription, adding a coupon, it is possible the subscription has a status that is not active or trialing.
Can you please list the subscription statuses that won't create an exception/error?

#

Because at this point, I need to understand when to create a new subscription (with a coupon) or when to update an existing one

vivid nova
#

AFAIK you can apply a coupon/discount to a subscription with any status (except cancelled I guess)

#

This should be easy enough for you to confirm via some testing. I just tried incomplete and it worked but the new discount didn't apply to the already created initial invoice โ€“ it'll be applied to subsequent billing periods

cyan prairie
#

Oh I see, this will be a problem actually.
We want the discount to be applied immediately

vivid nova
#

Then you'd just pass it on your creation API call

#

And the initial invoice will include the discount

cyan prairie
#

So in this case, I see 2 options:

  1. Cancel that subscription and create a new one with the discount
  2. Adding a trial period period to the existing subscription -> Just wanna make sure the subscription will be moved from status incomplete to trialing again. Can you confirm that?
vivid nova
#

To clarify you mean you want an immediate discount applied to all subscriptions regardless of status when updating with a coupon?

#

Adding a trial period period to the existing subscription -> Just wanna make sure the subscription will be moved from status incomplete to trialing again. Can you confirm that?
It won't work, it'll error (as I shared above):

{
    "error": {
        "message": "You cannot update a subscription in `incomplete` status in a way that results in a new invoice or invoice items. Only minor attributes, like `metadata` or `default_payment_method`, can be updated on such subscriptions.",
        "request_log_url": "https://dashboard.stripe.com/test/logs/req_cE3L1vO3xeiAkD?t=1668159201",
        "type": "invalid_request_error"
    }
}
cyan prairie
#

The user can only have 1 subscription in our case. I would like that the user, while redeeming the code, will have X months for free on that subscription.

#

ok I see, so I need to cancel that subscription and create a new one I guess

vivid nova
#

Then I guess you'd need to some logic to determine subscription status and act accordingly:

  • If active/trialing update and apply coupon for X free months.
  • If incomplete/past_due cancel and create a new subscription with the same coupon.