> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nymblecommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sales Reps, Ordering, and Commission Plans in Nymble Commerce

> Learn how Nymble Commerce models sales rep accounts, customer assignments, and assisted ordering workflows so reps can place orders on behalf of customers.

Nymble Commerce has first-class support for sales rep workflows. Reps can log in with their own credentials, see exactly the customer accounts assigned to them, browse the catalog on a customer's behalf, and place orders — all through the same API your storefront uses. This makes it straightforward to build internal ordering tools, trade show apps, and phone-order interfaces.

## Sales rep accounts

A sales rep is a distinct user type within your organization. Reps are created at the organization level and carry their own identity and credentials.

Key fields on a sales rep record:

| Field                    | Type    | Description                                                                                                                    |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `OrganizationSalesRepId` | string  | Nymble Commerce's internal join ID linking this rep to your organization.                                                      |
| `SalesRepId`             | string  | The rep's global identity ID across Nymble Commerce.                                                                           |
| `RepNumber`              | string  | Your external rep identifier. Used as a reference on customer records and orders. Match this to your CRM or commission system. |
| `FirstName`              | string  | Rep's first name.                                                                                                              |
| `LastName`               | string  | Rep's last name.                                                                                                               |
| `Email`                  | string  | Rep's login email.                                                                                                             |
| `PhoneNumber`            | string  | Rep's direct phone number.                                                                                                     |
| `Active`                 | boolean | Whether the rep is active. Inactive reps cannot log in.                                                                        |
| `Roles`                  | array   | The roles assigned to the rep (e.g. `["SalesRep"]`). Used for JWT claim generation.                                            |

When a sales rep authenticates, their JWT includes a `SalesRep` role claim. The API reads this claim to apply rep-specific scoping rules automatically — no extra parameters needed.

### Example: creating a sales rep

```json theme={null}
POST https://api.achievemomentum.com/api/organizations/{organizationId}/salesreps

{
  "FirstName": "Marcus",
  "LastName": "Chen",
  "Email": "marcus.chen@yourcompany.com",
  "PhoneNumber": "+1-555-0188",
  "RepNumber": "REP-007",
  "Roles": ["SalesRep"]
}
```

## Assisted ordering

The most powerful sales rep capability in Nymble Commerce is assisted ordering — a rep placing an order on behalf of one of their assigned customers. You use the same `POST /api/orders` endpoint as a customer self-service order, with two key fields populated:

* **`Customer.CustomerNumber`** — the customer the order is for.
* **`PrimarySalesRep.RepNumber`** — the rep who owns this customer relationship.

Optionally, if a different rep physically enters the order (e.g. a colleague covering a trade show booth), set the `TakenBySalesRep` field as well.

```json theme={null}
POST https://api.achievemomentum.com/api/orders

{
  "Customer": {
    "CustomerNumber": "CUST-0042",
    "CompanyName": "Acme Wholesale Ltd.",
    "CompanyEmail": "orders@acmewholesale.com"
  },
  "OrderType": "Assisted",
  "PONumber": "SHOW-2024-001",
  "PriceTier": "Wholesale",
  "CurrencyCode": "USD",
  "PrimarySalesRep": {
    "RepNumber": "REP-007"
  },
  "TakenBySalesRep": {
    "RepNumber": "REP-012"
  },
  "Items": [
    {
      "Sku": "WDG-100-BLU",
      "Quantity": 48,
      "Price": 18.50
    }
  ],
  "Channel": "TradeShow",
  "Terms": "Net30"
}
```

The order response includes both `PrimarySalesRep` and `TakenBySalesRep` as full objects, so you can display the correct attribution in your reporting and commission workflows.

## Visibility scoping

Nymble Commerce automatically enforces what each user type can see:

| User type                | Customer visibility                                  |
| ------------------------ | ---------------------------------------------------- |
| **Admin**                | All customers in the organization.                   |
| **Sales rep**            | Only the customers assigned to them via `RepNumber`. |
| **Customer portal user** | Only their own account.                              |

When a sales rep calls `GET /api/customers`, the API reads their `RepNumber` from their JWT and filters the response to their assigned accounts. You don't need to implement this filtering yourself — the API enforces it at the data layer.

This scoping applies consistently across all customer-related endpoints: customer list, customer detail, customer orders, and customer invoices.

## Customer lookup

Sales reps can search and filter their customer list using the standard list endpoint. The same query parameters apply:

```bash theme={null}
# List all assigned customers
GET https://api.achievemomentum.com/api/customers

# Search by company name
GET https://api.achievemomentum.com/api/customers?search=acme

# Filter to active customers only, sorted by name
GET https://api.achievemomentum.com/api/customers?active=true&sortOn=Name&sortDirection=asc
```

Results are paginated using `PageNumber` and `PageSize`. The API returns only the rep's assigned customers — no configuration required.

## Commission plans

Nymble Commerce includes a full commission plan API so you can define, activate, and manage how each rep earns on the orders they close. Plans are scoped per rep and per organization, so multi-org reps can have different commission structures in each organization they belong to.

### Commission plan structure

A commission plan is created via `POST /api/commissions/plans` and assigned to a specific `SalesRepId`. Key fields on a plan:

| Field                | Type     | Description                                                                                             |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------- |
| `CommissionPlanId`   | string   | Nymble Commerce's unique identifier for this plan.                                                      |
| `SalesRepId`         | string   | The rep this plan applies to.                                                                           |
| `Name`               | string   | A descriptive name for the plan (e.g. `"Standard Wholesale Rate"`).                                     |
| `Description`        | string   | Optional longer description.                                                                            |
| `DefaultRate`        | decimal  | The baseline commission rate (as a decimal, e.g. `0.05` for 5%). Applied when no specific rule matches. |
| `EffectiveStartDate` | datetime | When this plan becomes active.                                                                          |
| `EffectiveEndDate`   | datetime | When this plan expires (optional).                                                                      |
| `Rules`              | array    | Ordered list of rate rules — see below.                                                                 |
| `CustomerOverrides`  | array    | Per-customer rate overrides that supersede the default rate and rules for specific accounts.            |
| `Active`             | boolean  | Whether this plan is currently earning commission.                                                      |

### Commission rules

Rules let you configure different rates based on SKU patterns, product name patterns, customer numbers, or line item amounts. Each rule has:

| Field                       | Type    | Description                                                                     |
| --------------------------- | ------- | ------------------------------------------------------------------------------- |
| `Priority`                  | integer | Evaluation order. Lower number = higher priority. The first matching rule wins. |
| `Name`                      | string  | Label for this rule (e.g. `"High-margin SKUs"`).                                |
| `Rate`                      | decimal | Commission rate for this rule.                                                  |
| `Match.SkuPatterns`         | array   | List of SKU patterns to match (supports wildcards).                             |
| `Match.ProductNamePatterns` | array   | List of product name patterns to match.                                         |
| `Match.CustomerNumbers`     | array   | Restrict this rule to specific customer accounts.                               |
| `Match.MinLineAmount`       | decimal | Only apply if line subtotal is at or above this threshold.                      |
| `Match.MaxLineAmount`       | decimal | Only apply if line subtotal is at or below this threshold.                      |

### Customer overrides

Use `CustomerOverrides` to give a rep a different default rate or rule set for a specific customer account. Overrides are identified by `CustomerNumber` and can include their own `EffectiveStartDate`, `EffectiveEndDate`, and `Rules` array — structured identically to top-level rules.

### Activating and deactivating plans

Use the dedicated endpoints to control whether a plan is actively earning:

```bash theme={null}
# Activate a plan
POST https://api.achievemomentum.com/api/commissions/plans/{commissionPlanId}/activate

# Deactivate a plan
POST https://api.achievemomentum.com/api/commissions/plans/{commissionPlanId}/deactivate
```

Only one plan per rep can be active at a time. Deactivating a plan stops new commissions from accruing against it but does not affect commission statements already generated.

### Commission statements

Once orders are invoiced and paid, Nymble Commerce can generate a `CommissionStatement` for a rep covering a defined date range. Statements roll up commission entries per invoice, apply the matching plan rate per line, and produce a payable total. Statements move through an approval workflow (`Draft` → `Approved` → paid), and the full event history is preserved on the statement for audit purposes.

<Tip>
  The sales rep workflow is ideal for **trade show ordering** and **phone-based order entry**. Build a lightweight mobile-friendly interface that authenticates with a rep's credentials, pulls up their customer list, and submits orders with `OrderType: "Assisted"` and `Channel: "TradeShow"` or `Channel: "Phone"`. You get full order attribution, commission tracking, and customer history without any custom backend logic.
</Tip>
