# Create Invoice — Zoho Books

> Creates an invoice for your customer. See the documentation

- Key: `zoho_books-create-invoice`
- Type: Action (Write)
- Version: 0.3.1
- App: Zoho Books (`zoho_books`) — https://pipedream.com/apps/zoho-books.md
- This page (HTML): https://pipedream.com/apps/zoho-books/actions/create-invoice
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/zoho_books/actions/create-invoice/create-invoice.mjs

## Description

Creates an invoice for your customer. [See the documentation](https://www.zoho.com/books/api/v3/invoices/#create-an-invoice)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `customerId` | `string` | Yes | ID of the customer the invoice has to be created. Options are loaded from the connected account. |
| `invoiceNumber` | `string` | No | Search invoices by invoice number. Max-length [100] |
| `placeOfSupply` | `string` | No | Place where the goods/services are supplied to. (If not given, place of contact given for the contact will be taken). |
| `vatTreatment` | `string` | No | Enter vat treatment. |
| `referenceNumber` | `string` | No | The reference number of the invoice. |
| `templateId` | `string` | No | ID of the pdf template associated with the invoice. Options are loaded from the connected account. |
| `date` | `string` | No | Search invoices by invoice date. Default date format is yyyy-mm-dd. |
| `paymentTerms` | `integer` | No | Payment terms in days e.g. 15, 30, 60. Invoice due date will be calculated based on this. Max-length [100] |
| `paymentTermsLabel` | `string` | No | Used to override the default payment terms label. Default value for 15 days is "Net 15 Days". Max-length [100] |
| `dueDate` | `string` | No | Search invoices by due date. Default date format is yyyy-mm-dd. Variants: due_date_start, due_date_end, due_date_before and due_date_after |
| `discount` | `string` | No | Discount applied to the invoice. It can be either in % or in amount. e.g. 12.5% or 190. Max-length [100] |
| `isDiscountBeforeTax` | `boolean` | No | Used to specify how the discount has to applied. Either before or after the calculation of tax. |
| `discountType` | `string` | No | How the discount is specified. Allowed values are entity_level or item_level. |
| `isInclusiveTax` | `boolean` | No | Used to specify whether the line item rates are inclusive or exclusive of tax. |
| `exchangeRate` | `string` | No | Exchange rate of the currency. |
| `recurringInvoiceId` | `string` | No | ID of the recurring invoice from which the invoice is created. Options are loaded from the connected account. |
| `invoicedEstimateId` | `string` | No | ID of the invoice from which the invoice is created. |
| `salespersonName` | `string` | No | Name of the sales person. |
| `customFields` | `string[]` | No | A list of custom fields objects for an invoice. Example: {"customfield_id": 123123, "value": "value"} |
| `lineItems` | `string[]` | No | A list of line items objects of an estimate. Example: {"item_id": "1352827000000156060", "notes": "note", "name": "Item name", "quantity": "1" } See the documentation for further details. |
| `paymentOptions` | `object` | No | Payment options for the invoice, online payment gateways and bank accounts. Will be displayed in the pdf. Example: {"payment_gateways": ["configured": true, "additional_field1": "standard", "gateway_name": "paypal"]} See the documentation for further details. |
| `allowPartialPayments` | `boolean` | No | Boolean to check if partial payments are allowed for the contact |
| `customBody` | `string` | No | Custom Body |
| `customSubject` | `string` | No | Custom Subject |
| `notes` | `string` | No | The notes added below expressing gratitude or for conveying some information. |
| `terms` | `string` | No | The terms added below expressing gratitude or for conveying some information. |
| `shippingCharge` | `string` | No | Shipping charges applied to the invoice. |
| `adjustment` | `string` | No | Adjustment |
| `adjustmentDescription` | `string` | No | Adjustment Description |
| `reason` | `string` | No | Reason |
| `taxAuthorityId` | `string` | No | ID of the tax authority. Tax authority depends on the location of the customer. For example, if the customer is located in NY, then the tax authority is NY tax authority. Options are loaded from the connected account. |
| `taxExemptionId` | `string` | No | ID of the tax exemption. Options are loaded from the connected account. |
| `taxId` | `string` | No | ID of the tax. Options are loaded from the connected account. |
| `expenseId` | `string` | No | Options are loaded from the connected account. |
| `salesorderItemId` | `string` | No | ID of the sales order line item which is invoices. |
| `avataxTaxCode` | `string` | No | A tax code is a unique label used to group Items (products, services, or charges) together. Refer the [link][2] for more deails. Max-length [25] |
| `timeEntryIds` | `string[]` | No | IDs of the time entries associated with the project. Options are loaded from the connected account. |
| `send` | `boolean` | No | Send the estimate to the contact person(s) associated with the estimate. |
| `ignoreAutoNumberGeneration` | `boolean` | No | Ignore auto estimate number generation for this estimate. This mandates the estimate number. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "zoho_books",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "zoho_books-create-invoice",
  arguments: {
    customerId: "Customer Id",
    invoiceNumber: "Invoice Number",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "zoho_books-create-invoice",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    zoho_books: { authProvisionId: "apn_xxxxxxx" },
    customerId: "Customer Id",
    invoiceNumber: "Invoice Number",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "zoho_books-create-invoice",
    "configured_props": {
      "zoho_books": { "authProvisionId": "apn_xxxxxxx" },
      "customerId": "Customer Id",
      "invoiceNumber": "Invoice Number"
    }
  }'
```

---

- App: https://pipedream.com/apps/zoho-books.md · All apps: https://pipedream.com/apps
