***

title: create_payment_action
slug: /reference/python/agents/function-result/create-payment-action
description: Build a single action entry for a payment prompt.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[create-payment-prompt]: /docs/server-sdks/reference/python/agents/function-result/create-payment-prompt

[ref-functionresult]: /docs/server-sdks/reference/python/agents/function-result

Static helper that builds a single action entry for a payment prompt.

## **Parameters**

<ParamField path="action_type" type="str" required={true} toc={true}>
  Action type.

  * `"Say"` -- use text-to-speech
  * `"Play"` -- play an audio file URL
</ParamField>

<ParamField path="phrase" type="str" required={true} toc={true}>
  Text to speak (when `action_type` is `"Say"`) or URL to play (when `action_type`
  is `"Play"`).
</ParamField>

## **Returns**

`dict[str, str]` — action dictionary for use in
[`create_payment_prompt()`][create-payment-prompt].

## **Example**

```python {9-10}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="collect_card", description="Collect card payment")
def collect_card(args, raw_data):
    say_action = FunctionResult.create_payment_action("Say", "Please enter your card number.")
    play_action = FunctionResult.create_payment_action("Play", "https://example.com/card-prompt.mp3")
    prompt = FunctionResult.create_payment_prompt(
        for_situation="payment-card-number",
        actions=[say_action]
    )
    return (
        FunctionResult("I'll collect your payment now.")
        .pay(
            payment_connector_url="https://api.example.com/pay",
            charge_amount="19.99",
            prompts=[prompt]
        )
    )

agent.serve()
```