> For the complete documentation index, see [llms.txt](https://docs.fonbnk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fonbnk.com/server-to-server/api-endpoints/trigger-order-intermediate-action.md).

# Trigger order intermediate action

## <mark style="color:$warning;">\[POST]</mark> /api/v2/order/intermediate-action

Drives the step between creating an order and the user actually paying. What it does depends on the deposit's transfer type:

| Transfer type  | What this call does                                                                      |
| -------------- | ---------------------------------------------------------------------------------------- |
| `otp_stk_push` | Submits the OTP code the user received by SMS or WhatsApp. That unlocks the USSD prompt. |
| `stk_push`     | Sends a new USSD prompt to the user's phone. Use it when the first one did not arrive.   |
| `redirect`     | Accepted, but a no-op. See below.                                                        |

{% hint style="warning" %}
**Only call this on `stk_push`, `otp_stk_push` or `redirect`.** On other transfer types — including the `manual` bank flow — most providers reject it outright with `400` "Provider does not support post-initializing deposit". It is not a harmless no-op.

This endpoint also requires the end-user-creation capability on your account; without it every call returns `403`. See [Integration guide](/server-to-server/integration-guide.md).
{% endhint %}

### Before you call

Check `order.deposit.transferInstructions`:

* `isIntermediateActionAvailable` must be `true`.
* Now must be at or after `intermediateActionNextAttemptAvailableAt`.
* `intermediateActionAttempts` must still be **below** `intermediateActionMaxAttempts`.
* `fieldsForIntermediateAction` lists what to send — `otpCode` on `otp_stk_push`, nothing on a plain `stk_push` retry.

{% hint style="danger" %}
**Do not call it once the attempts are exhausted.** A call made when `intermediateActionAttempts` has already reached `intermediateActionMaxAttempts` does not fail harmlessly — it moves the order to **`deposit_expired`** and then returns `400 "The order is expired"`. Count the attempts on your side and stop before the cap.
{% endhint %}

See [Transfer types explanation](/server-to-server/integration-guide/transfer-types-explanation.md) for worked examples of both push types.

### Request

{% code overflow="wrap" expandable="true" %}

```typescript
type RequestBody = {
  orderId: string;
  fieldsForIntermediateAction?: Record<string, string>;
}
```

{% endcode %}

Submitting an OTP code:

{% code overflow="wrap" expandable="true" %}

```json
{
  "orderId": "68728fa56ff494df5f39faf5",
  "fieldsForIntermediateAction": {
    "otpCode": "123456"
  }
}
```

{% endcode %}

Retrying an STK push:

{% code overflow="wrap" expandable="true" %}

```json
{
  "orderId": "68728fa56ff494df5f39faf5"
}
```

{% endcode %}

### Response

Returns the updated order — the same `Order` object as [Get order](/server-to-server/api-endpoints/get-order.md).

On `stk_push` and `otp_stk_push`, read `deposit.transferInstructions` again: `intermediateActionAttempts`, `intermediateActionNextAttemptAvailableAt` and `intermediateActionExecuted` will have moved, and they tell you whether another retry is allowed.

On `redirect` nothing moves. The call exists so that a client which treats every transfer type the same is not rejected; it records nothing and none of the counters change. Sending the user to `transferInstructions.paymentUrl` is what actually matters.

{% hint style="info" %}
In sandbox, `123456` is always the valid OTP code.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fonbnk.com/server-to-server/api-endpoints/trigger-order-intermediate-action.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
