Skip to main content

ERP integration playbook to sync returns

NewStore allows you to create financial transactions in an ERP system and sync them with NewStore Omnichannel Cloud for all returns.

This integration playbook helps you integrate an ERP system used in your business with the NewStore platform, to sync all returns made by customers. The integration is achieved via the Event Stream .

For each return order placed in NewStore Omnichannel Cloud, a cash refund transaction is created in the ERP, which includes:

  • Returned items
  • Refund details

Process overview

The following sequence diagram represents a typical integration of returns made in NewStore Omnichannel Cloud with an ERP:

The following sequence diagram represents a typical integration of returns in NewStore Omnichannel Cloud with an ERP:

sequenceDiagram participant E as Event Stream participant G as GraphQL API participant I as Integration participant N as ERP activate E E->>+I: return.processed I->>+G: GET order, items, and payment details G->>-I: Send details I->>+N: GET original cash sales or sales orders N->>-I: Send details I->>+N: Create cash refund transaction N->>-I: Send confirmation I->>-E: Send confirmation to Event Stream deactivate E

In this playbook:

  1. NewStore sends the return.processed event when the return has been completed.
  2. The integration fetches all necessary details via GraphQL API .
  3. The integration creates the cash refund 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 cash refund 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 returns, see this example .

Related topics