このドキュメントは、Stripe決済設定 inspector (Phase 4) を1サイトに展開して動作確認するための手順をまとめたものです。
- Phase 1〜3 (v2.3.0) の動作確認が完了している
- WordPress 管理者権限がある
curlまたは WP-CLI が使える
includes/
├── inspectors/
│ ├── class-inspector-stripe.php ← 新規 (top-level)
│ └── stripe/ ← 新規ディレクトリ
│ ├── class-stripe-base.php ← 抽象基底クラス
│ ├── class-stripe-wc-gateway.php ← WC Stripe Gateway
│ ├── class-stripe-wc-vendors-connect.php ← WC Vendors Stripe Connect
│ ├── class-stripe-wp-full-stripe.php ← Themeisle版WP Full Stripe
│ ├── class-stripe-paypal-plugins.php ← PayPal両対応
│ ├── class-stripe-bankpay.php ← BankPay (Stripe非利用)
│ └── class-stripe-dispatcher.php
更新ファイル: wp-security-guard.php (Version: 2.4.0), class-site-inspector.php, class-inspect-rest-api.php, inspector-settings.php
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | jq .期待される応答(マッチングサイト・WP Full Stripe + BankPay 同居の例):
{
"success": true,
"data": {
"implementations": ["wp-full-stripe", "bankpay"],
"details": {
"wp-full-stripe": {
"implementation": "wp-full-stripe",
"version": "8.3.4",
"mode": "live",
"publishable_key_set": true,
"publishable_key_prefix": "pk_live_",
"secret_key_set": true,
"test_publishable_key_set": true,
"test_publishable_key_prefix": "pk_test_",
"test_secret_key_set": true,
"webhook_configured": true,
"currency": "JPY",
"settings_url": "...",
"custom": {
"option_name_used": "wpfs-options",
"addon_members_active": true,
"detected_keys": ["live_publishable_key", "live_secret_key", "..."]
}
},
"bankpay": {
"implementation": "bankpay",
"version": "2.0.2",
"mode": "configured",
"publishable_key_set": false,
"currency": "JPY",
"custom": {
"payment_method": "bank_transfer",
"all_account_info_set": true
}
}
},
"mode_consistency": {
"consistent": true,
"modes": {"wp-full-stripe": "live"},
"warning": null
},
"summary": {
"implementations_count": 2,
"live_implementations": 1,
"test_implementations": 0,
"configured_only": 1,
"missing_keys_count": 0,
"webhooks_configured": 1
}
},
"warnings": []
}以下のフィールドが応答に含まれないことを確認:
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | \
grep -i -E "(sk_live|sk_test|secret_key.*:.*sk|account_number.*:.*[0-9]|webhook_secret.*:.*whsec)"期待される結果: 何も出力されない
応答に含まれるのは:
publishable_key_prefix: 先頭8文字のみ (例:pk_live_)secret_key_set: bool のみwebhook_configured: bool のみconnect_application_id_prefix: 先頭8文字のみaccount_number_set: bool のみ (BankPay)
WooCommerce + 公式 Stripe Gateway が有効なサイト:
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | \
jq '.data.details["wc-stripe-gateway"]'確認項目:
versionがプラグインのバージョンと一致enabledが WC設定 → 決済 → Stripe で有効になっているかmodeがtestmode設定と整合- 設定モードに応じた鍵セットの整合性
webhook_configuredで現在モードのWebhook設定有無
重要: WP Full Stripe (Themeisle版) のStripe鍵保存先オプション名は実機未確認です。
Phase 4では8候補のオプション名を順に試行し、見つかったものをcustom.option_name_usedで返します。
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | \
jq '.data.details["wp-full-stripe"].custom'確認すべき項目:
option_name_used: どのオプション名で見つかったか (8候補の中から1つ)detected_keys: そのオプション内のキー一覧 (デバッグ用)
設定が見つからなかった場合:
{
"warnings": [{
"level": "warning",
"code": "wp_full_stripe_options_not_found",
"message": "WP Full Stripeの設定オプションが見つかりませんでした..."
}]
}WP-CLIで実機確認:
wp option list --search="*Stripe*" --format=table | head -20
wp option list --search="*fullstripe*" --format=table | head -20
wp option list --search="*wpfs*" --format=table | head -20実機調査結果が判明したら、OPTION_CANDIDATES 定数を確定値のみに整理する。
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | \
jq '.data.details["wc-vendors-stripe-connect"]'確認項目:
connect_application_id_set(Connect Application ID は機微情報なので先頭8文字のみ返す)commission_rate(ベンダー手数料率)
公式 woocommerce-paypal-payments と Payment Plugins for PayPal の両方に対応:
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | \
jq '.data.details["paypal-plugins"]'custom.plugin_used でどちらが使われているかを判別:
"woocommerce-paypal-payments"→ 公式"pymntpls-paypal-woocommerce"→ Payment Plugins製
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | \
jq '.data.details["bankpay"]'確認項目:
modeがconfiguredかunconfiguredcustom.account_name_set,account_number_set,bank_name_set,branch_name_setの各 bool- 振込先口座の中身が含まれていないこと (重要)
部分的にしか設定されていない場合、bankpay_account_partial warning が出ること。
複数の決済実装が同居している場合、本番モード/テストモードが一致していることを確認:
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/stripe | \
jq '.data.mode_consistency'期待される応答 (一致時):
{
"consistent": true,
"modes": {"wc-stripe-gateway": "live", "wp-full-stripe": "live"},
"warning": null
}不一致時 (例: WC Stripe が Live、WP Full Stripe が Test):
{
"consistent": false,
"modes": {"wc-stripe-gateway": "live", "wp-full-stripe": "test"},
"warning": "複数の決済実装でモードが不一致"
}加えて warnings に以下が含まれる:
{
"level": "warning",
"code": "stripe_mode_inconsistent",
"message": "複数の決済実装でモード(本番/テスト)が一致していません",
"details": {"modes": {...}}
}設定されているモードに対して鍵が不足している場合の警告:
| 実装 | モード | 期待される鍵 | 不足時の警告コード |
|---|---|---|---|
| WC Stripe Gateway | live | publishable_key, secret_key | wc_stripe_live_keys_missing |
| WC Stripe Gateway | test | test_publishable_key, test_secret_key | wc_stripe_test_keys_missing |
| WP Full Stripe | live | live_publishable_key, live_secret_key | wp_full_stripe_live_keys_missing (notice) |
| WP Full Stripe | test | test_publishable_key, test_secret_key | wp_full_stripe_test_keys_missing |
curl -H "Authorization: Bearer <TOKEN>" \
<URL>/wp-json/wpsg/v1/inspect/all | jq '.data | keys'期待される応答:
[
"core",
"features",
"membership",
"plugins",
"stripe",
"theme"
]stripe キーが追加されていることを確認。
- バージョンが 2.4.0 になっている
- Phase 1〜3 の機能が引き続き動作する
-
/inspect/stripeエンドポイントが応答する -
/inspect/allのレスポンスにdata.stripeが含まれる - 管理画面のエンドポイント一覧に
/stripeが追加されている
-
secret_key,sk_live_*,sk_test_*が応答に一切含まれない -
webhook_secretが応答に一切含まれない (boolのみ) - BankPay の
account_numberなどの中身が応答に一切含まれない -
publishable_key_prefixは先頭8文字のみ
- testmode 切替で
modeが変わる - 鍵不足時に
wc_stripe_*_keys_missingwarning が出る
-
option_name_usedで見つかったオプション名が報告される -
detected_keysでオプション内のキー一覧が見える - オプションが見つからない場合
wp_full_stripe_options_not_foundwarning
- 複数実装で同一モード時は
consistent: true - 不一致時は
consistent: false+stripe_mode_inconsistentwarning
- 1つの inspector が壊れても他は動作継続
- 壊れた inspector の警告は
stripe_inspector_exceptionで記録
| 症状 | 対処 |
|---|---|
WP Full Stripe の option_name_used が null |
8候補すべてに合致しなかった。WP-CLI で wp option list を実行し、OPTION_CANDIDATES 定数を更新。応答の tried_options フィールドで何を試したか確認可 |
WC Stripe で mode が "unknown" |
woocommerce_stripe_settings オプションが空。プラグインを一度設定し直すか、手動でDB確認 |
BankPay の mode が "unconfigured" だが実際は使えている |
bkp_op_account_* の4つすべて設定されていることが必要。一部だけ設定の場合は bankpay_account_partial warning が出る |
Phase 4 が問題なく動作したら、Phase 5 (Python チェックランナー & Streamlit ダッシュボード) に進みます。
WP-CLIでの調査結果をいただければ、WPSG_Stripe_WP_Full_Stripe::OPTION_CANDIDATES を確定値1つに絞り込み、コードを簡潔化できます (現在は8候補を順次試行)。