Skip to main content

StateSet Wholesale Order Management: Your Comprehensive Guide

This guide provides everything you need to start using StateSet’s powerful Wholesale Order Management API. Learn how to streamline your B2B order processing, from capturing email orders to integrating with SYSPRO ERP.

Table of Contents

  1. Introduction
  2. Why Use StateSet for Wholesale Order Management?
  3. Understanding the Challenges
  4. StateSet’s Solution
  5. Quickstart: Getting Started
  6. Core API Components
  7. Integrating with SYSPRO ERP
  8. Order Processing Workflow
  9. Error Handling and Notifications
  10. Support

1. Introduction

StateSet’s Wholesale Order Management API is a robust solution designed for businesses managing large-volume B2B orders. Our API automates critical processes, from extracting order data from emails to seamlessly integrating with ERP systems like SYSPRO. This guide will walk you through the key features and how to implement them.

2. Why Use StateSet for Wholesale Order Management?

StateSet provides a purpose-built solution to simplify and automate the complexities of wholesale ordering. By leveraging our platform, you can:
  • Save Time: Automate tasks previously done manually.
  • Reduce Errors: Eliminate manual data entry, reducing errors and improving data accuracy.
  • Streamline Operations: Improve order flow from capture to fulfillment.
  • Improve Efficiency: Manage wholesale orders efficiently and at scale.
  • Integrate Seamlessly: Connect with critical ERP systems like SYSPRO.

3. Understanding the Challenges

Wholesale order management presents unique challenges compared to B2C sales. Some key hurdles include:
  • Complex Pricing: Handling tiered pricing, bulk discounts, and customer-specific rates.
  • Large Order Volumes: Managing orders with many line items and high quantities.
  • Custom Terms: Accommodating varying customer payment, shipping, and other terms.
  • ERP Integration: Ensuring smooth data exchange with your core ERP system.
  • Inventory Management: Synchronizing inventory levels across wholesale and retail channels.
  • Approval Workflows: Supporting multi-stage approvals before fulfilling orders.

4. StateSet’s Solution

StateSet’s Wholesale Order Management API addresses these challenges with powerful features:
  • Automated Email Order Capture: Extracts order details from emails in various formats.
  • Flexible Pricing: Handles complex pricing models including tiered and customer-specific rates.
  • Bulk Order Processing: Efficiently processes orders with large numbers of items.
  • Customizable Workflows: Allows custom approval processes and business rules.
  • ERP Integration: Creates standardized XML output for easy integration with SYSPRO and similar systems.
  • Inventory Synchronization: Offers real-time inventory updates across all channels.

5. Quickstart: Getting Started

Ready to begin? Follow these steps to set up and configure your StateSet integration.
1

Sign Up

Create your company’s StateSet instance by signing up at StateSet.com/sign-up.
2

Generate API key

Create a new API key in the StateSet Cloud Console at cloud.StateSet.com/api-keys.
3

Set Up Your Environment

Ensure you have Node.js installed. Install the required npm package:
4

Clone Sample Project

Clone our sample project from GitHub. (Note: Replace with the correct repository link). This provides a working example to get you started quickly.
5

Configure Environment Variables

Create a .env file in the project’s root directory and add your API keys and configurations:

6. Core API Components

Here’s an overview of the core API components you’ll use.

6.1 GraphQL API

StateSet utilizes a GraphQL API for interacting with wholesale orders and line items. Here are examples of the queries and mutations you will use:

6.1.1 Fetching a Wholesale Order

Use the GET_MY_WHOLESALE_ORDER query to retrieve a wholesale order and its associated line items:

6.1.2 Updating a Wholesale Order

After processing, update the wholesale order’s status using the UPDATE_WHOLESALE_ORDER mutation:

6.2 SYSPRO API Helper

The following helper function is used to interact with the SYSPRO API:

7. Integrating with SYSPRO ERP

StateSet’s integration with SYSPRO allows for automated order processing and inventory management.

7.1 Logging into SYSPRO

Start by obtaining a session ID by logging into SYSPRO:

7.2 Checking Customer Status

Check if a customer is on hold within SYSPRO before placing an order:

7.3 Checking Inventory Status

Check if inventory items are on hold before fulfilling an order:

7.4 Sending Orders to SYSPRO

Send the transformed XML order data to SYSPRO to create a sales order:

8. Order Processing Workflow

This section details the flow of order processing within the StateSet system.

8.1 Fetching and Initial Processing

First, retrieve the wholesale order and validate its contents:

8.2 Splitting and Transforming Orders to XML

The following functions allow you to prepare your order data for SYSPRO. First the items are split into produce and non-produce, and then transformed into the correct XML format

8.3 Updating Order Status

Finally, update the order status in StateSet after the order has been processed in SYSPRO:

9. Error Handling and Notifications

9.1 Error Handling

StateSet incorporates robust error handling to manage potential issues:
  • Detailed Logging: Errors are logged with comprehensive information for debugging.
  • Exception Management: try-catch blocks are used throughout the code.

9.2 Email Notifications

Email notifications can be sent using SendGrid, providing updates on the status of orders and any encountered issues:
Prepare the email content with attachments of the generated XMLs and SYSPRO responses, including any held items or warnings.

10. Support

Need further assistance? Contact StateSet support at support@StateSet.com for any questions or implementation help.