pay
Start a payment collection session on the call. Collects credit card or other
payment information from the caller via DTMF. Returns a
PayAction that you can use to stop
the payment flow or wait for it to complete.
This method emits calling.call.pay events. See Call Events for payload details.
Parameters
paymentConnectorUrl
URL of the payment connector service that processes the payment.
controlId
Custom control ID. Auto-generated if not provided.
inputMethod
How the caller provides payment info.
"dtmf"— caller enters digits on the keypad"speech"— caller speaks the payment information
chargeAmount
Amount to charge (e.g., "29.99").
currency
Currency code (e.g., "USD", "EUR").
securityCode
Whether to collect CVV ("true" or "false").
postalCode
Whether to collect postal code ("true" or "false").
statusUrl
URL to receive payment status webhooks.
paymentMethod
Payment method type (e.g., "credit-card").
timeout
Timeout for the payment session.
maxAttempts
Maximum number of retry attempts for failed input.
minPostalCodeLength
Minimum length required for the postal code.
tokenType
Type of payment token to generate.
language
Language for payment prompts (e.g., "en").
voice
Voice for payment prompts.
description
Description of the payment or charge.
validCardTypes
Comma-separated list of accepted card types (e.g., "visa,mastercard").
parameters
Additional payment connector parameters.
prompts
Custom prompt overrides for the payment flow.
onCompleted
Callback invoked when the payment operation completes.
Returns
Promise<PayAction> — An action handle with
stop() and wait() methods.