Happy Business Starts Here

Adding/removing discount charges with REST

acostandi
Scholar

Adding/removing discount charges with REST

I have a bunch of subscriptions I need to change the EndDateCondition from being fixed period to aligning with subscription end. Since you can't update discounts, I need to remove the discount charge and add a new one. Any examples on how to do this with the REST API? I'm guessing I can call /v1/subscriptions/<subscription id> and have a json payload with a remove block to remove the discount and an add block to add a discount.

1 ACCEPTED SOLUTION

Accepted Solutions
yamasaki1ma
Master

Re: Adding/removing discount charges with REST

Hi @acostandi

 

Changing the contents of a discount may also occur in my future work. So I tried it.

 

I learned from your post that Discount's EndDateCondetion can not be changed with Update Amendment.
So, as you say, I think that there is only a way to do it by removing the existing Discount and adding a new Discount.
Also, as you say, I think the Zuora REST API to use is /v1/subscriptions /<subscription id>.

 

Precondition:
* ProductRatePlan_01:
  - It has a charge to bill 1,000 yen monthly.
* ProductRatePlan_02
  - It has a charge to discount 30% monthly for 6 months.
* ProductRatePlan_03:
  - It has a charge to discount 30% monthly until the end date of Subscription.
* Subscription term is one year. The start date is 2017/06/01, the end date is 2018/06/01.
* At the start date, Subscription has ProductRatePlan_01 and ProductRatePan_02
* At 2017/09/01, You decided to extend your customer's discount from 6 months to the end date of Subscription
  (That is, you decided to change ProductionRatePanan_02 to Production_03 at 2017/09/01)

 

The API you should call is

 

[PUT] https://rest.apisandbox.zuora.com/v1/subscriptions/{subscription Id}
Request Body

{
  "remove": [
    {
      "contractEffectiveDate": "2017-09-01",
      "ratePlanId": ProductRatePlan_02's RatePlanId (**Not ProductRatePlanId**)
    }
  ],
  "add": [
    {
      "contractEffectiveDate": "2017-09-01",
      "productRatePlanId": ProductRatePlan_03's ProductRatePlanId (**Not RatePlanId**)
    }
  ]
}


Only this is enough!

View solution in original post

1 REPLY 1
yamasaki1ma
Master

Re: Adding/removing discount charges with REST

Hi @acostandi

 

Changing the contents of a discount may also occur in my future work. So I tried it.

 

I learned from your post that Discount's EndDateCondetion can not be changed with Update Amendment.
So, as you say, I think that there is only a way to do it by removing the existing Discount and adding a new Discount.
Also, as you say, I think the Zuora REST API to use is /v1/subscriptions /<subscription id>.

 

Precondition:
* ProductRatePlan_01:
  - It has a charge to bill 1,000 yen monthly.
* ProductRatePlan_02
  - It has a charge to discount 30% monthly for 6 months.
* ProductRatePlan_03:
  - It has a charge to discount 30% monthly until the end date of Subscription.
* Subscription term is one year. The start date is 2017/06/01, the end date is 2018/06/01.
* At the start date, Subscription has ProductRatePlan_01 and ProductRatePan_02
* At 2017/09/01, You decided to extend your customer's discount from 6 months to the end date of Subscription
  (That is, you decided to change ProductionRatePanan_02 to Production_03 at 2017/09/01)

 

The API you should call is

 

[PUT] https://rest.apisandbox.zuora.com/v1/subscriptions/{subscription Id}
Request Body

{
  "remove": [
    {
      "contractEffectiveDate": "2017-09-01",
      "ratePlanId": ProductRatePlan_02's RatePlanId (**Not ProductRatePlanId**)
    }
  ],
  "add": [
    {
      "contractEffectiveDate": "2017-09-01",
      "productRatePlanId": ProductRatePlan_03's ProductRatePlanId (**Not RatePlanId**)
    }
  ]
}


Only this is enough!

View solution in original post