# remove

URL: /business/nouns/payment-source/remove · Id: `verb:PaymentSource.remove` · Call: `await $.PaymentSource.remove({ … })` (SDK) or the `do` tool at `https://api.sb/mcp`. Inputs says what to pass, Outputs what returns, When it waits who approves.

> Remove detaches a saved Payment Source so nothing charges it again, and keeps the record.

Remove detaches a saved [Payment Source](/business/nouns/payment-source) so nothing charges it again, and keeps the record.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `paymentSource` | [Payment Source](/business/nouns/payment-source) | Yes | The saved Payment Source. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `paymentSource` | [Payment Source](/business/nouns/payment-source) | Yes | The removed Payment Source, kept on record. |

## Effects
- Emits [`PaymentSource.removed`](/business/events/PaymentSource.removed).
- Performed by the [Billing Specialist](/agents/finance/billing-specialist).
- Two-way: it runs at once, in the `try`, `send` and `do` modes.
- When it was the default, the most recently added remaining Payment Source becomes the default.
- With none left, the next `charge` Invoice fails into dunning, and the Customer is asked to add one.

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | [PaymentSource.remove](/business/nouns/payment-source/remove) |

## When it waits
| Gate | Default |
| --- | --- |
| Decision class | Low: two-way, nothing at stake |
| [Delay window](/systems/trust-and-governance/controls/one-way-windows) | None: it runs once review passes. |
| Limit | The call [Limit](/business/nouns/limit) of the [Permission](/business/nouns/permission) it runs under. |
| Over the Limit | It waits `pending` for an [Approval](/business/nouns/approval) from the [Founder](/agents/founding/founder). Approved, it runs; refused, it ends `refused` with [`limit-exceeded`](/code/api/errors/limit-exceeded); unanswered by its deadline, it ends `canceled`. |

## Example

**Ask**

```text
Remove the latest payment source.
```

**API**

```bash
curl -X POST https://api.sb/ledgerlark.com/payment-sources/payment_source_1/remove \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/ledgerlark.com",
  "paymentSource": {
    "$id": "https://api.sb/ledgerlark.com/payment-sources/payment_source_1",
    "$type": "PaymentSource",
    "kind": "card",
    "label": "Visa 4242"
  },
  "action": {
    "$id": "https://api.sb/ledgerlark.com/actions/action_1",
    "operation": "PaymentSource.remove",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/ledgerlark.com/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const paymentSource = await $.PaymentSource.remove({ paymentSource: 'payment_source_1' })
```

**CLI**

```bash
npx startup-builder do PaymentSource.remove --json '{"paymentSource":"payment_source_1"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.PaymentSource.remove({ paymentSource: 'payment_source_1' })"
  }
}
```