0

Add an installment to a deal

by
Published Oct 17, 2025

Adds an installment to a deal. An installment can only be added if the deal includes at least one one-time product. If the deal contains at least one recurring product, adding installments is not allowed. Only available in Advanced and above plans.

Script pipedrive Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Pipedrive = {
3
  apiToken: string;
4
};
5
/**
6
 * Add an installment to a deal
7
 * Adds an installment to a deal.
8

9
An installment can only be added if the deal includes at least one one-time product. 
10
If the deal contains at least one recurring product, adding installments is not allowed.
11

12
Only available in Advanced and above plans.
13

14
 */
15
export async function main(
16
  auth: Pipedrive,
17
  id: string,
18
  body: { description: string; amount: number; billing_date: string },
19
) {
20
  const url = new URL(
21
    `https://api.pipedrive.com/api/v2/deals/${id}/installments`,
22
  );
23

24
  const response = await fetch(url, {
25
    method: "POST",
26
    headers: {
27
      "Content-Type": "application/json",
28
      "x-api-token": auth.apiToken,
29
    },
30
    body: JSON.stringify(body),
31
  });
32
  if (!response.ok) {
33
    const text = await response.text();
34
    throw new Error(`${response.status} ${text}`);
35
  }
36
  return await response.json();
37
}
38