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_plantrial_servicepurchase_planpurchase_serviceswitch_planswitchTrial_planrenew_planrenew_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.
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. confirmedunconfirmedsucceedpending
productNo String The unique product identifier. This parameter returns the Serial Number (SN) of the PBX.
transactionNo String Transaction number.
Example
Request example
- 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
}