Matching and Duplication
  • 13 Jul 2022
  • 4 Minutes to read
  • Dark

Matching and Duplication

  • Dark

Have better control over Lead, Contact, and Account matching and creation with our Relationship Settings. This feature allows you to define if records should be matched and created based on your active Salesforce matching rules when a Payment Gateway Customer is created.

Note: Matching criteria is based on Matching and Duplication rules specified in Setup. The Account, Contact, and Lead objects are compared in order to find a match or create a new record.

Matching and Duplication

Matching and Duplication rules are required for Relationship Settings "Create New Record If No Match" and "Only Relate a Matched Record" options.

We recommend using the Standard Salesforce Matching and Duplication rules for Account, Contact, and Lead. If you do not enable these, relationship settings will not know what to match against when creating a new record.

How does it work?

There is a field on the Payment Gateway called Relationship Settings. This is the field that will control how Payment Gateway Customers, Contacts, Accounts, and Leads are created on a certain gateway. The Relationship Settings field can be defined differently for each payment gateway you have in your organization.

Relationship settings define the matching and creation preference for your org. This takes the new Payment Gateway Customer record that is inserted into Salesforce, then evaluates your active duplicate rules in conjunction with your Relationship Setting Rule. From there, Relationship Settings determines how to match existing Contacts, Leads, or Accounts to your Payments Gateway Customer, or will create new records if you configure it do so.

Relationship Settings will determine your matching and/or creation preferences. Duplicate rules will constitute what is a match, and what isn't.

This functionality fires when a record is created, via API, and webhooks. The logic is fired from the Payment Gateway Customer, and will roll down into the Payment Method for the customer.

Did you upgrade Payments?

Users upgrading Payments will need to manually deactivate the current “Payment Gateway Customer Dup Rule” matching rule and activate the new Payment_Gateway_Customer_Matching_Rule2 matching rule. The new matching rule will be installed automatically for new installations.


  1. Open the App Launcher and open Relationship Settings.
  2. Click New in the top-right hand corner of the page.
  3. Populate the Name field.
  4. Now select a Relationship Rule. There are four options.
    • Only Relate A Matched Record: This setting will not create new records, but only update existing records.
    • Create New Record If No Match: This settings will create a record if there is no match detected
    • Always Create A New Record: This setting will ignore duplication rules, and will create a new record even if there is already an existing record.
    • No Matching Or Record Creation: This setting will not attempt to match or create new records.

H_02_09_configuration 1

  1. Next, define a Create Rule this will control what record you want configured, if you choose to create new records.
    Note: You can also define Record Types
Default Relationship Settings

You will only be able to mark one Relationship Setting record as the default for your org. We put in place a validation rule to prevent multiple records being set to default.

H_02_09_configuration 2


For this example, we setup:

  • Relationship Rule = "Create a record if no match"
  • Create Rule = "Lead"
    Note: If you set the Create Rule = Account or Contact, those fields will be created, instead of a lead.

Now, when we create we create a customer in Stripe, a Lead and Payment Gateway Customer will be created in Salesforce.

H_02_09_configuration 3

Next, wait for webhooks to process.

Note: you can manually do this by navigating to your Payment Gateway, click "Sync with Stripe" and then click Sync Customers.

Wait for the sync to finish processing, and your new lead will be generated!

H_02_09_configuration 4

Matching Logic Variations

Fields for matching logic:

  • Match Records
    • There could be use cases that do not require matching on all three objects: Accounts, Contacts, and Leads. We've added a multi-select picklist that allows users to select which object they would like to use for matching. Only want to match on Lead? No Problem! Just add "Lead" as your selection in the Match Records multi-select picklist field.

If you leave this field blank and you don't have active duplicate rules for Lead, Contact, and Account, you'll receive an error within the Blackthorn Logs. Additionally, if this field is blank your current matching logic will not continue to find matches.

  • Match All Email Fields
    • If this is checked, the duplication logic will look for all email fields from the object selected in Match Records and execute matching criteria based on matching rules in Settings.

H_02_09_matching logic variations

Note: You will need to create matching and duplication rules for each of the email address fields.

Use Case: Let's say you would like to match the Email field on a new Payment Gateway Customer to a custom field named Work_Email__c on the Contact object.

  1. Create a matching and duplication rule from setup for Work_Email__c on Contact.
  2. Make sure your Relationship Setting is added to your Payment Gateway record.
  3. Set Match Records so that Contact is one of the values selected.
  4. Check the Match All Email Fields checkbox.
  5. Create a Contact record with Work_Email__c populated.
  6. Create a Payment Gateway Customer with the same value used as work email on Contact.
  7. After clicking 'Save' notice the existing Contact record is populated in the Contact lookup on Payment Gateway Customer.

What's Next