Split payment POC: testing and verification guide
This guide walks you through verifying that every component works correctly, in the order they should be tested. Start from the bottom (Commerce module) and work up (App Builder).
Step 1 — Verify Commerce Module Installation
bin/magento setup:upgradeおよびbin/magento setup:di:compileの実行後:
# Confirm module is enabled
bin/magento module:status Client_SplitPayment
# Confirm db_schema columns were added
bin/magento doctrine:schema:validate
# or check directly:
mysql -u <user> -p <dbname> -e "DESCRIBE sales_order;" | grep split
Expected output: four columns starting with split_ visible in sales_order.
Step 2 — Verify Commerce Admin Configuration
In Commerce Admin:
- Stores > Configuration > Sales > Payment Methods — Cash On Deliveryがタイトル
Cashで有効になっていることを確認します - Stores > Configuration > Customers > Customer Configuration > Store Credit Options – 有効化を確認
- Confirm your test customer has store credit: Customers > All Customers > [customer] > Store Credit
Step 3 — Verify REST Endpoints Are Accessible
Use curl to confirm the endpoints respond (they will reject unauthorized requests, but a 401 confirms they’re routed correctly):
# Should return 401 (not 404) — endpoint exists but requires auth
curl -X POST https://your-store.example.com/rest/V1/split-payment/orders/1/cash-received
# Should return 200 or session-based response — anonymous endpoint
curl -X POST https://your-store.example.com/rest/V1/split-payment/set \
-H "Content-Type: application/json" \
-d '{"storeCreditAmount": 0, "cashAmount": 0}'
Step 4 — Test the Checkout UI
-
Log in to the storefront as your test customer (who has store credit)
-
商品をカートに追加する(送料+税込み後の合計が100 ドル未満)
-
Proceed to checkout
-
At the payment step, select Cash (or Cash On Delivery)
-
Verify the split payment fields appear:
- Your store credit balance shown
- Cash amount field pre-filled with the order total
- “Store credit toward this order” field showing $0.00 (since cash = full order total)
-
Reduce the cash amount (e.g., enter $10 for a $50 order)
-
ストアのクレジット部分が$40.00に更新されていることを確認します。
-
メッセージが表示されることを確認します:
"The remaining $40.00 will automatically be applied from your store credit."
テスト検証:
- 注文合計を超える金額を入力する→のエラーメッセージ
- 使用可能な店舗クレジットよりも多くの店舗クレジットが必要な現金金額→入力してください
- Enter cash = 0 → error (またはストアクレジットは注文全体をカバー)
ステップ 5 - テストしきい値ガード
- 合計$100以上の商品を追加(小計+送料+税> $100)
- チェックアウトに進み、Cashを選択します
- 注文を試みます
- エラーメッセージが表示されることを確認します:
"Payment could not be processed. Please try again or contact support." - カートが保持されていることを確認します(お客様は引き続きカートを調整し、再試行できます)
ステップ 6 - テスト分割支払い注文を行う
- 100 ドル未満でカートを作成(店舗のクレジットを使用して顧客にログイン)
- チェックアウト時に現金を選択
- 注文総額より少ない金額(例:$45の注文の$10)を入力します。
- 店舗のクレジットメッセージが表示されることを確認します
- 注文を配置をクリックします
注文後、Commerce Adminで次の項目を確認します。
-
注文のステータスは
pending_payment -
注文には、次の2つの履歴コメントがあります。
"Cash payment of $X.XX pending. Awaiting admin confirmation."(App Builderpayment-orchestratorから)"Split payment orchestration completed. Order awaiting cash confirmation."(App Builderから)
-
分割支払い金額は、注文支払いブロックに表示されます
App Builder コメントが表示されない場合: App Builderのアクションログを
aio app logsで確認します。 イベントが起動しなかったか、アクションにエラーがある可能性があります。
ステップ 7 - シミュレーションスクリプトを使用したテスト受け入れ
シミュレーションスクリプトは、オペレーターUIを完全に使用せずに承認/拒否フローをテストする最も高速な方法です。
cd commerce-checkout-starter-kit
cp commerce-backend-ui-1/.env.simulation.example commerce-backend-ui-1/.env.simulation
# Edit .env.simulation with your credentials
# List recent orders (find your test order entity_id)
node commerce-backend-ui-1/scripts/simulate-split-payment.mjs list
# Show split payment fields for a specific order
node commerce-backend-ui-1/scripts/simulate-split-payment.mjs show 42
# Accept the cash payment
node commerce-backend-ui-1/scripts/simulate-split-payment.mjs accept 42
承認したら、Commerce管理者注文ビューで確認します。
- 注文ステータスは
processingです - 履歴コメント:
"Cash payment of $X.XX received." - 作成された現金請求書(請求書タブに表示)
- 配送が作成されました(該当する場合、「出荷」タブに表示)
- 履歴コメント:
"Split payment: cash portion invoiced #XXXXXXXX." - 履歴コメント:
"Split payment: shipment created after cash was accepted (App Builder / API)."
ステップ 8 - シミュレーションスクリプトを使用したテスト拒否
別のテスト注文(ステップ 6と同じ設定)を行ってから:
node commerce-backend-ui-1/scripts/simulate-split-payment.mjs decline <orderId>
辞退後、Commerce管理者で次の項目を確認します。
- 注文ステータスは
canceledです - 履歴コメント:
"Cash payment declined (simulated fraud check)." split_cash_status=declined
ステップ 9 - デモダッシュボードをテストする
split-payment-orchestratorをデプロイした後、aio app deployはアクション URLを印刷します。
ブラウザーでdemo-dashboard URLを開きます:
https://[runtime-host]/api/v1/web/split_payment_orchestrator/demo-dashboard
DEMO_UI_SECRETが設定されている場合:
https://[runtime-host]/api/v1/web/split_payment_orchestrator/demo-dashboard?secret=<your-secret>
保留中の注文の場合:
- ダッシュボードには、保留中のリストに順序が表示されます
- 承諾をクリック→ると、注文はCommerceの
processingに移動します - 別の注文を行います。「辞退」をクリック→、Commerceで
canceledの注文を行う必要があります
ステップ 10 - App Builder アクションログのテスト
# Follow logs in real-time
aio app logs --tail
# Or view last invocations
aio runtime activation list --limit 10
aio runtime activation logs <activation-id>
payment-orchestratorの場合、次を探します。
[INFO] Split payment orchestration finished { orderId: '42' }
payment-acceptまたはpayment-declineについて:
[INFO] Cash payment accepted on Commerce via REST { orderId: '42' }
一般的な問題と修正
Commerce OAuthの「署名が無効です」
原因: App Builder ランタイムとCommerceの間のクロックスキュー、またはOAuth署名バグ。
修正:
COMMERCE_BASE_URLの末尾にスラッシュがないことを確認してください- 4つのOAuth資格情報が ACTIVATED 統合用であることを確認してください
- 最初にシミュレーションスクリプトでテストします。スクリプトが機能するが、App Builderが機能しない場合は、環境変数が読み込まれていない可能性があります(環境の変数が見つからない場合は、
aio app deploy出力を確認してください)
チェックアウト時に分割支払いフィールドが表示されない
原因: LayoutProcessorPlugin インジェクション パスがチェックアウト レイアウトと一致しません。
修正:
Client_SplitPayment/js/view/payment/split-paymentの読み込み中にRequireJS エラーが発生していないか、ブラウザーコンソールを確認してくださいbin/magento setup:static-content:deployの確認が正常に完了しました- フラッシュ キャッシュ:
bin/magento cache:flush - テーマにカスタムチェックアウトがある場合、コンポーネントを挿入するための
LayoutProcessorPluginパスを調整する必要がある場合があります
ストアクレジットが適用されない/「支払いを処理できませんでした」プレースオーダー
原因:通常、エッジ ケース プラグインのいずれかが正しく機能しません。
確認:
SplitPaymentSessionは正しい金額を返していますか?PlaceOrderPluginに一時的なデバッグログを追加BalanceManagementInterface::apply()が呼び出される前に、FixSplitPaymentGrandTotalPluginが実行中で見積もり合計に影響を与えていますか?beginBalanceApply()フラグはそれを抑制する必要があります。- Commerceでカスタマーバランスモジュールが有効になっていますか?
App Builder アクションはイベントを受け取りますが、orderIdがありません
原因: io_events.xml フィールドリストにentity_idが含まれていないか、イベントペイロードの形状が変更されています。
Fix:
- Confirm
io_events.xmlincludesentity_idin the field list - In the action, log
JSON.stringify(params)temporarily to see the full payload shape - Check that the
extractValue()function is finding the right nesting level
Orders don’t show in demo dashboard
Cause: Commerce REST orders search criteria not returning orders, or split_cash_status field not in the REST response.
Fix:
- Confirm
OrderRepositoryPluginis loading extension attributes correctly - Test directly:
GET /rest/V1/orders?searchCriteria[pageSize]=5and check ifextension_attributes.split_cash_statusappears in the response - Check that
extension_attributes.xmlis correctly declaring thesplit_cash_statusattribute onOrderInterface
Verification Checklist
- [ ]
split_*columns visible insales_ordertable - [ ] REST endpoints return 401 (not 404) when called without auth
- [ ] Split payment UI renders at checkout when Cash is selected
- [ ] Validation messages work (overpayment, insufficient credit)
- [ ] Threshold guard blocks orders > $100
- [ ] Placed order has
pending_paymentstatus and App Builder comments - [ ]
simulate-split-payment.mjs listshows the test order with split amounts - [ ]
simulate-split-payment.mjs accept <id>moves order toprocessingwith invoice and shipment - [ ]
simulate-split-payment.mjs decline <id>cancels the order - [ ] Demo dashboard lists pending orders and accept/decline work from the UI
関連する分割支払POC リソース
- 分割支払いPOCの構築:App BuilderとAI ツール
- 分割払いPOCの作成:App Builderの完全デモ
- 分割払いPOC:アーキテクチャとデザインの決定
- 分割払いPOC:前提条件と環境の設定
- 分割支払POC:環境変数リファレンス
- 分割支払いPOC: Commerce モジュール AI プロンプト
- 分割支払いPOC: App Builder orchestrator AI プロンプト
- 分割支払いPOC: Experience Cloud UI拡張機能AI プロンプト
- 分割払いPOC:テストと検証ガイド
- 分割払いPOC:概念実証の次のステップ
- 分割支払いPOC:作成者向けチュートリアルクイックリファレンス