# add

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

> Add saves a new Payment Source for a Customer through Stripe’s embedded form on the Startup’s Domain, and can make it the default.

Add saves a new [Payment Source](/business/nouns/payment-source) for a [Customer](/business/nouns/customer) through Stripe’s embedded form on the [Startup](/business/nouns/startup)’s [Domain](/business/nouns/domain), and can make it the default.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `customer` | [Customer](/business/nouns/customer) | Yes | The Customer who saves it. |
| `kind` | `string` | Yes | How it pays; the form offers only the kinds the Customer’s Market accepts. |
| `default` | `boolean` | No | True to charge it for every new Invoice and renewal. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `paymentSource` | [Payment Source](/business/nouns/payment-source) | Yes | The saved Payment Source; Stripe holds its details. |

## Effects
- Emits [`PaymentSource.added`](/business/events/PaymentSource.added).
- Performed by the [Billing Specialist](/agents/finance/billing-specialist).
- Two-way: it runs at once, in the `try`, `send` and `do` modes.
- Collects the details in Stripe’s embedded form, so the Startup never holds a card or account number.
- As the new default, charges each open `charge` Invoice that failed at once, ahead of the next dunning retry.

## 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.add](/business/nouns/payment-source/add) |

## 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
Add the latest payment source with a customer.
```

**API**

```bash
curl -X POST https://api.sb/petpantry.shop/payment-sources/add \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customer":"customer_1","kind":"card"}'
```

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

**SDK**

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

const paymentSource = await $.PaymentSource.add({ customer: 'customer_1', kind: 'card' })
```

**CLI**

```bash
npx startup-builder do PaymentSource.add --json '{"customer":"customer_1","kind":"card"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.PaymentSource.add({ customer: 'customer_1', kind: 'card' })"
  }
}
```