# Create Customer Invoice — Pennylane

> Generates a new invoice for a customer using Pennylane. See the documentation

- Key: `pennylane-create-customer-invoice`
- Type: Action (Write)
- Version: 0.0.3
- App: Pennylane (`pennylane`) — https://pipedream.com/apps/pennylane.md
- This page (HTML): https://pipedream.com/apps/pennylane/actions/create-customer-invoice
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pennylane/actions/create-customer-invoice/create-customer-invoice.mjs

## Description

Generates a new invoice for a customer using Pennylane. [See the documentation](https://pennylane.readme.io/reference/customer_invoices-post-1)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `date` | `string` | Yes | Invoice date (ISO 8601) |
| `deadline` | `string` | Yes | Invoice payment deadline (ISO 8601) |
| `externalId` | `string` | No | An id you can use to refer to the invoice from outside of Pennylane |
| `pdfInvoiceFreeText` | `string` | No | For example, the contact details of the person to contact |
| `pdfInvoiceSubject` | `string` | No | Invoice title |
| `draft` | `boolean` | Yes | Do you wish to create a draft invoice (otherwise it is a finalized invoice)? Reminder, once created, a finalized invoice cannot be edited! |
| `currency` | `string` | No | Invoice Currency (ISO 4217). Default is EUR. |
| `specialMention` | `string` | No | Additional details |
| `discount` | `integer` | No | Invoice discount (in percent) |
| `language` | `string` | No | invoice pdf language |
| `bankingProvider` | `string` | Yes | The banking provider for the transaction |
| `providerFieldName` | `string` | Yes | Name of the field that you want to match |
| `providerFieldValue` | `string` | Yes | Value that you want to match |
| `customerId` | `string` | Yes | Existing customer identifier (source_id) Options are loaded from the connected account. |
| `lineItemsSectionsAttributes` | `string[]` | No | A list of objects of items sections to be listed on the invoice. Example: [{"title": "Title","description": "description","rank": 1}] See the documentation from further information. |
| `lineItems` | `string[]` | Yes | A list of objects of items to be listed on the invoice. Example: [{"product": {"source_id": "0e67fc3c-c632-4feb-ad34-e18ed5fbf66a","unit": "20","price": "10.00","label": "Product label","vat_rate": "FR_09","currency": "EUR"},"quantity": 2,"label": "Line Item Label"}] See the documentation from further information. |
| `categories` | `string[]` | No | A list of objects of categories |
| `startDate` | `string` | Yes | Start date of the imputation period (ISO 8601) |
| `endDate` | `string` | Yes | End date of the imputation period (ISO 8601) |

## 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": "pennylane",
      },
    },
  },
)

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: "pennylane-create-customer-invoice",
  arguments: {
    date: "Date",
    deadline: "Deadline",
  },
})
```

**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: "pennylane-create-customer-invoice",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pennylane: { authProvisionId: "apn_xxxxxxx" },
    date: "Date",
    deadline: "Deadline",
  },
})

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": "pennylane-create-customer-invoice",
    "configured_props": {
      "pennylane": { "authProvisionId": "apn_xxxxxxx" },
      "date": "Date",
      "deadline": "Deadline"
    }
  }'
```

---

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