# Create Payment — Xero Accounting

> Creates a new payment

- Key: `xero_accounting_api-create-payment`
- Type: Action (Write)
- Version: 0.1.5
- App: Xero Accounting (`xero_accounting_api`) — https://pipedream.com/apps/xero-accounting-api.md
- This page (HTML): https://pipedream.com/apps/xero-accounting-api/actions/create-payment
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/xero_accounting_api/actions/create-payment/create-payment.mjs

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `tenantId` | `string` | Yes | Select an organization tenant to use, or provide a tenant ID Options are loaded from the connected account. |
| `accountId` | `string` | No | ID of account you are using to make the payment e.g. 294b1dc5-cc47-2afc-7ec8-64990b8761b8. This account needs to be either an account of type BANK or have enable payments to this accounts switched on (see GET Accounts) . See the edit account screen of your Chart of Accounts in Xero if you wish to enable payments for an account other than a bank account |
| `accountCode` | `string` | No | Code of account you are using to make the payment e.g. 001 ( note: not all accounts have a code value) |
| `invoiceId` | `string` | No | ID of the invoice you are applying payment to e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
| `creditNoteId` | `string` | No | ID of the credit note you are applying payment to e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
| `prepaymentId` | `string` | No | ID of the prepayment you are applying payment to e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
| `overpaymentId` | `string` | No | ID of the overpayment you are applying payment to e.g. 297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
| `invoiceNumber` | `string` | No | Number of invoice you are applying payment to e.g. INV-4003 |
| `creditNoteNumber` | `string` | No | Number of credit note you are applying payment to e.g. INV-4003 |
| `date` | `string` | No | Date the payment is being made (YYYY-MM-DD) e.g. 2009-09-06 |
| `currencyRate` | `string` | No | Exchange rate when payment is received. Only used for non base currency invoices and credit notes e.g. 0.7500 |
| `amount` | `string` | No | The amount of the payment. Must be less than or equal to the outstanding amount owing on the invoice e.g. 200.00 |
| `reference` | `string` | No | An optional description for the payment e.g. Direct Debit |
| `isReconciled` | `boolean` | No | A boolean indicating whether the payment has been reconciled. |
| `status` | `string` | No | The status of the payment. |

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

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: "xero_accounting_api-create-payment",
  arguments: {
    tenantId: "Tenant ID",
    accountId: "Account ID",
  },
})
```

**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: "xero_accounting_api-create-payment",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    xero_accounting_api: { authProvisionId: "apn_xxxxxxx" },
    tenantId: "Tenant ID",
    accountId: "Account ID",
  },
})

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": "xero_accounting_api-create-payment",
    "configured_props": {
      "xero_accounting_api": { "authProvisionId": "apn_xxxxxxx" },
      "tenantId": "Tenant ID",
      "accountId": "Account ID"
    }
  }'
```

---

- App: https://pipedream.com/apps/xero-accounting-api.md · All apps: https://pipedream.com/apps
