> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt. # Close Order Close an order whose payment has not completed. The current Allinpay/KPay route rejects PAID orders by default; use the enabled refund flow to return funds for a paid order. Query the final outcome when closing races with payment. ## API Information - **Endpoint:** POST `https://api.aimt-horizon.com/mis/close` - **Signature:** Uses terminal_sn + terminal_key ## Request Parameters | Parameter | Type | Required | Description | | ------------------- | ----------- | -------- | --------------------------------------------------- | | `terminal_sn` | String(32) | Yes | Terminal SN | | `out_trade_no` | String(32) | Yes | Merchant order number (from the original tradePush) | | `cancel_reason` | String(20) | Yes | Reason for cancellation (max 20 characters) | | `target_device_id` | String(20) | Yes | Target payment device ID | | `cancel_notify_url` | String(128) | No | Callback URL for cancellation result notification | | `biz_source` | String | No | Business source; defaults to "mis" | | `client_ip` | String | No | Requester IP address | ## Request Example ```json { "terminal_sn": "2101107140290972547", "out_trade_no": "SG20261022001", "cancel_reason": "Customer cancelled", "target_device_id": "TUSN12345678", "biz_source": "mis" } ``` ## Response (Accepted; Query Required) ```json { "result_code": "200", "error_message": null, "error_code": null, "biz_response": { "result_code": "MIS_PUSH_SUCCESS", "error_code": null, "error_message": null } } ``` ## Response Example (Failure) ```json { "result_code": "200", "error_message": null, "error_code": null, "biz_response": { "result_code": "MIS_PUSH_FAIL", "error_code": "TERMINAL_SN_UN_BIND", "error_message": "Terminal SN is unbound, push failed" } } ``` :::warning Important - Query first; payment can still complete afterward. Query again if closing is rejected because the order is paid. Unpaid orders remain subject to pre-cancel conditions and channel/device support. MIS_PUSH_SUCCESS only acknowledges acceptance and must not mark the local order as canceled. - out_trade_no must match the original order pushed via tradePush. - ORDER_CLOSE_ABORT_IN_PROGRESS is pending; on PAY_TYPE_CANCEL_NOT_SUPPORTED, follow the device flow and query before choosing another action. - Always verify the cancellation result via callback or Query API before confirming to the customer. :::