--- title: "Matching and Duplication" slug: "matching-duplication" updated: 2026-02-06T19:42:15Z published: 2026-02-06T19:42:15Z canonical: "docs.blackthorn.io/matching-duplication" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.blackthorn.io/llms.txt > Use this file to discover all available pages before exploring further. # Matching and Duplication Relationship Settings give you better control over Lead, Contact, and Account matching and creation. With this feature, you can define which records should be matched and created when a Payment Gateway Customer is created. ## Before You Start The following notes are important to review before you start. - Matching criteria are based on Matching and Duplication rules specified in Setup. The Account, Contact, and Lead objects are compared to either find a match or create a new record. - Matching and Duplication rules are required for the 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 Accounts, Contacts, and Leads. If you do not enable the Standard Salesforce Matching and Duplication rules, the Relationship Settings will not know which items to match when creating a new record. ## How Does It Work? The **Relationship Settings** field is located on the Payment Gateway object. This field controls how Payment Gateway Customers, Accounts, Contacts, and Leads are created on a Payment Gateway. To allow for a variety of scenarios, the **Relationship Settings** field can be defined differently for each Payment Gateway your organization uses. Relationship Settings records define the matching and/or creation preferences for your org. The logic starts with the Payment Gateway Customer and rolls down to the customer’s Payment Method. The following steps show the order of execution. 1. The new Payment Gateway Customer (PGC) record is added to Salesforce via API and webhooks. 2. The PGC record is compared to your active duplicate rules in conjunction with your Relationship Settings. (Duplicate rules determine what is or isn’t a match.) 3. The Relationship Settings determine how to match existing Accounts, Contacts, and Leads to the PGC record. 4. If your settings are configured to do so, a new Account, Contact, and Lead record will be created. 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. ## Configure Your Relationship Settings 1. Click the App Launcher. 2. Type and click “Relationship Settings”. 3. Click **New** in the top-right-hand corner of the page.![Create Relationship Settings_1](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/Create%20Relationship%20Settings_1.png) 4. Enter a **Name**. (required) 5. Select a **Relationship Rule**. - “Only Relate A Matched Record”: This setting updates existing records. It doesn’t create new records. - “Create New Record If No Match”: This setting creates a record if a match isn’t detected. - “Always Create A New Record”: This setting ignores duplication rules and creates a new record even if an existing record already exists. - “No Matching Or Record Creation”: This setting prevents matching and the creation of new records. 6. Define a **Create Rule**. This field selects the type of related record to be created. 7. Select an Account, Contact, or Lead record type, if using. 8. Click **Save**. ![Create Relationship Settings_2](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/Create%20Relationship%20Settings_2.png) Default Relationship SettingsYou can only mark one Relationship Setting record as the default setting for your org. A validation rule exists to prevent multiple records from being set to default. ### Example 1. Set **Relationship Rule** = "Create a record if no match".![H_02_09_configuration 3](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/H_02_09_configuration%203.png) 2. Set Create Rule = "Lead". 3. Create a customer in Stripe. 4. Wait for webhooks to process. *Or manually process webhooks by navigating to your Payment Gateway, clicking* **Sync with Stripe***, and clicking* **Sync Customers**. Once the sync is finished, your new Lead record and Payment Gateway Customer will be generated in Salesforce. ![H_02_09_configuration 4](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/H_02_09_configuration%204.png) ## Additional Fields for Matching Logic Variations ### Match Records Some scenarios do not require matching on all three objects: Accounts, Contacts, and Leads. The **Match Records** field is a multi-select picklist that allows users to select which object they want to use for matching. Important If you leave the **Match Records** field blank and don't have active duplicate rules for Lead, Contact, and Account, you will receive an error in the Blackthorn Logs. Additionally, if this field is blank your current matching logic will not continue to find matches. ### Match All Email Fields If the **Match All Email Fields** field is checked, the duplication logic will look for all email fields from the object selected in the **Match Records** field and execute matching criteria based on the matching rules in Settings. ![H_02_09_matching logic variations](https://cdn.document360.io/f977eec0-500f-40a3-b663-724a51f78075/Images/Documentation/H_02_09_matching%20logic%20variations.png) RequirementYou must create matching and duplication rules for each email address field if you use the **Match All Email Fields** field. ### Use Case Let's say you want to match the **Email** field on a new Payment Gateway Customer to a custom field named **Work Email** on the Contact object. 1. Create a matching and duplication rule from Setup for the **Work Email** field on the Contact object. 2. Add your **Relationship Settings** to your Payment Gateway record. 3. Set **Match Records** so “Contact” is one of the values selected. 4. Check the **Match All Email Fields** checkbox. 5. Create a Contact record with **Work Email** populated. 6. Create a Payment Gateway Customer with the same value that was used for the Contact **Work Email** field. 7. After clicking **Save**, notice the existing Contact record is populated in the **Contact** lookup on Payment Gateway Customer.