Preventing Duplicate Customers in NetSuite


If you have been using both Stripe and NetSuite for some time, most likely you have customer data in both systems. There are a couple strategies for ensuring duplicate data is not created in NetSuite.

Note that if you are new to Stripe or NetSuite most of this document is not applicable to your situation.

What constitutes a duplicate customer is different in every business. For instance, in some cases, email is a unique identifier for a user, for other businesses different customers can share the same email. Our approach to helping you prevent duplicates is to offer (as an optional feature) basic duplicate detection and provide open source code demonstrating how to implement an advanced duplicate detection process.

A couple of strategies are detailed below. We are happy to chat with you during the onboarding process to help design the best plan for your use-case and help design any matching logic.

Duplicate Prevention Strategies

In most business that don't have multiple sales channels (i.e. not eCommerce) here's what works for most users:

  • During the onboarding process, map all existing NetSuite customers to Stripe customers (this is something we'll do for you).
  • New customers are created in NetSuite by the integration using the Stripe customer data

Here are some use-cases where the above approach quickly breaks down:

  • You accept phone orders and create new customers directly in NetSuite. Later on, these customers process payments on your website.
  • You have other integrations in place that are creating customers directly in NetSuite
  • You have multiple Stripe accounts for different revenue streams and want to use a single NetSuite customer across those accounts

Here's the approach recommended for these use-cases:

  1. During the onboarding process, map all existing customers.
  2. When a new customer is created in Stripe search for an existing customer before creating a new customer.
  • The integration has a pre-built duplicate detection system which can attempt to find an existing customer by their email address.
  • In many businesses, email is not a unique identifier. In this case you can temporarily "block" the customer from being passed to the integration, search for a duplicate in NetSuite, and link the Stripe customer and unblock the customer from the integration (this is detailed out below)

As part of the onboarding process, we'll walk you through your system setup and work together to create a robust solution to this problem.

Mapping Existing Customers

If you have existing customers in Stripe and NetSuite, the Stripe customers need to be mapped (i.e. linked) to NetSuite customers during the onboarding process. This mapping is done using customer metadata and instructs SuiteSync to use an existing NetSuite customer instead of creating a new one.

Here are two ways to establish this mapping:

  1. Create an Excel/CSV document with two columns: 1) Stripe ID and 2) NetSuite Customer Internal ID. We have migration tools to help you import this data during the onboarding process. Here's the migration script that you can use to import this data into Stripe.
  2. Attempt to match customers between Stripe and NetSuite based on email and name. We have a migration tool to match on these files. This tool provides a report of any customers which did not automatically match, which you can then map manually. Here's an open source example of this tool.

Merging Duplicate Customers in NetSuite

When you merge a customer in NetSuite, one of the customers is fully deleted and the other remains. If you merge a customer "into" a SuiteSync-created NetSuite customer the same NetSuite customer will continue to be used as the customer reference in Stripe. If the SuiteSync-created customer is deleted during a merge, SuiteSync will detect that the customer is deleted and search for an existing customer match in NetSuite using your duplicate detection configuration in SuiteSync.

Importing Customers from NetSuite to Stripe, or from Stripe to NetSuite

If you are new to either Stripe or NetSuite, we have tools to import customers from Stripe to NetSuite, or from NetSuite to Stripe.

Automatically Detecting Duplicate Customers by Email, or Another Custom Identifier

We can optionally automatically link to existing customers in NetSuite by matching on the email address specified on the Stripe customer. Alternatively, we can use any data on the customer (in the description, metadata, etc) to match to an existing NetSuite customer.

Here are details about the duplicate detection system:

  • We match on the email field of the customer record
  • Whitespace, upper vs lower case, etc do not affect the matching process
  • Leads, contacts, etc are not matched. Only proper customer records.
  • If multiple matches are found, the first match found is chosen.
  • If no match is found, we can either 1) use a generic Stripe customer or 2) create a new unique customer record in NetSuite for the Stripe customer.

Preventing Duplicates When Importing Customers using a CSV

When running a CSV customer import in NetSuite you'll want to ensure that:

  1. Any customers imported from an external system are merged into an existing customer created by SuiteSync
  2. New customers created by the import are structured in a way that makes it easy for SuiteSync to match Stripe customers to them.

The key to preventing duplicates with a CSV import using a common identifier to match Stripe customers to NetSuite. The challenge with CSV imports is the Stripe customer is sometimes created before the CSV import and sometimes it's created after the CSV customer import. This eliminates the possibility of using a custom common identifier to match between the systems.

With a CSV import we can't use a custom common identifier to match because the NetSuite CSV import only allows you to prevent duplicates on import using either the external ID or the internal ID of the NetSuite record. Most systems generating the CSV won't know the internal ID of the NetSuite record, so the only option we are left with is using the external ID.

The SuiteSync system requires that the external ID be set to the Stripe Customer ID. It's critical that the system generating the CSV export can add the Stripe Customer ID so you can use it as a matching identifier in the NetSuite CSV import.

If you can't include the Stripe Customer ID in your CSV export, it's always possible to merge duplicates after import manually.

Match new customers against an existing NetSuite customer

Here's how this process works:

  1. When you create the Stripe customer, block the customer from passing to the integration
  2. Search for an existing customer in NetSuite using logic in your application
  3. If a match is found, link the Stripe customer and unblock the record
  4. If a match is not found, unblock the record and SuiteSync will create a new customer

Here's an example of how to implement this process:

customer = Stripe::Customer.create(
  email: 'duplicate-customer@example.com',
  metadata: {
    netsuite_block_integration: true
  }
)

# then, in a background process...

ns_existing_customer = find_existing_customer_in_netsuite(customer)

if ns_existing_customer
  customer.metadata['netsuite_customer_id'] = ns_existing_customer.internal_id
end

customer.metadata['netsuite_block_integration'] = nil
customer.save

Use a custom customer creation process and override SuiteSync's customer creation

If you'd like to completely control the customer creation process on your end, you can do so by providing a netsuite_customer_id on the customer metadata.

Here's an example:

customer = Stripe::Customer.create(
  email: 'new-customer@example.com',
  metadata: {
    netsuite_block_integration: true
  }
)

# then, in a background process...

ns_customer = create_customer_in_netsuite(customer)

customer.metadata['netsuite_customer_id'] = ns_customer.internal_id
customer.metadata['netsuite_block_integration'] = nil
customer.save