Skip to main content

ERP integration example with NetSuite for cancellations

This example uses NetSuite as the ERP system for the retailer to integrate with, to sync cancellations in the NewStore platform. If you integrate with ERP systems other than NetSuite, see the integration playbook or contact the support team.

To successfully create NetSuite orders from NewStore orders, map fields (such as channel identifiers) from NewStore values to NetSuite values. The necessary static maps are described in the following sections.

You can also use the AWS Systems Manager Parameter Store to supply integration lambdas with these maps as an implementation option.

Channel map

Maps from NewStore channel types (web or store) to the corresponding numerical NetSuite identifiers.

Map name in sample implementation: netsuite/newstore_to_netsuite_channel

Location map

Provides the following NetSuite attributes for each NewStore store location:

  • NetSuite store ID
  • NetSuite subsidiary ID for the store
  • A placeholder customer name and email used for in-store purchases for situations where no actual customer information is present.

Map name in sample implementation: netsuite/newstore_to_netsuite_locations

Payment method map

In NetSuite, each payment needs to be represented as an order line item. The payment method map provides a virtual NetSuite product ID for each NewStore payment method. This information enables the integration to create suitable NetSuite payment line items, corresponding to the received NewStore payment information.

Map name in sample implementation: netsuite/newstore_to_netsuite_payment_items

List of gift card product IDs

You need this list to map a gift card payment to the corresponding product ID, when creating a NetSuite payment order line for a gift card payment.

Map name in sample implementation: netsuite/newstore_giftcard_product_ids

Shipping method map

Maps the shipping service levels configured as part of the NewStore fulfillment configuration to corresponding NetSuite shipping method identifiers.

Map name in sample implementation: netsuite/newstore_to_netsuite_shipping_methods

Currency map

While NewStore uses three-letter ISO codes for currencies, NetSuite uses numeric identifiers. The currency map maps between these two representations.

In the sample implementation, the currency_map is part of a collection of multiple configured constants, maintained in the map netsuite/iso_to_netsuite_currencies.

CreditMemo Record Type

For each NewStore order cancellation, create a CreditMemo transaction in the ERP system.

To create the RecordRef type, you only need the ID of the related record type. See the following example to create a RecordRef for the partner attribute with ID 2:

'partner': RecordRef(internalId=2)

The mapping table from NewStore order data, as provided by GraphQL, that syncs with NetSuite CreditMemo attributes:

CreditMemo Record Type attributeTypeCommentNewStore attribute
customFormStringThis is the NetSuite form identifier for the CreditMemo record type, as configured in NetSuite. The only way to create NetSuite transactions from an integration is via a custom form, as entities like CreditMemo cannot be created directly.NA
partnerRecordRefThis is the partner identifier of NewStore, as configured in NetSuite.NA
tranDateDateTime Stringorder.placed_at
shippingCostStringThis attribute represents the shipping cost of the original sales order.order.ShippingCost
createdFromRecordRefThis attribute represents the NetSuite identifier of the invoice of the original sales order.NA
itemListRecordRefThis attribute represents the canceled items in an order.See CreditMemoItemList Record Type .
customFieldListCustomFieldListThis is a list of custom fields that are defined in NetSuite by the retailer. The list of these custom fields and their meaning is available from the responsible Solution Architect.See CreditMemoItemList Record Type .

CreditMemoItemList Record Type

Credit memo item list includes the list of cancelled order items, the list of payment items, the list of taxes, the list of discounts and the list of payment items.

List of items

CreditMemoItem Record Type attributeTypeCommentNewStore attribute
itemRecordRefThis is the NetSuite identifier of the item that in this case is the productId in NewStore data model.order.items[i].productId

price

RecordRef

This is the identifier of the price type which is specified in the AWS Systems Manager Parameter Store.

Note

This is not the price of the item.

NA

amountThis is the price of the item.priceCatalog
quantityThis is the quantity of the products, that in order cancellation equals to zero.0

List of items with tax

CreditMemoItem Record Type attributeTypeCommentNewStore attribute
itemRecordRefThis is the NetSuite identifier of the item that in this case is the productId in NewStore data model.order.items[i].productId

price

RecordRef

This is the identifier of the price type which is specified in the AWS Systems Manager Parameter Store.

Note

This is not the price of the item.

NA

rateThis is the duty of the tax item. In NewStore platform this value is stored in external_attributes of the item.item.external_attributes["duty"]

List of items with discount

CreditMemoItem Record Type attributeTypeCommentNewStore attribute
itemRecordRefThis is the identifier of the discount type which is specified in the AWS Systems Manager Parameter Store.order.items[i].productId

price

RecordRef

This is the identifier of the price type which is specified in the AWS Systems Manager Parameter Store.

Note

This is not the price of the item.

NA

rateThis is the negative value of the priceAdjustment for each discount item.-1 * item.discounts[i]["priceAdjustment"]

List of payment items

CreditMemoItem Record Type attributeTypeCommentNewStore attribute
itemRecordRefThis is the identifier of the payment method which comes from the payment methods map.NA
priceRecordRefThis is the captured amount of the authorization transactions.transaction["capturedAmount"]
taxCodeThis is the identifier of the tax configured in NetSuite which is specified in AWS Systems Manager Parameter Store. There should be different identifiers for taxable and non-taxable items based on the subsidiary.NA