Integrate In-Store Purchases via API

With Connectif, you can record purchases your customers make in your physical stores to register them in their contact profile and have a unified history of their online and offline actions. This way, you can use that information to personalize your strategies using the complete purchase history of each customer, regardless of the channel where the purchases were made.

In this article, you will learn how to integrate in-store purchases via the Connectif API so they are recorded in each contact's profile.

  

To use the integration via API, you will need an expert with programming knowledge. If you need more information, check the Connectif API documentation.

 

Before You Start

To perform this integration, you should have the following aspects covered:

  • Email as primary key: The contact must exist in your Connectif Contacts database with an associated email as the primary key. Although the API supports other identifiers (such as ID number or phone), using them as the main identifier would cause duplicate contacts to be created.
  • Catalog and products synchronized: All products included in the offline purchase must exist in your Connectif catalog. If an item is sold exclusively in physical stores and is not part of the website, you must create it in Connectif with the status Discontinued to be able to link the offline sale.
  • Product information: It is recommended to send complete information about the products included in the purchase, especially the categories attribute. This will allow you to create product segments and use that information in your automated strategies.
  • Strict request structure: The request can only include attributes supported by the API model. It is not possible to send custom fields or additional attributes within the JSON.
 

Learn how the Connectif API works in this article.

 

STEP 1. Preparing Contacts in Connectif

(This section explains how to prepare your contacts in Connectif so they can be properly linked to the offline purchase).

  

You can add contacts to Connectif via file import or through the API.

When registering an offline purchase via the API, Connectif will associate the sent information with existing contacts and products. The API will not create them during the process, so you must verify beforehand that they exist in Connectif.

1. Verify that the contact already exists in Connectif with their email registered. If it does not exist, create it beforehand to properly link the activity.

2. In the search bar, enter the contact's email to check its existence. If the contact does not exist, you will need to create it to associate the purchase with their history.

 

Learn how to import contacts in this article.

Integración compras en tiendas físicas - 1.png 
 

STEP 2. Preparing Products in Connectif

(This section explains how to prepare your products in Connectif so they can be properly linked to the offline purchase).

  

You can add products to Connectif via file import or through the API.

3. Go to "E-commerce > Catalog" and click on the options button  .

Integración compras en tiendas físicas - 8.png 
 

4. If any of the items associated with the offline purchase do not exist in Connectif, create them before importing the purchase by doing the following:

  • Click on Create product.

    Integración compras en tiendas físicas - 2.png 
     

  • Fill in at least the required product fields (name, ID, Detail URL, and price).

    Integración compras en tiendas físicas - 3.png 
     

  • If the product is sold only in physical stores, assign it the status Discontinued so the offline purchase can be recorded but the product does not appear in the online store.
 

The Detail URL is mandatory, even if the product does not exist on the website or is marked as Discontinued. In these cases, include a URL that uses the same domain registered in your Connectif store to avoid validation errors. For example, if your store's domain is https://www.mydomain.com, you can use as the Detail URL: https://www.mydomain.com/products/SKU-12345.

 

STEP 3. Creating the API Key

5. Go to Store Settings in the left sidebar menu of Connectif.

Integración compras en tiendas físicas - 4.png 
 

6. In the tab selector, go to "API & IP Access" and click on API Keys.

Integración compras en tiendas físicas - 9.png 
 

7. Click the button   Create new API Key.

Integración compras en tiendas físicas - 5.png 
 

8. In the Purchases section of the creation panel, enable permissions for Read, Write, and Delete in bulk.

Integración compras en tiendas físicas - 6.png

  

If you will also manage contacts and products via the API, enable the corresponding permissions in the Contacts and Products sections.

 

9. Save the API key and copy it to use later in your automation script.

Integración compras en tiendas físicas - 7.png 
 

STEP 4. Registering the Purchase via API

(This section explains how to prepare sending the purchase information to Connectif via API).

  

To register an offline purchase, you must make an HTTP POST request that sends the purchase information to Connectif in JSON format.

10. Create the automation script from your system and include the API Key generated in the previous step.

11. Configure in the script an HTTP POST request to register the purchase in Connectif: https://api.connectif.cloud/purchases/

In the request, specify:

  • The API Key to authenticate the call.
  • The content type application/json.
  • The purchase information in the request body.

12. Create the purchase information to send and verify that it meets the following conditions:

  • Include the required purchase attributes: cartId, products, purchaseDate, purchaseId, totalPrice, and totalQuantity.
  • Identify the contact using contactEmail.
  • For each product included in products, complete the required attributes: name, price, productDetailUrl, productId, quantity, and unitPrice.
  • To register the purchase as coming from a physical store, set sourceType with the value point-of-sale and indicate the store or branch in sourceName.
  • Make sure purchaseId is the unique identifier for the purchase.
 

Learn how to build the complete request structure in the API documentation.

 

Example

Once created, the request will look similar to this:

const apiKey = "YOUR_API_KEY";
const url = "https://api.connectif.cloud/purchases/";

const purchase = {
  contactEmail: "customer@example.com",
  purchaseId: "POS-20260804-001",
  cartId: "POS-20260804-001",
  purchaseDate: "2026-08-04T15:30:00Z",
  sourceType: "point-of-sale",
  sourceName: "Downtown Store",
  products: [
    {
      productId: "SKU-12345",
      name: "Running Shoe",
      categories: ["Footwear/Running"],
      quantity: 2,
      unitPrice: 39.95,
      price: 79.90,
      productDetailUrl: "https://www.mydomain.com/products/SKU-12345"
    }
  ],
  totalQuantity: 2,
  totalPrice: 79.90
};

async function main() {
  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Authorization": `apiKey ${apiKey}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify(purchase)
  });

  const result = await response.json();
  console.log(result);
}

main();
  

The script registers a purchase made in a physical store and associates it with the contact indicated in the contactEmail attribute. The attributes sourceType and sourceName identify the physical point of sale and the source name where it was made.

 

 

Success!
The import of purchases from physical stores is now ready.

 


Keep Learning!

To take full advantage of your Connectif account, we recommend continuing with the following articles: