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've been manually integrating Stripe customers into NetSuite, the Stripe customers need to be mapped to NetSuite customers during the onboarding process. This mapping is done using customer metadata and instructs SuiteSync to use an existing 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 import this data during the onboarding process. Here's an open source example of the migration tool in case you need to heavily customize this process or want to manage this process yourself.
  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.

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 effect the matching process
  • Leads, contacts, etc are not matched. Only proper customer records.

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