W3Block Docs
  • 🚀Start here
    • Welcome to the Docs
    • Integrated Blockchains
  • 👨‍💻Dev Docs
    • API
      • Getting Started
      • Authentication
      • Commerce API services
        • Company Administration
          • Companies (Admin)
          • Assets (Admin)
          • Tags (Admin)
          • Products (Admin)
            • Order Rules (Admin)
          • Orders (Admin)
          • Faq (Admin)
          • Webhooks (Admin)
        • Products
        • Orders
        • Webhooks
        • Faq
        • Globals
      • Key API Services
        • Authentication
        • Companies
        • Tokens
          • Contracts
            • External Contacts
            • Royalty Eligible
          • Categories
            • Subcategories
          • Token Collections
            • Token Editions
          • Metadata
        • Blockchain
        • Cloudinary
        • Integration
          • Ecommerce
            • Associate Tokens
            • Hooks
        • Users
        • Vouchers
  • 📘Knowledge Base
    • First Steps
    • FAQ
    • Glossary
Powered by GitBook
On this page
  1. Dev Docs
  2. API
  3. Commerce API services
  4. Company Administration
  5. Products (Admin)

Order Rules (Admin)

PreviousProducts (Admin)NextOrders (Admin)

Last updated 2 years ago

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:

Lists all orders rules from some company product

Rest API reference:

Gets one specific product order rule by id

Rest API reference:

Updates some specific product order rule

Rest API reference:

Deletes some specific product order rule

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
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
get
GET /admin/companies/{companyId}/products/{productId}/order-rules HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*

No content

get
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
orderRuleIdstringRequired
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
get
GET /admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*

No content

delete
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
orderRuleIdstringRequired
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
delete
DELETE /admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*

No content

  • Service Methods
  • Creates some order rule inside a company product
  • POST/admin/companies/{companyId}/products/{productId}/order-rules
  • Lists all orders rules from some company product
  • GET/admin/companies/{companyId}/products/{productId}/order-rules
  • Gets one specific product order rule by id
  • GET/admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId}
  • Updates some specific product order rule
  • PATCH/admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId}
  • Deletes some specific product order rule
  • DELETE/admin/companies/{companyId}/products/{productId}/order-rules/{orderRuleId}
post
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
Body
startAtstring · date-timeOptional
endAtstring · date-timeOptional
purchaseLimitnumberOptional
whitelistIdstring · uuidOptionalDefault: null
Responses
201Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
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

patch
Authorizations
Path parameters
companyIdstringRequired
productIdstringRequired
orderRuleIdstringRequired
Body
startAtstring · date-timeOptional
endAtstring · date-timeOptional
purchaseLimitnumberOptional
whitelistIdstring · uuidOptionalDefault: null
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
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