[Internal] One time coupon being reapplied on reactivating a cancelled subscription via API

Modified on: Mon, 30 Jan, 2023 at 2:13 PM

This article covers

One time coupon is getting reapplied when upgrading the plan using API

 

Summary

 

The merchant faces an issue of a one-time coupon being reapplied while reactivating a canceled subscription. 


Please find the steps below which the merchant executed:

  1. Subscribe with coupon code (coupon code name: "test") and we get a discount of 30% which is expected. API used chargebee.HostedPage.checkout_new_for_items)

  2. Cancel the subscription from the Chargebee portal (without issuing the credit - Option chosen).

  3. Reactivate the subscription by using the API (chargebee.HostedPage.checkout_existing_for_items). We have received the error message in the UI (Chargebee popup) when we enter the coupon code "test".

  4. Verify the invoice, we can see that the coupon code has been applied again.


Solution


Please find the observations below:

  • Initially, they are creating a subscription using the plan which has a 14 days trial via  the checkout_new_for_items API endpoint and they are adding the coupon on checkout

  • So when they add the coupon to the subscription it is just added to the subscription but it's not applied/consumed

"coupons": [{

    "coupon_id""TEST",

    "applied_count"0,

    "object""coupon"

}],

  • Then when they try to update the subscription via checkout_existing_for_items API endpoint by removing the trial period (subscription[trial_end]) and reactivating the subscription the already added coupon gets applied/consumed which is expected




Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.
×