Happy Business Starts Here

Re: Amendment AddProduct using RestAPI

Highlighted
Savvy Scholar

Amendment AddProduct using RestAPI

I am doing a 'RemoveProduct' and 'AddProduct' amendments through REST api for the same subscriptionId.

I am able to get the RemoveProduct to work.

 

But how do I "AddProduct". I have .net code that looks like below.

How do I create the REST equivalent.

I am unable to add products to the subscription.


// This is the .Net code

List<RatePlanChargeData> tempData = new List<RatePlanChargeData>();

if (condition) //assume this is true for Product 1
{
RatePlanCharge rpCharge = new RatePlanCharge();
rpCharge.PriceSpecified = true;
rpCharge.Price = 10;
rpCharge.ProductRatePlanChargeId = Row.ZuoraProductRatePlaneChargeId;//I have theZuoraProductRatePlaneChargeId from RemoveProduct
RatePlanChargeData rpchargedata = new RatePlanChargeData();
rpchargedata.RatePlanCharge = rpCharge;
tempData.Add(rpchargedata);
}

if (condition2)//assume this is true for Product 2
{
RatePlanCharge rpCharge = new RatePlanCharge();
rpCharge.PriceSpecified = true;
rpCharge.Price = 20;
rpCharge.ProductRatePlanChargeId = Product2ID; // I have this value
RatePlanChargeData rpchargedata = new RatePlanChargeData();
rpchargedata.RatePlanCharge = rpCharge;
tempData.Add(rpchargedata);
}
if (tempData.Count > 0)
ratePlanData.RatePlanChargeData = tempData.ToArray();

// Set the info on the RatePlan
ratePlan.ProductRatePlanId = Row.ZuoraProductRatePlanId;

// The RatePlanData is the parent object for RatePlan
ratePlanData.RatePlan = ratePlan;
// Add the RatePlanData object to the Amendment
amendment.RatePlanData = ratePlanData;

1 ACCEPTED SOLUTION

Accepted Solutions
Zuora Support Moderator

Re: Amendment AddProduct using RestAPI

The key information required to create an amendment for a subscription which involves new(add) product is given below, Using the RateplanCharge Object export the required information to construct the amend call as below,

Subscription Id(Subscription)

ProductRatePlanId(ProductRatePlan)

ProductRateplanchargeId(ProductRatePlanCharge)

Quantity(required for unit level pricing)

ContractEffectivedate(mandatory)

ServiceActivationdate (if required)

CustomerAcceptancedate(if required)

 

POST: https://rest.apisandbox.zuora.com/v1/action/amend

 

{
"requests": [
{
"Amendments": [
{
"ContractEffectiveDate": "2019-03-01",
"ServiceActivationDate": "2019-03-01",
"CustomerAcceptanceDate": "2019-03-01",
"Description": "Unit Level Pricing",
"Name": "Add Edu teams",
"RatePlanData": {
"RatePlan": {
"ProductRatePlanId": "2c92c0f8694d2ce9016951a579c36492"
},
"RatePlanChargeData": [
{
"RatePlanCharge": {
"ProductRatePlanChargeId": "2c92c0f9694d366b016951a6463b385a",
"Quantity": 100
}
},
{
"RatePlanCharge": {
"ProductRatePlanChargeId": "2c92c0f9694d366b016951a6463b385a",
"Quantity": 100
}
}
]
},
"Status": "Completed",
"SubscriptionId": "2c92c0f8695dc5480169708b55d85cad",
"Type": "NewProduct"
}
],
"PreviewOptions": {
"EnablePreviewMode": false
}
}
]

 

If you wish to create product rate plan charge from scratch and use them in the amend call above, please refer the below REST API in API Developer reference

 

POST: https://rest.zuora.com/v1/object/product-rate-plan-charge
 

 

 






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

View solution in original post

1 REPLY 1
Zuora Support Moderator

Re: Amendment AddProduct using RestAPI

The key information required to create an amendment for a subscription which involves new(add) product is given below, Using the RateplanCharge Object export the required information to construct the amend call as below,

Subscription Id(Subscription)

ProductRatePlanId(ProductRatePlan)

ProductRateplanchargeId(ProductRatePlanCharge)

Quantity(required for unit level pricing)

ContractEffectivedate(mandatory)

ServiceActivationdate (if required)

CustomerAcceptancedate(if required)

 

POST: https://rest.apisandbox.zuora.com/v1/action/amend

 

{
"requests": [
{
"Amendments": [
{
"ContractEffectiveDate": "2019-03-01",
"ServiceActivationDate": "2019-03-01",
"CustomerAcceptanceDate": "2019-03-01",
"Description": "Unit Level Pricing",
"Name": "Add Edu teams",
"RatePlanData": {
"RatePlan": {
"ProductRatePlanId": "2c92c0f8694d2ce9016951a579c36492"
},
"RatePlanChargeData": [
{
"RatePlanCharge": {
"ProductRatePlanChargeId": "2c92c0f9694d366b016951a6463b385a",
"Quantity": 100
}
},
{
"RatePlanCharge": {
"ProductRatePlanChargeId": "2c92c0f9694d366b016951a6463b385a",
"Quantity": 100
}
}
]
},
"Status": "Completed",
"SubscriptionId": "2c92c0f8695dc5480169708b55d85cad",
"Type": "NewProduct"
}
],
"PreviewOptions": {
"EnablePreviewMode": false
}
}
]

 

If you wish to create product rate plan charge from scratch and use them in the amend call above, please refer the below REST API in API Developer reference

 

POST: https://rest.zuora.com/v1/object/product-rate-plan-charge
 

 

 






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

View solution in original post