erp

Selldone ERP — connect your ERP software to Selldone shops

License Docs Selldone

A guide and live demos for connecting ERP software to Selldone shops: fetch orders, update fulfillment and set tracking.
Documentation · Quick start · Ecosystem · Selldone.com · Report an issue

Storefront · Page Builder · Components · Storefront SDK · Backoffice SDK · Vendor SDK · Community SDK · Core · CLI · Translate

Overview

This repository shows how to integrate ERP software with shops on Selldone® Business OS, so the ERP can manage orders efficiently: read paid physical orders, move them through the fulfillment steps and attach shipment tracking details.

ERP software often runs on local machines, so it cannot rely on server-side code or a hosted OAuth callback. Instead, the shop owner creates a personal token for each shop with a single link. The ERP then calls the Selldone REST API directly with that token. Tokens are scoped, and the owner can view and revoke them at any time.

The repository contains this guide, a detailed order data reference and three small HTML demo pages that run in the browser and call the real API. Use it if you build or maintain an ERP, accounting, warehouse or fulfillment integration for Selldone merchants.

Watch on YouTube

Key features

Screenshots

Select a shop Copy the token
Select Shop Token Page

Order Status Workflow

Quick start

1. Create a token. While logged in to Selldone, open:

https://selldone.com/auth/erp?scopes[]=selldone:identification&scopes[]=backoffice:shop:read&scopes[]=backoffice:order:read&scopes[]=backoffice:order:write&scopes[]=backoffice:product:read&scopes[]=backoffice:category:read

Select your shop, then copy the token and note the shop ID.

2. Fetch the latest paid physical orders.

curl -g "https://api.selldone.com/shops/{shop-id-here}/process-center/baskets-PHYSICAL?offset=0&limit=10&sortDesc=true&statuses[]=Payed&with[]=items&with[]=buyer&with[]=products" \
     -H "Authorization: Bearer <token>" \
     -H "Accept: application/json"

(-g stops curl from treating the [] in the query string as a pattern.)

3. Or try it in the browser with the Fetch Orders Demo: enter the shop ID and token and click Fetch Orders.

Usage

Token generation

Step 1: Select shop

Important: The user must be logged in to Selldone.

Create a link with the following format:

https://selldone.com/auth/erp?scopes[]=selldone:identification&scopes[]=backoffice:shop:read&scopes[]=backoffice:order:read&scopes[]=backoffice:order:write&scopes[]=backoffice:product:read&scopes[]=backoffice:category:read

Localized URLs are supported:

https://zh.selldone.com/auth/erp?scopes[]=backoffice:order:read&scopes[]=backoffice:order:write

When the user accesses this link, they can select their shop from the page:

Select Shop

Step 2: Token generation

After selecting the shop, the user will be redirected to a page displaying the token:

Token Page

Managing tokens

You can view and revoke created tokens by visiting https://selldone.com/developer/access.

API: Get orders

To fetch orders from a Selldone shop, send a GET request to the following endpoint:

https://api.selldone.com/shops/{shop-id-here}/process-center/baskets-PHYSICAL?offset=0&limit=10&sortDesc=true&statuses[]=Payed&with[]=items&with[]=buyer&with[]=products

Replace {shop-id-here} with the actual shop ID. Send the token as Authorization: Bearer <token>.

This endpoint returns a list of PHYSICAL orders with full details. The maximum limit is 250.

Order types

For ERP systems, you typically need to work with physical (goods) orders. Selldone supports various order types, including:

Type Notes
PHYSICAL ERPs work only with this type.
FILE  
SERVICE  
VIRTUAL  
SUBSCRIPTION  

Response structure

The response contains two main fields:

By default, the endpoint returns the most recent orders first. You can sort the results by adding sortBy=reserved_at and sortDesc=false to the query string.

Query parameters

The endpoint accepts the following query parameters:

Synchronizing orders

To synchronize orders without fetching all orders every time, use the updated_at query parameter. Send the last sync date as a timestamp (integer), and the endpoint will return orders updated after this date.

Order structure

Below is an overview of the important parameters returned in the order data, which are critical for ERP software integration:

Parameter Description
Order ID (id) Unique identifier for the order, used for tracking and managing orders.
Customer ID (customer_id) Unique identifier for the customer placing the order.
Order Type (type) Type of order (e.g., PHYSICAL, SERVICE), determining the fulfillment process.
Order Status (status) Current status of the order. Possible values: Open, Reserved, Payed, Canceled, COD. Since we are fetching Payed orders, this value will be Payed.
Order Price (price) Total price of the order.
Currency (currency) Currency used in the order.
Delivery Price (delivery_price) Cost of delivering the order to the customer.
Delivery State (delivery_state) Current state of the delivery process. Possible values: CheckQueue, OrderConfirm, PreparingOrder, SentOrder, ToCustomer.
Receiver Information (receiver_info) Information about the recipient for fulfilling the delivery. This includes:
- Name (name): Name of the recipient.
- Phone (phone): Phone number of the recipient.
- Address (address): Full delivery address.
- City, State, Country: Location details for shipment.
- Postal Code (postal): Postal/ZIP code.
- Location (location): GPS coordinates for precise delivery.
Items (items) List of items within the order, essential for inventory and fulfillment. Each item includes:
- Item ID (id): Unique identifier of the item in the order.
- Product ID (product_id): Identifier of the product being ordered.
- Variant ID (variant_id): Identifier of the product variant, if applicable.
- Quantity (count): Number of units ordered.
- Price (price): Price of each item.
- Currency (currency): Currency used for item pricing.
Product Information (product) Details about the product, including:
- SKU (sku): Stock Keeping Unit for inventory tracking.
- MPN (mpn): Manufacturer Part Number for product identification. (If the product has multiple variants, refer to variant.sku and variant.mpn.)
Variant Information (variant) Details about the product variant, if applicable. Includes:
- SKU (sku): Variant-specific SKU.
- MPN (mpn): Variant-specific MPN.
Buyer Information (buyer) Information about the buyer (can be null if it’s a guest shop). Includes:
- Name (name): Name of the buyer.
- Email (email): Email address for communication.
- Phone (phone): Phone number of the buyer.
Checkout Date (reserved_at) Timestamp of when the order was checked out.

More details about the response structure (also in the wiki).

Test it: Fetch Orders Demo.

API: Update order

This section explains how to update order statuses with the Selldone API. It outlines the steps of order fulfillment and how to communicate these updates through API calls.

Updating order status

You can update the status of orders by sending a POST request to the following endpoint:

https://api.selldone.com/shops/{shop-id-here}/process-center/baskets/{order-id-here}/state

Replace {shop-id-here} with your actual shop ID and {order-id-here} with the specific order ID.

Order Status Workflow

Selldone defines 5 steps in the order fulfillment process (CheckQueue, OrderConfirm, PreparingOrder, SentOrder, ToCustomer), which you can manage by updating the delivery_state parameter. Each state should be called sequentially after the previous one.

1. Confirm order (OrderConfirm)

This step indicates that the order has been reviewed and confirmed.

Parameters:

curl -X POST "https://api.selldone.com/shops/12345/process-center/baskets/67890/state" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer abcdef123456" \
     -d '{
           "state": "OrderConfirm",
           "list": [23990, 23991]
         }'

Response 200:

{
  "delivery_state": "OrderConfirm",
  "updated": 2,
  "changed": true,
  "items": [
    {
      "id": 23990,
      "basket_id": 15002,
      "product_id": 2346,
      "variant_id": null,
      ...
    },
    ...
  ]
}
2. Prepare order (PreparingOrder)

At this stage, you set packaging information and indicate that the order is ready to ship (e.g., ready for courier pickup).

Parameters:

curl -X POST "https://api.selldone.com/shops/12345/process-center/baskets/67890/state" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer abcdef123456" \
     -d '{
           "state": "PreparingOrder",
           "list": null,
           "delivery_info": {
             "distance": 11312.99,
             "volume": {
               "width": 0,
               "length": 0,
               "height": 0
             },
             "weight": 0,
             "days": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Saturday"],
             "time_spans": ["Morning", "Evening"],
             "custom": false,
             "type": "Cargo",
             "connect_delivery": 0,
             "inbound_delivery": 2,
             "outbound_delivery": 0,
             "vendor_delivery": 0,
             "date": null
           }
         }'

Response 200:

{
  "delivery_state": "PreparingOrder",
  "changed": true
}
3. Send order (SentOrder)

Use this when the order has been shipped (e.g., handed over to DHL).

Parameters:

curl -X POST "https://api.selldone.com/shops/12345/process-center/baskets/67890/state" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer abcdef123456" \
     -d '{
           "state": "SentOrder",
           "list": null,
           "delivery_info": null
         }'

Response 200:

{
  "delivery_state": "SentOrder",
  "changed": true
}
4. Deliver to customer (ToCustomer)

(Optional) This step indicates that the buyer has received their order.

Parameters:

curl -X POST "https://api.selldone.com/shops/12345/process-center/baskets/67890/state" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer abcdef123456" \
     -d '{
           "state": "ToCustomer",
           "list": null,
           "delivery_info": null
         }'

Response 200:

{
  "delivery_state": "ToCustomer",
  "delivery_at": "2024-10-31T15:32:07.000000Z",
  "changed": true
}

Test it: Update Order Demo.

Shipping failed and order returned

If the shipping fails and the order is returned, send a POST request to the following endpoint:

https://api.selldone.com/shops/{shop-id-here}/process-center/baskets/{order-id-here}/delivery-returned
Important notes

API: Set tracking information

You can set the tracking code and URL for the order by sending a PUT request to:

https://api.selldone.com/shops/{shop-id-here}/process-center/baskets/{order-id-here}/tracking

Parameters:

curl -X PUT "https://api.selldone.com/shops/12345/process-center/baskets/67890/tracking" \
     -H "Content-Type: application/json" \
     -H "Accept: application/json" \
     -H "Authorization: Bearer abcdef123456" \
     -d '{
           "tracking_code": "1Z999AA10123456784",
           "tracking_url": "https://example.com/track/1Z999AA10123456784"
         }'

Test it: Set Order Tracking Demo.

Selldone authentication scopes

Add each scope your integration needs as a scopes[] parameter of the token link.

Show all scopes | Scope | Description | |-------------------------------------|-------------------------------| | `backoffice:order:read` | Read orders | | `backoffice:order:write` | Modify orders | | `backoffice:support-tickets` | Access support tickets | | `backoffice:shop:read` | Read shop details | | `backoffice:shop:write` | Modify shop details | | `backoffice:shop:add` | Add a new shop | | `backoffice:shop:delete` | Delete a shop | | `backoffice:giftcard:write` | Create/edit gift cards | | `backoffice:giftcard:read` | Read gift cards | | `backoffice:faq:write` | Create/edit FAQ entries | | `backoffice:faq:read` | Read FAQ entries | | `backoffice:category:write` | Create/edit categories | | `backoffice:category:read` | Read categories | | `backoffice:product:write` | Create/edit products | | `backoffice:product:read` | Read products | | `backoffice:report:read` | Read reports | | `backoffice:finance:write` | Manage financial records | | `backoffice:finance:read` | Read financial records | | `backoffice:page:write` | Create/edit pages | | `backoffice:page:read` | Read pages | | `backoffice:logistic:write` | Manage logistics | | `backoffice:logistic:read` | Read logistics details | | `backoffice:staff:write` | Manage staff accounts | | `backoffice:staff:read` | Read staff details | | `backoffice:business-profile:write` | Edit business profile | | `backoffice:business-profile:read` | Read business profile | | `backoffice:discount-code:write` | Manage discount codes | | `backoffice:discount-code:read` | Read discount codes | | `backoffice:wallet:write` | Manage user wallets/accounts | | `backoffice:wallet:read` | Read user wallets/accounts | | `backoffice:notifications` | Access notifications | | `backoffice:coupon:write` | Manage coupons | | `backoffice:coupon:read` | Read coupons | | `backoffice:offer:write` | Manage offers | | `backoffice:offer:read` | Read offers | | `backoffice:cashback:write` | Manage cashback programs | | `backoffice:cashback:read` | Read cashback programs | | `backoffice:lottery:write` | Manage lottery programs | | `backoffice:lottery:read` | Read lottery programs | | `backoffice:community:write` | Manage community posts | | `backoffice:community:read` | Read community posts | | `backoffice:customer:write` | Manage customer data | | `backoffice:customer:read` | Read customer data | | `backoffice:ribbon:write` | Manage ribbons | | `backoffice:ribbon:read` | Read ribbons | | `backoffice:ai:write` | Manage AI settings | | `backoffice:ai:read` | Read AI settings | | `backoffice:vendor-payment:write` | Manage vendor payments | | `backoffice:vendor-payment:read` | Read vendor payments | | `backoffice:company:write` | Manage company data | | `backoffice:company:read` | Read company data | | `backoffice:note:write` | Manage notes | | `backoffice:note:read` | Read notes | | `backoffice:affiliate:write` | Manage affiliates | | `backoffice:affiliate:read` | Read affiliates | | `backoffice:print:write` | Manage print-related settings | | `backoffice:print:read` | Read print-related settings | | `backoffice:reviews:write` | Manage reviews | | `backoffice:reviews:read` | Read reviews | | `backoffice:property-set:write` | Manage property sets | | `backoffice:property-set:read` | Read property sets |

Demos

The repository is published with GitHub Pages at selldone.github.io/erp. Each demo is a single HTML file (Bootstrap 5 from a CDN plus helper.js) that calls the API from your browser.

Demo File Calls
Fetch Orders orders-list.html GET .../process-center/baskets-PHYSICAL
Update Order order-update-state.html POST .../process-center/baskets/{order}/state
Set Order Tracking order-set-tracking.html PUT .../process-center/baskets/{order}/tracking

The update and tracking pages read shopId and orderId from the query string, and the orders list links to them for each order. To run them locally, open the HTML files in a browser.

Documentation

Page What you’ll learn
Home What this integration guide covers.
Getting Started Create a token and make your first API call.
Token Generation Build the token link, choose scopes and manage tokens.
Orders API Fetch, filter, paginate and incrementally sync orders.
Order Statuses Move orders through the fulfillment states and handle returns.
Tracking Set a tracking code and tracking URL.
Response Structure Every order, item, product and variant field.
Demos Use and run the HTML demo pages.
FAQ Common questions and troubleshooting.

How it fits in the ecosystem

ERP integrations use the same shop-admin API (api) that powers the Selldone dashboard and the Backoffice SDK. This repository focuses on the order endpoints an ERP needs and on a token flow that works without a server. For bulk data, see the Excel templates for imports and Clone Sheet for copying shop data into your own database.

Selldone open-source ecosystem

Project Why it matters here
Backoffice SDK Admin API client (window.$backoffice) for custom dashboards and integrations.
Clone Sheet Clone shop data (products, customers, orders) into MariaDB/MySQL with the same token flow.
Excel Excel templates for bulk import of products, categories, customers and more.
Core Shared models, types, enums and helpers.
GPT OpenAPI 3.1 schema and guide to build a custom GPT for Selldone.

Contributing

Contributions are welcome. Please read the organization contributing guide and code of conduct. The demos are plain HTML files with no build step: edit them and open them in a browser to test.

Security

Please do not report security vulnerabilities in public issues. Follow the Selldone security policy and email security@selldone.com. Treat ERP tokens like passwords: store them securely and revoke unused tokens at selldone.com/developer/access.

License

This repository is licensed under the GNU General Public License v3.0. See the LICENSE file for the full text.


Part of the Selldone® Business OS open-source ecosystem · selldone.com