Accessing a customers "Activity" via API

I need to access a customer’s “Activity” via an API call. I haven’t found a way to grab that data. Please see attached.

Currently there isn’t an API that will bring in the activity for a customer. You can use our APIs to bring in all payments and parse out the matching customer_ids. Also if a customer was added to sales prior to payment you can use the Orders API to SearchOrders by customer_id. :slightly_smiling_face:

Ok, thank you, I’ll check out the “Orders API”.

Ok, running the ordersApi query with a customerId(x’d out for security) like this:

let response = await client.ordersApi.searchOrders({
      locationIds: [LOCATION_ID],
      query: {
        filter: {
          customerFilter: {
            customerIds: ["ATQ3xxxxxxxxxxxxxx"],
          },
        },
      },
    });
    console.dir(response.result, { depth: null });

I get this response which “contains” a customerId that is NOT the customerId I queried with. Further down in the JSON result the correct customerId can be seen. I don’t understand this. Please explain.

orders: [
    {
      id: 'hejntaxxxx',
      locationId: 'xxxxxx',
      **customerId: 'S4D0xxxxxxxxxxx'**,
      lineItems: [
        {
          uid: 'hejntaxxxxxx:0',
          quantity: '1',
          itemType: 'CUSTOM_AMOUNT',
          basePriceMoney: { amount: 300n, currency: 'USD' },
          variationTotalPriceMoney: { amount: 300n, currency: 'USD' },
          grossSalesMoney: { amount: 300n, currency: 'USD' },
          totalTaxMoney: { amount: 0n, currency: 'USD' },
          totalDiscountMoney: { amount: 0n, currency: 'USD' },
          totalMoney: { amount: 300n, currency: 'USD' }
        }
      ],
      returnAmounts: {
        totalMoney: { amount: 0n, currency: 'USD' },
        taxMoney: { amount: 0n, currency: 'USD' },
        discountMoney: { amount: 0n, currency: 'USD' },
        tipMoney: { amount: 0n, currency: 'USD' },
        serviceChargeMoney: { amount: 0n, currency: 'USD' }
      },
      netAmounts: {
        totalMoney: { amount: 300n, currency: 'USD' },
        taxMoney: { amount: 0n, currency: 'USD' },
        discountMoney: { amount: 0n, currency: 'USD' },
        tipMoney: { amount: 0n, currency: 'USD' },
        serviceChargeMoney: { amount: 0n, currency: 'USD' }
      },
      tenders: [
        {
          id: 'xmNHxxxxx',
          locationId: 'xxxxxx',
          transactionId: 'hexxxxxx',
          createdAt: '2022-11-07T04:05:04Z',
          note: 'Online Transaction',
          amountMoney: { amount: 300n, currency: 'USD' },
          processingFeeMoney: { amount: 39n, currency: 'USD' },
          **customerId: 'ATQ3xxxxxxx'**,
          type: 'CARD',
          cardDetails: {
            status: 'CAPTURED',
            card: {
              cardBrand: 'AMERICAN_EXPRESS',
              last4: 'xxxx',
              fingerprint: 'sq-x-xxxx'
            },
            entryMethod: 'ON_FILE'
          }
        }
      ],
      createdAt: '2022-11-07T04:05:04Z',
      updatedAt: '2022-11-07T04:05:04Z',
      closedAt: '2022-11-07T04:05:04Z',
      state: 'COMPLETED',
      totalMoney: { amount: 300n, currency: 'USD' },
      totalTaxMoney: { amount: 0n, currency: 'USD' },
      totalDiscountMoney: { amount: 0n, currency: 'USD' },
      totalTipMoney: { amount: 0n, currency: 'USD' },
      totalServiceChargeMoney: { amount: 0n, currency: 'USD' },
      netAmountDueMoney: { amount: 0n, currency: 'USD' }
    }
  ]

It’s probably the customer_id of a merged profile. When duplicate customer profiles are identified and merged, either manually by the seller or using automated detection, the existing profiles are merged into a single profile that is assigned a new ID.

If you specify the ID of a customer profile that was deleted in a merge operation, the Orders API returns the new customer profile. For example, suppose customers A and B are merged and a new customer C is created. If you call SearchOrders using the ID of customer A or B, the Customers API returns customer C. :slightly_smiling_face: