POST
/
v1
/
c
/
contract
/
{contract_id}
/
upgrade_estimate
curl --request POST \
  --url http://127.0.0.1:8080/v1/c/contract/{contract_id}/upgrade_estimate \
  --header 'Content-Type: application/json' \
  --header 'wb-key: <api-key>' \
  --data '{
  "downgrade_allowed": true,
  "upgrade_configuration": {
    "activation": {
      "type": "next_cycle"
    },
    "currency": "usd",
    "cycle": "once",
    "discount_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
    "plan_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
    "pricing_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
    "unit_configuration": {},
    "unit_count_configuration": {},
    "upgrade_strategy": "new_plan"
  }
}'
{
  "is_downgrade": true,
  "new_contract_period": {
    "end": "2023-11-07T05:31:56Z",
    "start": "2023-11-07T05:31:56Z"
  },
  "price_on_new_contract": [
    {
      "invoice": {
        "currency": "usd",
        "customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
        "date": "2023-11-07T05:31:56Z",
        "deposit_transaction_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
        "deposit_transaction_status": "not_processed",
        "due_date": "2023-11-07T05:31:56Z",
        "external_reference": "<string>",
        "id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
        "invoice_number": {
          "number": "<string>"
        },
        "status": "pending_validation",
        "total": "<string>"
      },
      "invoice_items": [
        {
          "charge_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
          "currency": "usd",
          "description": "<string>",
          "discount_amount": "<string>",
          "discount_description": "<string>",
          "due_date": "2023-11-07T05:31:56Z",
          "id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
          "invoice_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
          "name": "<string>",
          "scheduling_policy": "immediate",
          "status": "pending_validation",
          "subtotal": "<string>",
          "tax_amount": "<string>",
          "tax_code": "<string>",
          "tax_policy": "tax_included",
          "total_excluding_tax": "<string>",
          "total_including_tax": "<string>",
          "unit_count": "<string>",
          "unit_price": "<string>",
          "withdrawal_transaction_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670"
        }
      ]
    }
  ],
  "pro_rate_new_contract": "<string>",
  "pro_rate_old_contract": "<string>",
  "remains_to_pay_current_contract": [
    {
      "invoice": {
        "currency": "usd",
        "customer_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
        "date": "2023-11-07T05:31:56Z",
        "deposit_transaction_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
        "deposit_transaction_status": "not_processed",
        "due_date": "2023-11-07T05:31:56Z",
        "external_reference": "<string>",
        "id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
        "invoice_number": {
          "number": "<string>"
        },
        "status": "pending_validation",
        "total": "<string>"
      },
      "invoice_items": [
        {
          "charge_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
          "currency": "usd",
          "description": "<string>",
          "discount_amount": "<string>",
          "discount_description": "<string>",
          "due_date": "2023-11-07T05:31:56Z",
          "id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
          "invoice_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670",
          "name": "<string>",
          "scheduling_policy": "immediate",
          "status": "pending_validation",
          "subtotal": "<string>",
          "tax_amount": "<string>",
          "tax_code": "<string>",
          "tax_policy": "tax_included",
          "total_excluding_tax": "<string>",
          "total_including_tax": "<string>",
          "unit_count": "<string>",
          "unit_price": "<string>",
          "withdrawal_transaction_id": "Cust_c40bea18-c0c9-44b1-bd0c-43f5283e1670"
        }
      ]
    }
  ],
  "upgrade_cost_breakdown": {
    "new_contract": {
      "cost_pro_rated": "<string>",
      "cycle": "once",
      "full_cost": "<string>",
      "pro_rate": "<string>",
      "time_on_contract": {
        "period": {
          "end": "2023-11-07T05:31:56Z",
          "start": "2023-11-07T05:31:56Z"
        },
        "time_used": {
          "unit": "hour",
          "unit_count": 123
        }
      },
      "usage": "<string>"
    },
    "new_contract_cost_pro_rated": "<string>",
    "old_contract": {
      "cost_pro_rated": "<string>",
      "cycle": "once",
      "full_cost": "<string>",
      "pro_rate": "<string>",
      "time_on_contract": {
        "period": {
          "end": "2023-11-07T05:31:56Z",
          "start": "2023-11-07T05:31:56Z"
        },
        "time_used": {
          "unit": "hour",
          "unit_count": 123
        }
      },
      "usage": "<string>"
    },
    "pro_rate_new_contract": "<string>",
    "pro_rate_old_contract": "<string>",
    "time_on_new_contract": {
      "unit": "hour",
      "value": 123
    },
    "time_on_old_contract": {
      "unit": "hour",
      "value": 123
    },
    "total": "<string>",
    "usage_old_contract": "<string>"
  },
  "usage_old_contract": "<string>"
}

Authorizations

wb-key
string
header
required

Path Parameters

contract_id
string
required

Id of the Contract

Body

application/json

Upgrade configuration used when WbCustomer is performing a Contract Upgrade for a Customer

Response

200 - application/json

Upgraded

Estimate of the price of the Contract Upgrade When contract upgrade is performed mid-cycle, but the billing period is kept the same, the unused part of the current contract billing period, as well as the unused part of the new contract's billing period will be accordingly pro-rated For example, if the contract is paid on the 1st of every month and the upgrade is performed on 16th, we pro-rate as follows:

  • days 115 of the old contract are considered "used", remainder is "unused" thus, days 16end-of-month will be pro-rated
  • for the new contract, days 1~15 will be unused and pro-rated