Create an Order

Create an order to purchase specific plan or service.

Request URL

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

Request parameters

Headers
Parameter Required Description
Content-Type Yes Specify the type of data that is sent in the body of the POST request.

Valid value: application/json.

User-Agent Yes Provide information about the user agent, such as the type of web browser, operating system, software version, etc., so as to help Yeastar Partner Portal to identify the user or the application that is making the request.

Example: User-Agent: OpenAPI.

Authorization Yes Pass the access token in the header, so as to authenticate the API request.

Format: Bearer {access_token}.

Body parameters
Parameter Required Type Description
operationType Yes String Operation type.

Valid value:

  • trial_plan
  • trial_service
  • purchase_plan
  • purchase_service
  • switch_plan
  • switchTrial_plan
  • renew_plan
  • renew_service
productNo No String The unique product identifier.

Valid value: The Serial Number (SN) of the PBX.

Note:
  • This parameter is required when creating an order for an existing PBX.
  • You can query this information using the Query Product List interface or obtain it from PBX web portal.
productId Yes Integer The unique ID of the product.
Note: You can query product ID using the Query Available Subscription Products interface.
assignId No String The unique ID of the subordinate user to whom the product will be assigned.
Note: You can query the user ID using the Query Subordinate User List interface.
billingId Yes Long The unique ID of the billing contact.
Note: You can query the billing contact ID using the Query Billing Contact List interface.
poNumber No String The purchase order number.
serviceList Yes Array<Service_List> The detailed information of the desired plan or service.
orderPceSpecialRequest No Object<PCEorder_Request> The detailed information of the P-Series Cloud Edition.
Note: This parameter is required only when purchasing a P-Series Cloud Edition.

Service_List

Parameter Required Type Description
serviceId Yes String The unique ID of the plan or service.
Note: You can query the ID using the Query Available Subscription / Trial Plans and Services for a Product interface.
connectionPlanId No String The unique ID of the plan on which the service is dependent.
Note:
serviceType Yes String Service type.
  • plan
  • service
quantity No Integer The desired quantity of the items in the plan or service.
purchaseType Yes String Purchase type.

Valid value:

  • trial
  • switch
  • purchase
  • renew
  • switchTrial
  • purchaseTrial: Activate a plan trial for an existing PBX that has already been subscribed to a plan.
billingModel Yes String Billing model.
Valid value:
  • once: One-off billing.
  • recurring: recurring billing.
billingCycle Yes String Billing cycle.

Valid value:

  • once
  • annually
  • monthly
multiCycle Yes Integer The interval of recurring billing.
Valid value:
  • For one-off purchase, the valid value is 0.
  • For annual subscription, the valid value is 1, 2, 3, 4, and 5.
  • For monthly subscription, the valid value is 1.

PCEorder_Request

Parameter Required Type Description
pbxName Yes String The PBX name that helps you to identify the P-Series Cloud PBX on Yeastar Central Management.
regionId Yes Integer The unique ID of the region where the P-Series Cloud PBX will be created.
Note: You can query the region ID using the Query Region List interface.
pbxSubDomainId Yes Integer The unique ID of the available domain suffix.
Note: You can query the ID using the Query Region List interface.
pbxUrl Yes String The complete PBX URL.
Example: apitest.test3.yeastarcloud.com
Note: Only numbers, letters, and special characters - are allowed.

Response parameters

Parameter Type Description
code String The response message of the API request.
detailMessage String The detailed error information.

When the request is successful, this parameter returns empty.

requestId String The unique ID of the request, which can be used to quickly locate the request.
result Object<Order_Info> The detailed information.
status Integer The HTTP status code of the API request.
Order_Info
Parameter Type Description
instanceId String The unique ID of the PBX device.
orderId String The unique ID of the order.
orderNo String Order number.
orderStatus String Order status.
  • confirmed
  • unconfirmed
  • succeed
  • pending
productNo String The unique product identifier.

This parameter returns the Serial Number (SN) of the PBX.

transactionNo String Transaction number.

Example

Request example

Purchase a P-Series Cloud Edition with the following information, and assign the product to a subordinate user (ID: 3106224347292123136).
  • Plan: Enterprise Plan
  • Extension Capacity: 20
  • Subscription Term: Annually
  • PBX URL: apitestcloud.ptest3.yeastarcloud.com
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": "purchase_plan",
    "productId": 13,
    "assignId": "3106224347292123136 ", 
    "billingId": 36834,
    "poNumber": "20250818",
    "serviceList": [
        {
            "serviceId": 3048571730026938368,
            "serviceType": "plan",
            "quantity": 20,
            "purchaseType": "purchase",
            "billingModel": "recurring",
            "billingCycle": "annually",
            "multiCycle": 0
        }
    ],
    "orderPceSpecialRequest": {
        "pbxName": "API Test",
        "regionId": 4,
        "pbxSubDomainId": 5,
        "pbxUrl": "apitestcloud.ptest3.yeastarcloud.com"
    }
}

Response example

{
    "code": "success",
    "detailMessage": "",
    "requestId": "f83bd28385a1f74f648d442762dc0978",
    "result": {
        "instanceId": "1268649",
        "orderId": "1002069",
        "orderNo": "WM3200516114713260032",
        "orderStatus": "succeed",
        "productNo": "3658B4311196ST92",
        "transactionNo": "FO3200516115468234753"
    },
    "status": 200
}