Welcome to Zuora Product Documentation

Explore our rich library of product information

Subscribe to a calculated charge rate plan using the REST API (Use Case 2)

This topic explains the use of REST API to subscribe to a product rate plan with a calculated charge by overriding minimum and maximum amounts, percentage, and eligibility conditions.

The supported order actions are createSubscription, addProduct, and changePlan.

The supported order actions are createSubscription, addProduct, and changePlan.

  • minimumAmount

  • maximumAmount

  • percentage

  • eligibleAccountConditions

  • eligibleChargeConditions

  • clearingExistingMinimumAmount (set it to “true” to reset the amount to null)

  • clearingExistingMaximumAmount (set it to “true” to reset the amount to null)

The example order requests below are of createSubscription order action. For addProduct, changePlan order actions, the new tags (highlighted in bold text below) for calculated charge are the same.

Subscribe to a rate plan with calculated charge by ID decd3ce382a4430ab87e362aafec9c59 and override the following attributes:

  • Change percentage to 10%

  • Change minimum amount to 100

  • Change maximum amount to 2000

  • Set eligible account to be the invoice owner account of this calculated charge

  • Set eligible charges to be all the usage charges

  1. Determine the values of the following variables:

    Variable

    Description

    $AccountNum

    The number of the account that will own the order. For example, A00013328 .

    $Today

    Today’s date. For example, 2025-12-01.

    $MinimumAmount

    The minimum amount of calculated charges. For example, 100.

    $MaximumAmount

    The maximum amount of calculated charges. 2000.

    $Percentage

    The percentage of the total spend of eligible charges. For example, 10.

    $ProductRPId

    The ID of the product rate plan to subscribe to. For example, 41f98c3a3d8d45bc9d32709b0761be7b.

    $ProductRPChargeId

    The ID of the product rate plan charge to use when adding the product rate plan. For example, decd3ce382a4430ab87e362aafec9c59..

  2. Use the Create an order operation to create an order under an existing account:

    Request

    POST /v1/orders/

    Request Body

    {
       "category": "$Category",
       "existingAccountNumber": "$AccountNum",
       "orderDate": "$Today",
       "subscriptions": [
           {
               "orderActions": [
                   {
                       "createSubscription": {
                           "subscribeToRatePlans": [
                               {
                                   "chargeOverrides": [
                                       {
                                           "pricing": {
                                               "recurringCalculated": {
                               "minimumAmount": "$MinimumAmount",
                               "maximumAmount": "$MaximumAmount",
                                "percentage": "$Percentage",
                                                   "eligibleAccountConditions": {
                                                       "field": "InvoiceOwner.Id",
                                                       "operator": "eq",
                                                       "value":"{{CurrentInvoiceOwner.Id}}"
                                                   },
                                                   "eligibleChargeConditions": {
                                                       "field": "RatePlanCharge.ChargeType",
                                                       "operator": "eq",
                                                       "value": "Usage"
                                                   }
                                               }
                                           },
                                           "productRatePlanChargeId": "$ProductRPChargeId"
                                       }
                                   ],
                                   "productRatePlanId": "$ProductRPId"
                               }
                           ],
                           "terms": {
                               "autoRenew": false,
                               "initialTerm": {
                                   "period": 12,
                                   "periodType": "Month",
                                   "startDate": "2025-12-01",
                                   "termType": "TERMED"
                               },
                               "renewalSetting": "RENEW_WITH_SPECIFIC_TERM",
                               "renewalTerms": [
                                   {
                                       "period": 2,
                                       "periodType": "Month"
                                   }
                               ]
                           }
                       },
                       "triggerDates": [
                           {
                               "name": "ContractEffective",
                               "triggerDate": "2025-12-01"
                           },
                           {
                               "name": "ServiceActivation",
                               "triggerDate": "2025-12-01"
                           },
                           {
                               "name": "CustomerAcceptance",
                               "triggerDate": "2025-12-01"
                           }
                       ],
                       "type": "CreateSubscription"
                   }
               ]
           }
       ]
    }