# Set up SalesDogg from your coding agent

> Paste one prompt into Claude Code, Codex, Cursor or any agent that runs commands. It signs in, creates a project, connects your payment provider and proves the setup with the simulator. You approve the sign-in once.

## The prompt

```text
Set up SalesDogg (subscriptions and in-app purchases) in this project.

1. Read https://salesdogg.com/llms.txt to learn the product, then https://salesdogg.com/docs/getting-started.md.
2. Run `npx -y @salesdogg/cli login`. It prints a link and a code: show them to me and wait while I approve.
3. Run `npx -y @salesdogg/cli init` to create a project. It writes SALESDOGG_SECRET_KEY and SALESDOGG_PUBLIC_KEY to .env; never print the secret key.
4. Ask me which provider we use (Stripe, Braintree, App Store or Google Play) and connect it with `npx -y @salesdogg/cli apps create`. Read provider keys from .env rather than asking me to paste them. Then import its products.
5. Create an entitlement for the paid features and prove it works with the simulator (`npx -y @salesdogg/cli simulator purchase`) before any real payment.
6. Add the access check and a webhook handler to our code with @salesdogg/sdk.
7. When I'm ready to go live, connect the live keys. The Free plan is sandbox only: if SalesDogg answers with error.type "payment_required", show me error.details.upgrade_url (a link to choose a plan and pay), wait until I say I've paid, then run the same command again.

Every command prints JSON. If one fails, read error.hint and follow it.
```

## What the agent does

1. **Sign in** (needs a person). The CLI starts a device sign-in and prints a link and a short code. You open the link, sign in or create an account, and approve the code. New accounts confirm their e-mail address first. The agent never sees your password.

```sh
npx -y @salesdogg/cli login
```

2. **Create a project**. Creates the project and its keys and appends SALESDOGG_API_URL, SALESDOGG_SECRET_KEY and SALESDOGG_PUBLIC_KEY to ./.env.

```sh
npx -y @salesdogg/cli init
```

3. **Turn on payments**. Connects your provider. For Stripe that is a secret key (start with a test-mode key); SalesDogg registers the webhook itself when the API is public. The response lists any manual step, such as pasting a notification URL into App Store Connect.

```sh
npx -y @salesdogg/cli apps create --provider stripe --credentials.secret_key "$STRIPE_SECRET_KEY"
```

4. **Import products and define access**. Pulls the provider's products and attaches the paid ones to an entitlement.

```sh
npx -y @salesdogg/cli apps import-products <app_id>
npx -y @salesdogg/cli entitlements create --lookup-key pro --product-ids <product_id>
```

5. **Prove it with the simulator**. Buys, renews, fails a payment and expires a sandbox subscription, checking access at each step, with no real charge.

```sh
npx -y @salesdogg/cli simulator purchase --app-user-id test_user --product-id <product_id>
npx -y @salesdogg/cli customers entitlements test_user
```

6. **Go live** (needs a person). When you're ready for real payments, the agent connects your live keys. On the Free plan SalesDogg answers with a link to choose a plan and pay, ready to use with no sign-in. The agent shows it to you; once you've paid, it runs the same command again.

```sh
npx -y @salesdogg/cli billing get
```

7. **Wire it into your code**. Adds the access check where paid features live, a checkout link or the mobile SDK for buying, and a webhook endpoint that verifies the SalesDogg-Signature header.

```sh
npx -y @salesdogg/cli webhooks create --url https://example.com/webhooks/salesdogg
```

## MCP server setup

`npx -y @salesdogg/cli mcp` serves every API operation as a tool over stdio. It needs no key in the config: after `login` and `init` it uses the saved sign-in, or SALESDOGG_API_KEY from its environment.

### Claude Code

Terminal:

```sh
claude mcp add salesdogg -- npx -y @salesdogg/cli mcp
```

Add --scope project to share it with your team through .mcp.json.

### OpenAI Codex

Terminal:

```sh
codex mcp add salesdogg -- npx -y @salesdogg/cli mcp
```

Or add [mcp_servers.salesdogg] with command = "npx" and args = ["-y", "@salesdogg/cli", "mcp"] to ~/.codex/config.toml.

### Cursor

.cursor/mcp.json:

```json
{
  "mcpServers": {
    "salesdogg": {
      "command": "npx",
      "args": [
        "-y",
        "@salesdogg/cli",
        "mcp"
      ]
    }
  }
}
```

### VS Code (GitHub Copilot)

.vscode/mcp.json:

```json
{
  "servers": {
    "salesdogg": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@salesdogg/cli",
        "mcp"
      ]
    }
  }
}
```

### Windsurf

~/.codeium/windsurf/mcp_config.json:

```json
{
  "mcpServers": {
    "salesdogg": {
      "command": "npx",
      "args": [
        "-y",
        "@salesdogg/cli",
        "mcp"
      ]
    }
  }
}
```

### Gemini CLI

~/.gemini/settings.json:

```json
{
  "mcpServers": {
    "salesdogg": {
      "command": "npx",
      "args": [
        "-y",
        "@salesdogg/cli",
        "mcp"
      ]
    }
  }
}
```

### Claude Desktop

claude_desktop_config.json:

```json
{
  "mcpServers": {
    "salesdogg": {
      "command": "npx",
      "args": [
        "-y",
        "@salesdogg/cli",
        "mcp"
      ]
    }
  }
}
```

Claude Desktop cannot run the sign-in itself: run `npx -y @salesdogg/cli login` and `npx -y @salesdogg/cli init` in a terminal first.

## Machine-readable resources

- [/llms.txt](https://salesdogg.com/llms.txt): Index of the site for language models, with a link to every page's markdown.
- [/llms-full.txt](https://salesdogg.com/llms-full.txt): The whole site, docs and API reference included, in one markdown file.
- [/openapi.json](https://salesdogg.com/openapi.json): The OpenAPI 3.1 document the API, CLI and MCP server are all generated from.
- [/docs/api.md](https://salesdogg.com/docs/api.md): Every endpoint with its CLI command, MCP tool, credentials and parameters.
- [salesdogg commands](https://salesdogg.com/docs/cli): Prints every CLI command and its parameters as JSON.
