Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Tip

Available from CRM.COM R9.1.0


Excerpt

This method is used to calculate the rates that will be applied while creating a new subscription or modifying an existing one, before submitting the actual request. The rates calculation can be applied on a single subscription per each call.

...

. The rates calculation can be applied on a single subscription per each call.

Resource URL

http://host_name/crmapi/rest/$version/subscriptions/calculate_rates

Parameters

Name

Type

Description

token

String

The token retrieved from the login method

mode

(mandatory)

String

It determines if the rate calculation should be applied on a new subscriptions or a modification of an existing subscription. The following options are supported:

  • RATE_BECOME_SUBSCRIBER: If this mode is set then it is mandatory to specify an accounts receivable, and subscription object and optionally a buy in advance request object. All the other fields are not applicable.
  • RATE_ACTIVATE_SUBSCRIPTIONS: If this mode is set then it is mandatory to specify a subscription identifier and optionally a buy in advance request object. All the other fields are not applicable.
  • RATE_ADD_SERVICES: If this mode is set then it is mandatory to specify a subscription identifier, the set of new subscription services that will be added and activated and optionally a buy in advance request object. All the other fields are not applicable.
  • RATE_REMOVE_SERVICES: If this mode is set then it is mandatory to specify a subscription identifier, the set of existing subscription services that will be removed and optionally a buy in advance request object. All the other fields are not applicable.
  • RATE_SWAP_SERVICES: If this mode is set then it is mandatory to specify a subscription identifier, the set of existing subscription service swaps and optionally a buy in advance request object. All the other fields are not applicable.
  • RATE_START_SERVICES: If this mode is set then it is mandatory to specify a subscription identifier, the set of existing subscription services that will be started and optionally a buy in advance request object. All the other fields are not applicable.
  • RATE_STOP_SERVICES: If this mode is set then it is mandatory to specify a subscription identifier, the set of existing subscription services that will be stopped and optionally a buy in advance request object. All the other fields are not applicable.
  • RATE_ADD_EXPENSES: If this mode is set then it is mandatory to specify a subscription identifier, and the set of new subscription services (expenses) that will be added
  • RATE_BUY_IN_ADVANCE_REQUESTS: If this mode is set then it is mandatory to specify a subscription identifier and a buy in advance request object. All the other fields are not applicable.
  • RATE_AMEND_SERVICES_INSTALLED_ITEMS: If this mode is set then it is mandatory to specify a subscription identifier, the set of new and/or removed and/or swapped subscription services and/or the set of new/removed subscription installed items
  • RATE_BILLING_FREQUENCY_CHANGE: If this mode is set then it is mandatory to specify billing frequency.
Tip

RATE_AMEND_SERVICES_INSTALLED_ITEMS available from CRM.COM R14.3.0

RATE_BUY_IN_ADVANCE_REQUESTS deprecated in CRM.COM R18.0.0

RATE_BILLING_FREQUENCY_CHANGE available from CRM.COM R14.28.0


number_of_additional_periods

(optional)

NumberIt determines if the rates should be calculated only for the upcoming period or for additional billing periods. If not specified then the method will return only the rates for the upcoming period

scheduled_date

(optional)

Date

The date on which the subscription action is scheduled to be executed, therefore rates will be applied as of this scheduled date.

Tip

Available from CRM.COM R14.5.0


subscription_identifier

(mandatory and applicable on conditions)

Subscription Identifier

The identifier of the existing subscription that should be rated. The allowed subscription identifier fields are the following:

Include Page
V4:subscription_identifier
V4:subscription_identifier

Note that this information is applicable and mandatory only if the mode is set to RATE_ACTIVATE_SUBSCRIPTIONS, RATE_ADD_SERVICES, RATE_REMOVE_SERVICES, RATE_SWAP_SERVICES, RATE_START_SERVICES, RATE_STOP_SERVICES, RATE

_BUY_IN_ADVANCE_REQUESTS, RATE_ADD_EXPENSES

_BUY_IN_ADVANCE_REQUESTS, RATE_ADD_EXPENSES, RATE_BILLING_FREQUENCY_CHANGE, RATE_AMEND_SERVICES_INSTALLED_ITEMS

accounts_receivable

(mandatory and applicable on conditions)

Accounts Receivable Object

Information related with the accounts receivable that will own the new subscription that will be rated.

Note that this information is applicable and mandatory only if the mode is set to RATE_BECOME_SUBSCRIBER

subscription

(mandatory and applicable on conditions)

Subscriptions Object

Information related with the new subscription that will be rated

Note that this information is applicable and mandatory only if the mode is set to RATE_BECOME_SUBSCRIBER

buy_in_advance_request

(mandatory on conditions)

Buy in Advance Request Object

Information related with a buy in advance request that might be applicable on the new or existing subscription that will be rated.

Note that this information is applicable for all modes but is mandatory only if the mode is set to RATE_BUY_IN_ADVANCE_REQUESTS

Tip

Deprecated from CRM.COM R18.0.0


new_services_set

(mandatory and applicable on conditions)

Set of New Subscription Services

Information with new services that will be added and activated on the existing subscription that was specified

Note that this information is applicable and mandatory only if the mode is set to RATE_ADD_SERVICES or RATE_ADD_EXPENSES

When the mode is set to RATE_AMEND_SERVICES_INSTALLED_ITEMS, this information is applicable but it is optional.

existing_services_set

(mandatory and applicable on conditions)

Set of Existing Subscription Services

Information with existing subscription services that will be modified on the existing subscription that was specified

Note that this information is applicable and mandatory only if the mode is set to RATE_REMOVE_SERVICES, RATE_START_SERVICES, RATE_STOP_SERVICES.

When the mode is set to RATE_AMEND_SERVICES_INSTALLED_ITEMS, this information is applicable but it is optional.

services_swap_set

(mandatory and applicable on conditions)

Set of Existing Subscription Services that will be swapped

Information with existing subscription services that will be swapped on the existing subscription that was specified

Note that this information is applicable and mandatory only if the mode is set to RATE_SWAP_SERVICES.

When the mode is set to RATE_AMEND_SERVICES_INSTALLED_ITEMS, this information is applicable but it is optional.this information is applicable but it is optional.

installed_items_to_add_set

(optional and applicable on conditions)

Set of New Subscription Installed Items

Information with new subscription installed items that will be added on the subscription that was specified

Note that this information is applicable and optional only if the mode is set to RATE_AMEND_SERVICES_INSTALLED_ITEMS

Tip

Available from CRM.COM R14.3.0


installed_items_to_addremove_set

(optional and applicable on conditions)

Set of New Existing Subscription Installed Items

Information with new subscription installed items that will be added on removed from the subscription that was specified

Note that this information is applicable and optional only if the mode is set to RATE_AMEND_SERVICES_INSTALLED_ITEMS

Tip

Available from CRM.COM R14.3.0


installed_items_to_remove_setbilling_frequency

(optional mandatory and applicable on conditions)

StringSet of Existing Subscription Installed Items

Information with new subscription installed items that will be removed from the subscription that was specified

Note that this information is applicable and optional only if The billing frequency of the billing terms that will be created. Billing Frequencies are used to denote how often a subscription should be billed.The supported options are the following:

DAILY, WEEKLY, MONTHLY, QUARTERLY, BIANNUAL, ANNUAL, TWOYEARS, CUSTOM1, CUSTOM2, CUSTOM3, CUSTOM4, CUSTOM5

When the mode is set to RATE_AMEND_SERVICES_INSTALLED_ITEMS, this information is applicable but it is optional.

When the mode is set to RATE_AMENDBILLING_SERVICES_INSTALLED_ITEMSFREQUENCY_CHANGE, this information is mandatory.

Tip

Available from CRM.COM R14.328.0


udf_string_1 

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_string_2 

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_string_3 

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_string_4 

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_string_5

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_string_6 

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_string_7

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_string_8

(optional)

String

User Defined Field of type String

Tip

Available from CRM.COM R14.3.0


udf_float_1

(optional)

Float

User Defined Field of type Float

Tip

Available from CRM.COM R14.3.0


udf_float_2

(optional)

Float

User Defined Field of type Float

Tip

Available from CRM.COM R14.3.0


udf_float_3

(optional)

Float

User Defined Field of type Float

Tip

Available from CRM.COM R14.3.0


udf_float_4

(optional)

Float

User Defined Field of type Float

Tip

Available from CRM.COM R14.3.0


udf_date_1 

(optional)

Date

User Defined Field of type Date

Tip

Available from CRM.COM R14.3.0


udf_date_2 

(optional)

Date

User Defined Field of type Date

Tip

Available from CRM.COM R14.3.0


udf_date_3

(optional)

Date

User Defined Field of type Date

Tip

Available from CRM.COM R14.3.0


udf_date_4

(optional)

Date

User Defined Field of type Date

Tip

Available from CRM.COM R14.3.0


fields_set

(optional)

 List of Strings, comma separated A list of fields that should be included in the results. If not specified then all the available fields will be returned


Tip

Available from CRM.COM R10.0.0


Referred Parameters Objects Data

...

Expand
titleExample 1

HTTP Method: POST


Request:

 {{server}}/crmapi/rest/v2/subscriptions/calculate_rates

Body:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
"token":"{{token}}",
"number_of_additional_periods":3,
"mode":"RATE_BECOME_SUBSCRIBER",
    "accounts_receivable":{"classification_identifier":{"name":"VIP Customer"}},
    "subscription":{
                      "type_identifier":{
                               "name":"Normal"
                               },
                     "billing_terms":{
                        "billing_term_scheme_identifier":{
                            "code":"MPBTS"
                        },
                        "price_plan_identifier":{
                            "code":"BPP0614"
                        },
                        "agreement_date":"2016-05-22T15:00:00",
                         "concurrent_usage_based_pricing":
                          {
                                "concurrent_usage":1,
                                "rate_percentage":100
                          }
                    },
                        "services_set":
                        [
                            {
                                "service_identifier":{
                                    "code":"Bronze"
                                }
                            },
                            {
                                "service_identifier":{
                                    "code":"Gold Extra"
                                }
                            }
                        ]
                    },
    "buy_in_advance_request":{
                        "duration":2,
                        "unit_of_time": "MONTHS",
                        "billing_effective_date": "2016-05-15T00:00:00"
                      }
}

Response:

Code Block
languagejavascript
themeConfluence
linenumberstrue
 {
  "status": {
    "message": "",
    "description": "",
    "code": "OK"
  },
  "data": {
    "upcoming_rates": {
      "total_amount": 27,
      "as_of_date": "Mon May 23 16:18:19 EEST 2016",
      "amount_to_be_paid": 27,
      "total_discount_amount": 0,
      "service_rates_set": [
        {
          "to_date": "Fri Jul 22 00:00:00 EEST 2016",
          "from_date": "Sun May 22 00:00:00 EEST 2016",
          "total_amount": 9,
          "service": {
            "product_type": {
              "service_type": "TERMED",
              "physical_good_type": null,
              "used_for_provisioning": true,
              "classification": "SERVICES",
              "composition_method": "FLAT",
              "id": "BC954969D3172372D498D3BB2BA590A0",
              "name": "Subscription Packages",
              "description": "Subscription main packages",
              "alternative_code": "SP"
            },
            "id": "A15149563AC0E7D3613F3C1B6E2EE4F5",
            "description": "Bronze\r\n",
            "code": "Bronze",
            "alternative_code": "S"
          },
          "total_discount_amount": 1
        },
        {
          "to_date": "Fri Jul 22 00:00:00 EEST 2016",
          "from_date": "Sun May 22 00:00:00 EEST 2016",
          "total_amount": 18,
          "service": {
            "product_type": {
              "service_type": "TERMED",
              "physical_good_type": null,
              "used_for_provisioning": true,
              "classification": "SERVICES",
              "composition_method": "FLAT",
              "id": "BC954969D3172372D498D3BB2BA590A0",
              "name": "Subscription Packages",
              "description": "Subscription main packages",
              "alternative_code": "SP"
            },
            "id": "A7FA7B53161B4D82A118E7734E576CDA",
            "description": null,
            "code": "Gold Extra",
            "alternative_code": "GE"
          },
          "total_discount_amount": 2
        }
      ]
    },
    "additional_period_rates_set": [
      {
        "total_amount": 0,
        "period_number": 1,
        "as_of_date": "Thu Jun 23 16:18:19 EEST 2016",
        "total_discount_amount": 0,
        "service_rates_set": null
      },
      {
        "total_amount": 0,
        "period_number": 2,
        "as_of_date": "Fri Jun 24 16:18:19 EEST 2016",
        "total_discount_amount": 0,
        "service_rates_set": null
      },
      {
        "total_amount": 0,
        "period_number": 3,
        "as_of_date": "Sat Jun 25 16:18:19 EEST 2016",
        "total_discount_amount": 0,
        "service_rates_set": null
      }
    ]
  }
}


...

Expand
titleExample 2

HTTP Method: POST


Request:

 {{server}}/crmapi/rest/v2/subscriptions/calculate_rates


Body:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
    "token":"{{token}}",
    "mode":"RATE_ACTIVATE_SUBSCRIPTIONS",
    "subscription_identifier":{"number":"S0000008563"}
}

Response:

Code Block
languagejavascript
themeConfluence
linenumberstrue
{
  "data": {
    "upcoming_rates": {
      "total_amount_of_parent": 550,
      "total_vat_amount_of_member": 4.22,
      "total_vat_amount_of_parent": 102.07,
      "as_of_date": "2017-05-01T12:02:18",
      "total_discount_amount_of_member": 0,
      "total_tax_amount_of_parent": 51.53,
      "total_amount_of_member": 21.08,
      "total_tax_amount_of_member": 0.49,
      "currency": {
        "suffix_symbol": null,
        "prefix_symbol": "€",
        "decimal_part_name": null,
        "code": "EUR",
        "integer_part_name": null,
        "id": "2"
      },
      "service_rates_set": [
        {
          "from_date": "2017-04-06T00:00:00",
          "to_date": "2017-06-01T00:00:00",
          "total_amount": 550,
          "service": {
            "code": "Gold",
            "product_type": {
              "service_type": "TERMED",
              "used_for_provisioning": true,
              "alternative_code": "Main Packages",
              "composition_method": "FLAT",
              "name": "Main Packages",
              "description": null,
              "id": "E186E293AAAB49EE86A729540A4287FE",
              "classification": "SERVICES",
              "physical_good_type": null
            },
            "alternative_code": "G",
            "description": "Gold",
            "id": "D1EB074DFD904E54A0C67CAB9DC7E010"
          },
          "total_discount_amount": 0
        },
        {
          "from_date": "2017-04-06T00:00:00",
          "to_date": "2017-06-01T00:00:00",
          "total_amount": 21.08,
          "service": {
            "code": "Movies 1",
            "product_type": {
              "service_type": "TERMED",
              "used_for_provisioning": true,
              "alternative_code": "AS",
              "composition_method": "FLAT",
              "name": "Additional Services",
              "description": null,
              "id": "C8321F0BCA8A4051857BC35CEEE41555",
              "classification": "SERVICES",
              "physical_good_type": null
            },
            "alternative_code": "M1",
            "description": "Movies 1",
            "id": "571C10876AF840088372A94A14D0A02C"
          },
          "total_discount_amount": 0
        }
      ],
      "amount_to_be_paid_of_member": 21.08,
      "total_discount_amount_of_parent": 0
    }
  },
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}


...