Order Rules (Admin)

Product order rules can be used to allow and block a user to purchase some products depending on some situations:

  • Time: You can define some order rule to allow user of purchasing only in some specific time range

  • Purchase Limit: You can define how much tokens the user can purchase

The permission to purchase is defined by some whitelist which can be created inside the ID service. That whitelists can be linked into each order rule and defines if some user can or not purchase some product.

Whitelists can specify users by email, wallet address or users who owns some token.

One product can have more than one order rules, which means that you can create some complex blocking logics for your products: Example: During the first week only priority users can purchase and after that, it's opened to the public.

Order Rule Model (Example)
{
    "id": "6368dfb5-f48c-48b1-be13-dd413548a558",
    "createdAt": "2022-10-17T21:47:12.505Z",
    "updatedAt": "2022-10-17T22:04:00.373Z",
    "companyId": "010e92ea-d3af-40d9-a19e-a263fdfe6e92",
    "productId": "010e92ea-d3af-40d9-a19e-a263fdfe6e12",
    "whitelistId": "010e92ea-d3af-40d9-a19e-a263fdfe6e94",
    "startAt": null,
    "endAt": null,
    "purchaseLimit": null
}

Service Methods

Creates some order rule inside a company product

Rest API reference:

post
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
Body
startAtstring · date-timeOptional
endAtstring · date-timeOptional
purchaseLimitnumberOptional
whitelistIdstring · uuidOptionalDefault: null
Responses
201Success
post
POST /admin/companies/{companyId}/products/{productId}/order-rules HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 103

{
  "startAt": null,
  "endAt": null,
  "purchaseLimit": null,
  "whitelistId": "123e4567-e89b-12d3-a456-426614174000"
}

No content

Lists all orders rules from some company product

Rest API reference:

get
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
Query parameters
pagenumberOptionalDefault: 1
limitnumberOptionalDefault: 10
searchstringOptional
sortBystring · enumOptionalExample: createdAtPossible values:
orderBystring · enumOptionalPossible values:
Responses
200Success
get
GET /admin/companies/{companyId}/products/{productId}/order-rules HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*

No content

Gets one specific product order rule by id

Rest API reference:

get
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
orderRuleIdstringRequired
Responses
200Success
get
GET /admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*

No content

Updates some specific product order rule

Rest API reference:

patch
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
orderRuleIdstringRequired
Body
startAtstring · date-timeOptional
endAtstring · date-timeOptional
purchaseLimitnumberOptional
whitelistIdstring · uuidOptionalDefault: null
Responses
200Success
patch
PATCH /admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 103

{
  "startAt": null,
  "endAt": null,
  "purchaseLimit": null,
  "whitelistId": "123e4567-e89b-12d3-a456-426614174000"
}

No content

Deletes some specific product order rule

Rest API reference:

delete
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
orderRuleIdstringRequired
Responses
200Success
delete
DELETE /admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*

No content

Last updated