---
title: "ERP integration playbook to sync appeasement refunds"
slug: "erp-integration-playbook-to-sync-appeasement-refunds"
tags: ["integration", "platform", "event stream ", "refund", "events", "api", "ERP integration"]
updated: 2024-12-17T18:53:13Z
published: 2024-12-17T18:53:13Z
canonical: "docs.newstore.com/erp-integration-playbook-to-sync-appeasement-refunds"
---

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

# ERP integration playbook to sync appeasement refunds

NewStore allows you to create financial transactions in an ERP system and sync them with the NewStore platform for all `appeasements`.

This integration playbook helps you integrate an ERP system used in your business with the NewStore platform, to sync all appeasement refunds. The integration is achieved via the [Event Stream](/v1/docs/receiving-real-time-data#event-stream).

To understand how appeasement refunds work at NewStore, see [Refunding orders or items in an order](/v1/docs/modifying-orders-for-customers#refunding-orders-or-items-in-an-order).

> [!NOTE]
> Important
> 
> For countries where fiscal regulations apply, NewStore does not support appeasement refunds for in-store orders.

## Process overview

The following sequence diagram represents a typical integration of appeasements in the NewStore platform with an ERP:

In this playbook:

1. NewStore sends the `refund_request.issued` event when the refund has been completed.
2. The integration fetches all necessary details via [GraphQL API](/v1/docs/graphql-api#graphql).
3. The integration creates the appeasement refund transaction (in the form of a gift card or cash) in the ERP by calling the ERP's API.

## Exceptions

### ERP unavailable

The integration returns a 500 error, and the [Event stream](https://docs.newstore.net/api/webhooks/stream_webhook_sink_hook) 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](/v1/docs/graphql-api#graphql) query to retrieve all the information required to create an appeasement refund transaction, in the form of a gift card or cash, in the ERP.

```plaintext
query MyQuery {
  order(id: "012345Ab-CdEf-GhIj-KlMn-OpQrStUvWxYz", tenant: "dodici") {
    externalId
    placedAt
    demandLocationId
    currency
    channel
    channelType
    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 appeasements, see this [example](/v1/docs/erp-integration-example-with-netsuite-for-appeasement-refunds#erp-appeasement-example).

**Related topics**

- [ERP integration playbook to sync in-store purchases](/v1/docs/erp-integration-playbook-to-sync-in-store-purchases#integ-erp-playbook-instore)
- [ERP integration playbook to sync endless-aisle orders](/v1/docs/erp-integration-playbook-to-sync-endless-aisle-orders#integ-erp-playbook-endless-aisle)
- [ERP integration playbook for synchronizing cancellations](/v1/docs/erp-integration-playbook-for-synchronizing-cancellations#integ-erp-playbook-cancellation)
- [ERP integration playbook to sync returns](/v1/docs/erp-integration-playbook-to-sync-returns#integ-erp-playbook-returns)
- [ERP integration example with NetSuite for appeasement refunds](/v1/docs/erp-integration-example-with-netsuite-for-appeasement-refunds#erp-appeasement-example)
- [Integrating a payment service provider](/v1/docs/integrating-a-payment-service-provider#integ-psp)
- [GraphQL API](/v1/docs/graphql-api#graphql)
