> ## 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.

# Simulate Consumption Failure

Simulates a consumption **failure** so you can test the failure notification.

<Note>
  * `consume_no` is optional: pass it to associate the authorization transaction number; omit it to simulate a failure directly
  * If you omit `consume_no`, you can pass `transaction_currency` and `pay_type`
  * These APIs **do not use** `Api-Key` / `Access-Token`
</Note>

## Request Headers

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

## Request Body

<ParamField body="card_no" type="string" required>
  Card number
</ParamField>

<ParamField body="amount" type="number" required>
  Amount
</ParamField>

<ParamField body="consume_no" type="string">
  Consumption order number. Associates the authorization transaction number. If omitted, not associated.
</ParamField>

<ParamField body="transaction_currency" type="string" default="USD">
  Transaction currency. Takes effect only when `consume_no` is omitted
</ParamField>

<ParamField body="pay_type" type="string" default="">
  See [Transaction Simulation Overview](/en/API/api-list/mock/overview#pay-type). Takes effect only when `consume_no` is omitted.
</ParamField>

## Response

<ResponseField name="code" type="number">
  Status code. `0` means success. On failure it matches the HTTP status (e.g. `400` / `500`)
</ResponseField>

<ResponseField name="msg" type="string">
  Response message. `Success` on success, or a specific error reason. No `data` field
</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>
