pay
Collect and process a credit card payment during the call. Generates a SWML
pay verb that walks the caller through entering card details via DTMF or
voice, then submits to your payment connector endpoint.
Parameters
opts
Payment configuration object.
opts.paymentConnectorUrl
URL of your payment processing endpoint. SignalWire sends the collected card data to this URL for processing.
opts.inputMethod
How the caller provides card details.
"dtmf"— caller enters digits on the keypad"voice"— caller speaks the numbers
opts.statusUrl
URL to receive payment status change webhook notifications.
opts.paymentMethod
Payment method type. Currently only "credit-card" is supported.
opts.timeout
Seconds to wait for the next DTMF digit before timing out.
opts.maxAttempts
Number of retry attempts if payment collection fails.
opts.securityCode
Whether to prompt the caller for the card’s security code (CVV).
opts.postalCode
Whether to prompt for the billing postal code. Pass true to prompt, false
to skip, or a string with the actual postal code to use without prompting.
opts.minPostalCodeLength
Minimum number of digits required for the postal code.
opts.tokenType
Payment token type.
"one-time"— single-use token"reusable"— token can be charged again later
opts.chargeAmount
Amount to charge as a decimal string (e.g., "49.99").
opts.currency
ISO 4217 currency code (e.g., "usd", "eur").
opts.language
Language for TTS payment prompts (e.g., "en-US", "es-MX").
opts.voice
TTS voice for payment prompts (e.g., "woman", "man").
opts.description
Custom description for the payment transaction.
opts.validCardTypes
Space-separated list of accepted card types.
opts.parameters
Additional name/value pairs to send to the payment connector.
Use createPaymentParameter() to build entries.
opts.prompts
Custom prompt configurations to override default payment prompts.
Use createPaymentPrompt() to build entries.
opts.aiResponse
AI response template after payment completes. The ${pay_result} variable
is substituted with the payment outcome. When omitted, the default template
is used.
Returns
FunctionResult — this, for chaining.