ERP integration playbook to sync endless-aisle orders

Prev Next

NewStore allows you to create financial transactions in an ERP system and sync them with the NewStore platform for all store and e-commerce orders.

This integration playbook helps you integrate an ERP system used in your business with the NewStore platform, to sync all store and e-commerce orders. The integration is achieved via the Event Stream.

For each e-commerce order placed in the NewStore platform, a sales transaction is created in the ERP, which includes:

  • Purchased items with prices and taxes

  • Payment details

  • Invoice details

Process overview

The following sequence diagram represents a typical integration of store and e-commerce orders in the NewStore platform with an ERP:

In this playbook:

  1. NewStore sends the order.opened event when the endless aisle order purchase has been completed.

  2. The integration fetches all necessary details via a GraphQL API. Payments are processed asynchronously, therefore it may take some time until all payment details are available.

  3. The integration creates the sales order transaction in the ERP by calling the ERP's API.

Exceptions

ERP unavailable

The integrations returns a 500 error, and the Event stream retries sending the macro event.

Payment details unavailable

In some cases, it takes more than a few seconds until payment processing at the PSP has been completed and the payment details become available in the platform. The integration moves the event into an internal queue (for example, SQS) for to reprocess later, and returns 200.

Sample GraphQL Query

Here is an example GraphQL query to retrieve all the information required to create a sales order transaction in the ERP.

query MyQuery {
  order(id: "012345Ab-CdEf-GhIj-KlMn-OpQrStUvWxYz", tenant: "dodici") {
    externalId
    placedAt
    demandLocationId
    currency
    isExchange
    isHistorical
    channel
    channelType
    shippingTax
    shippingTotal
    taxExempt
    taxStrategy
    taxTotal
    subtotal
    grandTotal
    discounts {
      edges {
        node {
          couponCode
        }
      }
    }
    paymentAccount {
      instruments {
        edges {
          node {
            paymentMethod
            paymentOrigin
            paymentProvider
            paymentAccountTransactions {
              edges {
                node {
                  amount
                  currency
                  transactionType
                }
              }
            }
          }
        }
      }
    }
    items {
      edges {
        node {
          productId
          quantity
          pricebookPrice
          itemDiscounts
          orderDiscounts
          tax
          shippingServiceLevel
          fulfillmentLocationId
        }
      }
    }
  }
}

ERP integration example with NetSuite

For integrations with NetSuite as an ERP system for endless aisle orders, see this example.

Exchange orders

The integration needs the store credit information to create a balanced transaction in the ERP. Consider adding store credit transactions to external payment events.

To identify an exchange order, see Event Stream documentation.

Related topics