createPaymentPrompt

View as MarkdownOpen in Claude

Static helper that builds a payment prompt object for use with the prompts parameter of pay(). Payment prompts customize the TTS messages played during different stages of payment collection.

Parameters

forSituation
stringRequired

The payment stage this prompt applies to (e.g., "payment-card-number", "expiration-date", "security-code", "postal-code").

actions
PaymentAction[]Required

List of prompt actions. Use createPaymentAction() to build each entry.

cardType
string | undefinedDefaults to undefined

Space-separated card types this prompt applies to (e.g., "visa mastercard").

errorType
string | undefinedDefaults to undefined

Space-separated error types this prompt handles.

Returns

PaymentPrompt — A prompt object to pass in the prompts list of pay().

Example

1import { FunctionResult } from '@signalwire/sdk';
2
3const prompt = FunctionResult.createPaymentPrompt(
4 'payment-card-number',
5 [{ type: 'say', phrase: 'Please enter your card number.' }],
6);