Create New Commerce Orders¶
Prerequisites¶
- Credentials as described in Authentication
- For Product information PartNumber, BillingCycle and TermDuration go to Get agreement products.
Create subscription endpoint also works with Nce subscriptions, but users can use this simplified endpoint to purchase a new commerce subscription, which combines the Verify Order and Checkout Order endpoints into a single call.
Request¶
Request Syntax:
Method | Request URI |
---|---|
POST | https://api.crayon.com/api/v1/subscriptions/new-commerce-orders |
Request Body:
{
"customerTenantId": 123,
"billingCycle": 1,
"partNumber": "CFQ7TTC0HD33:0003",
"quantity": 1,
"termDuration": "P1M",
"customTermEndDate": "2022-09-30T23:59:59Z"
}
Properties:
Name | Type | Required | Description |
---|---|---|---|
CustomerTenantId | int | Yes | |
BillingCycle | BillingCycleType | Yes | Billing cycle. Unknown = 0, Monthly = 1, Annual = 2, None = 3, OneTime = 4, Triennial = 5 |
PartNumber | string | Yes | |
Quantity | int | Yes | |
TermDuration | string | Yes | An ISO 8601 representation of the term’s duration. Supported values are: “P1M” for (1 month), “P1Y” for (1 year) and “P3Y” for (3 years). |
CustomTermEndDate | DateTime | No | Applicable for coterminosity scenarios. Supported values are returned by the get coterminosity dates endpoint |
Response¶
If successful, the following json is returned in the response body.
{
"IsSuccessful": true,
"ErrorReasonCode": "Error_Code_String",
"ErrorDescription": "Error description.",
"NewCommerceOrderId": "767bc43f-c3af-48e7-b7fa-89889132a655"
}
Response success and error codes:
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters.
Error Codes | Description |
---|---|
200 Ok | The request has succeeded. |
400 Bad Request | The request could not be understood by the server due to malformed syntax, missing required properties, properties that couldn’t be parsed according to their type (and length). It is a non-retryable error condition. The client should not repeat the request without modifications. |
401 Unauthorized | The request requires user authentication. If the request already included Authorization credentials, then the 401 (Unauthorized) status code means that authorization has been refused for those credentials. It is a non-retryable error condition. |
404 Not Found | The server has not found anything matching the request. |
Get id of newly created subscription¶
A user can use below endpoint to retrieve the subscription id of the newly created subscription.