Skip to content

Local Smoke Testing

This project should be smoke-tested against the local WooPayments development site at http://localhost:8082 when available.

Create a temporary WooCommerce REST API key

From /Users/mal/projects/wcpay:

bash
docker compose exec -T wordpress bash -lc 'cd /var/www/html && wp eval '\''global $wpdb; $user_id = 1; $consumer_key = "ck_" . wc_rand_hash(); $consumer_secret = "cs_" . wc_rand_hash(); $wpdb->insert( $wpdb->prefix . "woocommerce_api_keys", array( "user_id" => $user_id, "description" => "wcpay-cli smoke test " . gmdate("c"), "permissions" => "read_write", "consumer_key" => wc_api_hash( $consumer_key ), "consumer_secret" => $consumer_secret, "truncated_key" => substr( $consumer_key, -7 ) ), array( "%d", "%s", "%s", "%s", "%s", "%s" ) ); echo wp_json_encode( array( "key_id" => $wpdb->insert_id, "consumer_key" => $consumer_key, "consumer_secret" => $consumer_secret ) );'\'' --allow-root'

Delete it afterwards:

bash
docker compose exec -T wordpress bash -lc 'cd /var/www/html && wp eval '\''global $wpdb; $wpdb->delete( $wpdb->prefix . "woocommerce_api_keys", array( "key_id" => YOUR_KEY_ID ), array( "%d" ) );'\'' --allow-root'

Smoke commands

From /Users/mal/projects/wcpay-cli:

bash
npm run build
TMP_WCPAY_HOME=$(mktemp -d)
WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 \
  node dist/cli.js login \
  --site http://localhost:8082 \
  --consumer-key ck_... \
  --consumer-secret cs_... \
  --json

WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 node dist/cli.js auth list --json
WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 node dist/cli.js doctor --json
WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 node dist/cli.js mode --json
WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 node dist/cli.js account status --json
WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 node dist/cli.js settings get --json
WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 node dist/cli.js refunds create --order 123 --amount 500 --dry-run --json
WCPAY_HOME=$TMP_WCPAY_HOME WCPAY_KEYRING=0 node dist/cli.js test order create --product 123 --quantity 1 --dry-run --json

2026-06-11 result

Validated the 0.2.4 release branch against the local WooPayments site (dev mode, connected test account), using a temporary read/write key and an isolated WCPAY_HOME:

  • doctor passed 7/7 checks; mode returned dev.
  • transactions list rendered live data with currency-formatted amounts (£125.00, -£30.00); transactions summary, disputes summary, deposits overview, and authorizations list/summary all returned live data.
  • orders get surfaced _intent_id, _charge_id, and _wcpay_mode from order meta.
  • --verbose printed redacted request/response lines; consumer key and OAuth signature redacted.
  • refunds create --dry-run and disputes close --dry-run passed the dev-mode guard and printed redacted requests without sending.
  • Exit codes observed live: 2 (missing --yes/--dry-run, --all with --page, unsupported completion shell), 3 (invalid consumer key), 4 (API errors and --timeout 1 against an unreachable host).
  • WCPAY_SITE_URL/WCPAY_CONSUMER_KEY/WCPAY_CONSUMER_SECRET env auth worked with no stored profile.
  • MCP over stdio reported the package version, listed all 16 tools, and wcpay_get_mode returned live data.
  • Note: timeline get and payment-intents get could only be plumbing-checked — the local platform server fixtures only seed the transactions list, so intent lookups 404 (as does the pre-existing charges get on fixture IDs).

2026-05-22 result

Validated successfully against the local WooPayments site with a connected test/dev account:

  • Created a temporary WooCommerce REST API key and deleted it after testing.
  • wcpay login --json with explicit credentials worked against http://localhost:8082.
  • wcpay auth list --json returned the temporary profile.
  • wcpay doctor --json passed profile, site URL, auth, and mode checks.
  • wcpay mode --json returned dev mode with is_test_mode_enabled, is_test_mode_onboarding, and is_dev_mode_enabled all true.
  • wcpay account status --json returned a connected test account.
  • wcpay settings get --json returned WooPayments settings successfully.
  • wcpay refunds create --dry-run --json passed the test/dev-mode guard and printed a redacted POST request without sending it.
  • wcpay test order create --dry-run --json passed the test/dev-mode guard and printed a redacted POST request without sending it.
  • wcpay mcp --help printed the MCP command help.

2026-05-21 result

Validated successfully against the local WooPayments site:

  • wcpay login with explicit credentials worked.
  • HTTP local OAuth signing worked.
  • wcpay mode --json returned dev mode with is_test_mode_enabled, is_test_mode_onboarding, and is_dev_mode_enabled all true.
  • wcpay account status --json returned successfully with data: false for the current disconnected/local account state.
  • wcpay refunds create --dry-run --json passed the test/dev-mode guard and printed a redacted POST request without sending it.
  • wcpay test order create --dry-run --json passed the test/dev-mode guard and printed a redacted POST request without sending it.

Released under the GPL-3.0-or-later license.