> ## Documentation Index
> Fetch the complete documentation index at: https://docs-payment-merchant.keysecure.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 模拟消费失败

模拟消费**失败**，用于测试失败通知。

<Note>
  * `consume_no` 可选：传入则关联授权交易单号；不传则直接模拟一笔失败
  * 不传 `consume_no` 时，可传 `transaction_currency`、`pay_type`
  * **不使用** `Api-Key` / `Access-Token`
</Note>

## 请求头

<ParamField header="Content-Type" type="string" required default="application/json">
  固定为 `application/json; charset=utf-8`
</ParamField>

## 请求体

<ParamField body="card_no" type="string" required>
  卡号
</ParamField>

<ParamField body="amount" type="number" required>
  金额
</ParamField>

<ParamField body="consume_no" type="string">
  消费单号，关联授权交易单号；不传则不关联
</ParamField>

<ParamField body="transaction_currency" type="string" default="USD">
  交易币种；仅在不传 `consume_no` 时生效
</ParamField>

<ParamField body="pay_type" type="string" default="">
  见 [交易模拟说明](/cn/API/api-list/mock/overview#pay-type)。仅在不传 `consume_no` 时生效。
</ParamField>

## 返回参数

<ResponseField name="code" type="number">
  响应状态码，`0` 表示成功；失败时与 HTTP 状态码一致（如 `400` / `500`）
</ResponseField>

<ResponseField name="msg" type="string">
  响应消息。成功为 `Success`，失败为具体原因（无 `data` 字段）
</ResponseField>

<RequestExample>
  ```bash Request theme={null}
  curl --request POST \
    --url https://sandbox-openplatform.keysecure.io/open-api/v1/simulate/consumption_fail \
    --header 'Content-Type: application/json' \
    --data '{
      "card_no": "C02606050CI1Y0HS",
      "amount": 10,
      "consume_no": "YOUR_CONSUME_NO"
    }'
  ```

  ```bash Without consume_no theme={null}
  curl --request POST \
    --url https://sandbox-openplatform.keysecure.io/open-api/v1/simulate/consumption_fail \
    --header 'Content-Type: application/json' \
    --data '{
      "card_no": "C02606050CI1Y0HS",
      "amount": 10,
      "transaction_currency": "USD",
      "pay_type": "apple"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "code": 0,
    "msg": "Success"
  }
  ```
</ResponseExample>
