# Create Billing Subscription — Pennylane

> Creates a billing subscription for a customer. See the documentation.

- Key: `pennylane-create-billing-subscription`
- 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-billing-subscription
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pennylane/actions/create-billing-subscription/create-billing-subscription.mjs

## Description

Creates a billing subscription for a customer. [See the documentation](https://pennylane.readme.io/reference/billing_subscriptions-post-1).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `currency` | `string` | No | Invoice Currency (ISO 4217). Default is EUR. |
| `mode` | `string` | Yes | Mode in which the new invoices will be created. |
| `start` | `string` | Yes | Start date (ISO 8601) |
| `paymentConditions` | `string` | Yes | Customer payment conditions |
| `paymentMethod` | `string` | Yes | PaymentMethod |
| `recurringRuleType` | `string` | Yes | Type of the billing subscription's recurrence |
| `dayOfMonth` | `integer` | Yes | The day of occurrences of the recurring rule |
| `dayOfWeek` | `string` | Yes | The day of occurrences of the recurring rule |
| `interval` | `string` | No | The interval of occurrences of the recurring rule |
| `count` | `integer` | No | Number of occurrences of the recurring rule |
| `specialMention` | `string` | No | Additional details |
| `discount` | `integer` | No | Invoice discount (in percent) |
| `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. |
| `invoiceLines` | `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. |

## 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-billing-subscription",
  arguments: {
    currency: "Currency",
    mode: "Mode",
  },
})
```

**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-billing-subscription",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pennylane: { authProvisionId: "apn_xxxxxxx" },
    currency: "Currency",
    mode: "Mode",
  },
})

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-billing-subscription",
    "configured_props": {
      "pennylane": { "authProvisionId": "apn_xxxxxxx" },
      "currency": "Currency",
      "mode": "Mode"
    }
  }'
```

---

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