# Create Payment — Invoiced

> Creates a new payment in Invoiced. See the documentation

- Key: `invoiced-create-payment`
- Type: Action (Write)
- Version: 0.0.1
- App: Invoiced (`invoiced`) — https://pipedream.com/apps/invoiced.md
- This page (HTML): https://pipedream.com/apps/invoiced/actions/create-payment
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/invoiced/actions/create-payment/create-payment.mjs

## Description

Creates a new payment in Invoiced. [See the documentation](https://developer.invoiced.com/api/payments#create-a-payment)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `customerId` | `string` | No | The ID of the customer Options are loaded from the connected account. |
| `date` | `string` | No | Payment datetime, defaults to current timestamp. Format YYYY-MM-DDTHH:MM:SSZ. |
| `method` | `string` | No | Payment instrument used, defaults to other |
| `currency` | `string` | No | 3-letter ISO code |
| `amount` | `string` | Yes | Payment amount. Example: 100.00 |
| `reference` | `string` | No | Reference number, i.e. check # |
| `achSenderId` | `string` | No | Originator ID (ACH payments) |
| `source` | `string` | No | Source of the payment, defaults to keyed |
| `notes` | `string` | No | Internal notes |
| `appliedTo` | `string[]` | No | JSON array of payment applications. Each application should have: type (invoice, credit_note, etc.), invoice (or credit_note ID), amount. Example: [{"type":"invoice","invoice":"44648","amount":800}] See the documentation for more details. |

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

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: "invoiced-create-payment",
  arguments: {
    customerId: "Customer ID",
    date: "Date",
  },
})
```

**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: "invoiced-create-payment",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    invoiced: { authProvisionId: "apn_xxxxxxx" },
    customerId: "Customer ID",
    date: "Date",
  },
})

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": "invoiced-create-payment",
    "configured_props": {
      "invoiced": { "authProvisionId": "apn_xxxxxxx" },
      "customerId": "Customer ID",
      "date": "Date"
    }
  }'
```

---

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