0

Record a Invoice Payment

by
Published Oct 17, 2025

Create a Hosted page for recording a Invoice payment for a subscription

Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
};
5
/**
6
 * Record a Invoice Payment
7
 * Create a Hosted page for recording a Invoice payment for a subscription
8
 */
9
export async function main(
10
  auth: Zoho,
11
  X_com_zoho_subscriptions_organizationid: string,
12
  body: {
13
    invoice_id: string;
14
    redirect_url?: string;
15
    hostedpage_settings_id?: string;
16
    payment_gateways?: { payment_gateway?: string }[];
17
  },
18
) {
19
  const url = new URL(
20
    `https://www.zohoapis.com/billing/v1/hostedpages/invoicepayment`,
21
  );
22

23
  const response = await fetch(url, {
24
    method: "POST",
25
    headers: {
26
      "X-com-zoho-subscriptions-organizationid":
27
        X_com_zoho_subscriptions_organizationid,
28
      "Content-Type": "application/json",
29
      Authorization: "Zoho-oauthtoken " + auth.token,
30
    },
31
    body: JSON.stringify(body),
32
  });
33
  if (!response.ok) {
34
    const text = await response.text();
35
    throw new Error(`${response.status} ${text}`);
36
  }
37
  return await response.json();
38
}
39