Tutorial: Renew P-Series Cloud PBX (PCE Instance) Using API

This tutorial introduces the request parameters and provides a request example to show you how to renew P-Series Cloud PBX (PCE Instance) using API.

Before you begin: Understand the request parameters

Before renewing P-Series Cloud PBX (PCE Instance) using API, we recommend that you read the table below to understand the request parameters and collect the corresponding values.
Note: If the desired PBX has been subscribed to both plan and service, you will need to renew both of them at the same time.
Item Parameter Description
Operation Type operationType The operation type.

In this scenario, the value is fixed at renew_plan.

Product ID productId Specify the product that you want to renew.

The Product ID for P-Series Cloud PBX (PCE Instance) is 13.

PBX Serial Number (SN) productNo Specify the device that you want to renew.

You will need to query the PBX SN as described in the following steps.

Billing Contact ID billingId Specify the contact who can receive the invoice after you renew P-Series Cloud PBX (PCE Instance).

You will need to query the Billing Contact ID as described in the following steps.

Plan Type & Service Type serviceType
  • When renewing plan, the value is fixed at plan.
  • When renewing service, the value is fixed at service.
Plan ID & Service ID serviceId Specify the specific plan and service that you want to renew.

You will need to query the IDs as described in the following steps.

Connection Plan ID connectionPlanId Optional. Specify the current subscription plan.
Note: This parameter is required only when you renew both plan and service, and it should be the same as Plan ID.
Quantity quantity Specify the number of extensions that you want to renew.
Important: This value must be exactly the same as the current number of extensions, or the API request would fail.
Purchase Type purchaseType The purchase type.

In this scenario, the value is fixed at renew.

Billing Model billingModel The billing model.

In this scenario, the value is fixed at recurring.

Billing Model billingModel The billing model.

In this scenario, the value is fixed at recurring.

Billing Cycle billingCycle The billing cycle.

In this scenario, the value is fixed at annually or monthly.

Important: For plan renewal, you can NOT change the billing cycle.

For example, if a PBX has been subscribed to plan on a monthly basis and is to renew the plan, the value of Billing Cycle can only be monthly.

Multi Cycle multiCycle The interval of recurring billing.

In this scenario, the value is fixed at 0.

Step 1. Get Serial Number (SN)

  1. Make a request to the Query Product List API endpoint with the Product ID 13.
    GET {base_url}/product/openapi/instance_product/v1/client/instance_product_list?productId=13
  2. Note down the returned value of productNo for the desired P-Series Cloud PBX (PCE Instance).

Step 2. Get plan ID and service ID

  1. Make a request to the Query Available Subscription / Trial Plans and Services for a Product API endpoint with the Product ID 13.
    GET {base_url}/pricing/openapi/purchase/v1/purchase_product_info?productId=13
  2. Note down the returned value of planId and serviceId for the desired plan and service.

Step 3. Get billing contact ID

  1. Make a request to the Query Billing Contact List API endpoint.
    GET {base_url}/user/openapi/user/v1/client/billing_contact_list
  2. Note down the returned value of billingContactId for the desired billing contact.

Step 4. Renew P-Series Cloud PBX (PCE Instance)

Make a request to the Create an Order API endpoint with the collected values.

POST {base_url}/order/openapi/order/v1/save

In this tutorial, the values we collect are shown below:

Item Parameter Value
Operation Type operationType renew_plan
Product ID productId 13
PBX Serial Number (SN) productNo 3658B431119665QJ
Billing Contact ID billingId 3197218168379846218
Plan Type & Plan ID serviceType & serviceId
  • serviceType: plan
  • serviceId: 3048571730026938368 (ID for Enterprise Plan)
Service Type & Service ID serviceType & serviceId
  • serviceType: service
  • serviceId: 3048573935752720384 (ID for High Availability service)
Connection Plan ID connectionPlanId 3048571730026938368
Quantity quantity 100
Purchase Type purchaseType renew
Billing Model billingModel recurring
Billing Cycle billingCycle annually
Multi Cycle multiCycle 0

The sample request to renew P-Series Cloud PBX (PCE Instance) with High Availability service for 1 year is shown below:

POST /order/openapi/order/v1/save HTTP/1.1
Host: openapi.partner.yeastar.com
Content-Type: application/json
User-Agent: OpenAPI
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsicmVzMSJdLCJYLU1TLVVTRVIiOiJ7XCJleHByXCI6XCIwXCIsXCJ0eXBlXCI6XCJwYXJ0bmVyXCIsXCJ1Y0lkXCI6XCIzMDc2OTE1NDU0NDY4NzY3NzQ0XCIsXCJ1c2VyQ29kZVwiOlwiUGFydG5lclwiLFwidXNlcklkXCI6XCIzMDc2OTE1NDU0NDg5NzM5MjY0XCIsXCJ1c2VybmFtZVwiOlwicGFydG5lcmV4YW1wbGVAb3V0bG9vay5jb21cIn0iLCJ1c2VyX25hbWUiOiJwYXJ0bmVyZXhhbXBsZUBvdXRsb29rLmNvbSIsInNjb3BlIjpbImFsbCJdLCJleHAiOjE3Mzk3MTc5MjYsInRva2VuX3R5cGUiOiJvcGVuYXBpIiwianRpIjoidmlzMkh0QkxaUStNQmxPbS9UdThWR1pyNFljPSIsImF1dGhvcml0aWVzIjpbIjc5Il0sImNsaWVudF9pZCI6IjE0NDI5NjM2ODBiMjM0YjA0YmRjZDVjMTZmODcyOWQ2In0.RPRoTJRkXCB4krDSwGRpUFyCfUVv2LHjIiBICA1pCiY

{
  "operationType": "renew_plan",
  "productId": 13,
  "productNo": "3658B431119665QJ",
  "billingId": 3197218168379846218,
  "serviceList": [
    {
      "serviceType": "plan",
      "serviceId": 3048571730026938368,
      "quantity": 100,
      "purchaseType": "renew",
      "billingModel": "recurring",
      "billingCycle": "annually",
      "multiCycle": 0
    },
    {
      "connectionPlanId":3048571730026938368,
      "serviceType": "service",
      "serviceId": 3048573935752720384,
      "purchaseType": "renew",
      "billingCycle": "annually",
      "multiCycle": 0
    }
  ]
}

Result

The sample response is shown below:

{
    "code": "success",
    "detailMessage": "",
    "requestId": "505af21ce5429362eef1f29958dd2bde",
    "result": {
        "instanceId": "1282352",
        "orderNo": "BN3206243356000391168",
        "orderStatus": "succeed",
        "productNo": "3658B431119665QJ",
        "transactionNo": "QO3206243357577449473"
    },
    "status": 200
}