create_payment_parameter
create_payment_parameter
create_payment_parameter
Static helper that builds a parameter entry for the parameters list of
pay().
Parameter name.
Parameter value.
dict[str, str] — parameter dictionary for use in the parameters list of
pay().
1 from signalwire import AgentBase 2 from signalwire import FunctionResult 3 4 agent = AgentBase(name="my-agent", route="/agent") 5 agent.set_prompt_text("You are a helpful assistant.") 6 7 @agent.tool(name="subscription_payment", description="Set up a subscription payment") 8 def subscription_payment(args, raw_data): 9 prompt = FunctionResult.create_payment_prompt( 10 for_situation="payment-card-number", 11 actions=[ 12 FunctionResult.create_payment_action("Say", "Please enter your credit card number.") 13 ] 14 ) 15 return ( 16 FunctionResult("Let's set up your subscription.") 17 .pay( 18 payment_connector_url="https://api.example.com/subscribe", 19 charge_amount="29.99", 20 prompts=[prompt], 21 parameters=[ 22 FunctionResult.create_payment_parameter("plan", "monthly") 23 ] 24 ) 25 ) 26 27 agent.serve()