0

Get matching transactions

by
Published Oct 17, 2025

Provide criteria to search for matching uncategorised transactions. The list of transactions can also include invoices/bills/credit-notes which will not be matched directly. Instead, a new (payment/refund) transaction is recorded and matched.

Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
};
5
/**
6
 * Get matching transactions
7
 * Provide criteria to search for matching uncategorised transactions. The list of transactions can also include invoices/bills/credit-notes which will not be matched directly. Instead, a new (payment/refund) transaction is recorded and matched.
8
 */
9
export async function main(
10
  auth: Zoho,
11
  transaction_id: string,
12
  organization_id: string | undefined,
13
  transaction_type: string | undefined,
14
  date_after: string | undefined,
15
  date_before: string | undefined,
16
  amount_start: string | undefined,
17
  amount_end: string | undefined,
18
  contact: string | undefined,
19
  reference_number: string | undefined,
20
  show_all_transactions: string | undefined,
21
) {
22
  const url = new URL(
23
    `https://www.zohoapis.com/books/v3/banktransactions/uncategorized/${transaction_id}/match`,
24
  );
25
  for (const [k, v] of [
26
    ["organization_id", organization_id],
27
    ["transaction_type", transaction_type],
28
    ["date_after", date_after],
29
    ["date_before", date_before],
30
    ["amount_start", amount_start],
31
    ["amount_end", amount_end],
32
    ["contact", contact],
33
    ["reference_number", reference_number],
34
    ["show_all_transactions", show_all_transactions],
35
  ]) {
36
    if (v !== undefined && v !== "" && k !== undefined) {
37
      url.searchParams.append(k, v);
38
    }
39
  }
40
  const response = await fetch(url, {
41
    method: "GET",
42
    headers: {
43
      Authorization: "Zoho-oauthtoken " + auth.token,
44
    },
45
    body: undefined,
46
  });
47
  if (!response.ok) {
48
    const text = await response.text();
49
    throw new Error(`${response.status} ${text}`);
50
  }
51
  return await response.json();
52
}
53