SalesDogg

Getting started

Sign in, create a project, connect a provider and check a user's access, from the command line.

You need Node 20 or later. Nothing else to install: every command below runs the CLI with npx.

Prefer to let your coding agent do this? Paste the prompt from Set up with your agent instead.

1. Sign in

npx -y @salesdogg/cli login

This starts a device sign-in: the CLI prints a link and a short code, and opens the link if it can. Sign in (or create an account) in the browser and approve the code. New accounts confirm their e-mail address first. The session is saved in your user configuration, not in the project.

For scripts there is a non-interactive form: npx -y @salesdogg/cli login --email you@example.com --password '...', and npx -y @salesdogg/cli signup with the same flags to create an account.

2. Create a project

npx -y @salesdogg/cli init

init creates a project named after the current directory and appends its keys to ./.env:

SALESDOGG_API_URL=https://api.salesdogg.com
SALESDOGG_SECRET_KEY=sd_sk_...   # servers, agents, CI: full access to this project
SALESDOGG_PUBLIC_KEY=sd_pk_...   # safe to ship in apps

From here on, the CLI finds the secret key in .env on its own.

3. Try it with the simulator

The simulator creates sandbox purchases with no provider and nothing to configure. They go through the same path as real ones.

npx -y @salesdogg/cli simulator purchase --app-user-id user_1 --store-identifier pro_monthly --trial-days 14
#   note subscription.id and subscription.product_id in the output
npx -y @salesdogg/cli entitlements create --lookup-key pro --product-ids <product_id>
npx -y @salesdogg/cli customers entitlements user_1                              # "pro": true
npx -y @salesdogg/cli simulator advance <subscription_id> --action fail_payment   # billing_issue
npx -y @salesdogg/cli simulator advance <subscription_id> --action expire         # access removed

Actions: renew, cancel, uncancel, fail_payment, recover, pause, resume, expire, refund. Each call returns the events it produced. Real subscriptions cannot be changed through the simulator.

4. Connect a real provider

npx -y @salesdogg/cli apps create --provider stripe --credentials.secret_key "$STRIPE_SECRET_KEY"
npx -y @salesdogg/cli apps import-products <app_id>
npx -y @salesdogg/cli entitlements attach-products pro --product-ids <product_id>

The response includes webhook_url and webhook_instructions for the one manual step a provider may need. See Connect payment providers for Braintree, the App Store and Google Play.

5. Sell and check access

npx -y @salesdogg/cli checkout create --app-user-id user_1 --product-id <product_id> --success-url https://example.com/ok
npx -y @salesdogg/cli customers entitlements user_1

checkout create returns a Stripe-hosted checkout url attributed to user_1. In your backend, the same check is one call with the JavaScript SDK:

import { createClient } from "@salesdogg/sdk";

const sd = createClient({ apiKey: process.env.SALESDOGG_SECRET_KEY! });
if (await sd.hasEntitlement(user.id, "pro")) {
  // unlock
}

Next