Pay
Overview
The <Pay> verb enables secure payment processing during voice calls. When implemented in your voice application,
it handles the complete payment flow including data collection, validation, and processing through your configured payment gateway.
The <Pay> verb also has two nouns that are embedded within it:
<Parameter>: Pass custom parameters to your payment processor.<Prompt>: Customize the prompts used during payment collection.
Core functionality
- Secure payment information collection
- Real-time payment processing
- Payment method tokenization
- Multi-currency support
- Automated retry handling
- Status tracking via webhooks
Transaction types
The <Pay> verb supports two primary transaction types: immediate charges and tokenization.
Immediate charges
When you need to process a payment right away, use an immediate charge transaction. This collects the payment details and processes the transaction in one step.
To execute an immediate charge:
Setting any positive value for chargeAmount initiates an immediate charge transaction.
Tokenization
Tokenization allows you to securely store payment information for future use. Instead of processing a payment, it generates a secure token that represents the payment method. This is particularly useful for:
- Subscription services
- Recurring billing
To tokenize payment information:
You can also omit the chargeAmount attribute entirely.
Your payment connector creates the token with your payment processor and returns it as token_id. SignalWire passes it to your action URL as PaymentToken, and you can use it for future transactions without asking the customer to re-enter their payment details. See the tokenization example for the full flow.
Attributes
paymentConnectorUrl
The HTTPS URL of your payment connector. SignalWire sends it a POST request with the collected payment details. See paymentConnectorUrl request parameters and securing your payment connector.
action
HTTPS endpoint that receives POST requests after payment completion. Must be HTTPS. Response determines next cXML instructions. For tokenization, receives the token as PaymentToken. For charges, receives PaymentConfirmationCode. Defaults to the current cXML document URL.
chargeAmount
Amount to charge. Set to 0 or omit for tokenization only. Must be between 0 and 1,000,000.
currency
Three-letter currency code (e.g., usd, eur, gbp). Must be supported by selected payment connector. Currently only usd is accepted.
description
Transaction description passed to payment processor. Appears in transaction records.
input
The only supported input method for payment data collection. All captured digits are automatically redacted in logs.
language
Controls prompt language. Supports en-AU, en-CA, en-GB, en-IN, en-US for all payments. Additional es-ES, es-MX, fr-CA, fr-FR, de-DE, it-IT for credit card only. See language list.
maxAttempts
Maximum number of retry attempts when timeout occurs or invalid data is received. Allowed values are 1, 2, or 3. Payment flow terminates after maxAttempts is reached.
minPostalCodeLength
Minimum required length for postal code input. Used for input validation.
paymentMethod
Determines payment collection flow. Credit card flow captures card number, expiration, security code, and postal code. ACH flow captures routing and account numbers.
postalCode
Controls postal code collection. When false, skips collection for postal code. When true, prompts the user for collection. When a String value, uses provided value without needing to collect the postal code from the user.
securityCode
Controls whether CVV/security code collection is required. When false, skips security code collection.
statusCallback
HTTPS endpoint that receives real-time payment status updates via POST requests. Includes details about current payment stage, errors, and attempt counts. See Status Callback Parameters for more details.
timeout
Number of seconds to wait for the next digit input before timing out. Must be a positive integer greater than 3 seconds. Applies to all input collection stages.
tokenType
Determines token persistence. Allowed values are one-time or reusable. One-time for single use, reusable for recurring use. Payment-method specific to certain processors.
validCardTypes
Space-separated list of accepted card types. Validates card number against specified types. Allowed values: visa, mastercard, amex, maestro, discover, optima, jcb, diners-club, enroute.
Webhook request parameters
paymentConnectorUrl request parameters
When all payment details have been collected from the caller, SignalWire sends a POST request with a JSON body to your paymentConnectorUrl.
Charges and tokenization send the same fields. SignalWire signs the request, so see securing your payment connector to verify it.
A valid response from your paymentConnectorUrl must be provided to indicate the success or failure of the transaction.
More information can be found in the Webhook Response section.
transaction_id
Unique identifier for the transaction.
method
Payment method (credit-card).
cardnumber
Customer’s full credit card number.
cvv
Card security code.
postal_code
Billing postal code.
description
Transaction description.
chargeAmount
Amount to charge, from the chargeAmount attribute. 0 for tokenization, or 0.00 when the attribute is omitted.
token_type
Token persistence (reusable or one-time), from the tokenType attribute.
expiry_month
Card expiration month (2 digits).
expiry_year
Card expiration year (2 digits).
currency_code
Three-letter currency code, from the currency attribute.
parameters
Custom parameters from the <Parameter> nouns, as an array with one single-key object per parameter. Omitted when <Pay> has no <Parameter>.
Example
action request parameters
When a transaction is completed, SignalWire will POST to your action URL. The body of the request will contain the standard request parameters
as well as the following parameters:
A valid cXML response must be provided if the action URL is provided. More information can be found in the Webhook Response section.
BankAccountNumber
Masked bank account number. ACH payments only.
BankAccountType
Bank account type. ACH payments only.
BankRoutingNumber
Bank routing number. ACH payments only.
PaymentCardExpirationDate
Card expiration in MMYY format.
PaymentCardNumber
Masked card number (last 4 digits visible).
PaymentCardPostalCode
Postal code provided.
PaymentCardSecurityCode
Masked security code.
PaymentCardType
Card brand (visa, mastercard, etc.).
PaymentConfirmationCode
The charge_id your payment connector returned for a successful charge.
PaymentConnectorError
The error_message your payment connector returned.
PaymentConnectorErrorCode
The error_code your payment connector returned.
PaymentError
Detailed error information.
PaymentErrorCode
Numeric error reference.
PaymentMethod
Type of payment method used.
PaymentToken
The token_id your payment connector returned for a successful tokenization. Otherwise, the token type (reusable or one-time) from the tokenType attribute.
PayResult
Final outcome of the payment attempt. The possible values can be seen in the Result Values table.
Result values
statusCallback request parameters
When a status change occurs, the following parameters are sent to your statusCallback URL:
Attempt
Current attempt number.
ErrorType
Specifies the nature of the error encountered (if any). Refer to the table below for detailed error type descriptions. The possible values can be seen in the Error Types table.
ExpirationDate
Card expiration date.
For
Indicates the present phase of the <Pay> request. The table below outlines the potential values. Possible values can be seen in the For Values table.
PaymentCardNumber
Masked card number.
PaymentCardPostalCode
Postal code provided.
PaymentCardType
Type of card provided.
PaymentMethod
Type of payment being processed.
SecurityCode
Masked security code.
For values
To find out whether the payment succeeded, check PayResult on the action request.
Error types
Webhook response
paymentConnectorUrl response
The response from your paymentConnectorUrl is used to inform if the transaction was successful or not.
Successful transaction
When a transaction is successful, the webhook should respond with one of the following formats (depending on the transaction type):
SignalWire passes charge_id to your action URL as PaymentConfirmationCode. When chargeAmount is zero or omitted, it passes token_id as PaymentToken.
Unsuccessful transaction
When a transaction is unsuccessful (declined by the payment processor), the webhook should respond with the following format:
action response
When a transaction is completed, SignalWire will POST to your action URL. The response should return valid cXML for the
next step in your application.
Example
Language support
The language attribute controls the language of automated prompts during payment collection.
You can customize prompt messages in any language using the <Prompt> noun, regardless of the selected language attribute.
Credit card payments
All credit card payments support the following languages:
English variants
- en-AU (Australian English)
- en-CA (Canadian English)
- en-GB (British English)
- en-IN (Indian English)
- en-US (American English)
Additional languages
- es-ES (European Spanish)
- es-MX (Mexican Spanish)
- fr-CA (Canadian French)
- fr-FR (European French)
- de-DE (German)
- it-IT (Italian)
Examples
Simple payment collection:
Payment with status tracking:
Basic tokenization:
Tokenization with validation:
Tokenize a card end to end
This <Pay> saves a card without charging it:
SignalWire collects the card details and sends them to your payment connector with "chargeAmount": "0" and "token_type": "reusable".
Your connector saves the card with your payment processor and replies with the processor’s token:
SignalWire then sends your action URL PayResult=success and PaymentToken=pm_1234567890.
Store the token to charge the card later through your payment processor.
Custom retry logic:
International payment:
Example with custom parameters and prompts
Securing your payment connector
Requests to your paymentConnectorUrl carry the X-SignalWire-Signature and X-SignalWire-SHA256-Signature headers, keyed with your project’s Signing Key. They don’t come from a published IP range, so verify the signature and reject any request that doesn’t match.
The connector request is signed like a JSON webhook, not like your action and statusCallback requests: X-SignalWire-Signature is the lowercase hex HMAC-SHA1 of the connector URL, with any credentials removed, followed by the raw JSON body. The form-parameter validation you use for other cXML webhooks won’t match it.
SignalWire normalizes the URL before signing it: the scheme is lowercased, . and .. path segments are resolved, and a URL without a path gets /, so https://example.com is signed as https://example.com/.
For a second layer, put credentials in the connector URL.
Credentials such as https://payuser:<LONG_RANDOM_SECRET>@pay.example.com/connector are sent as a standard Basic Authorization header and aren’t part of the signed URL, so your connector can check both.
A long random token in the URL path works too, and it is part of the signed URL.
The full paymentConnectorUrl, including any credentials or token in it, is visible in your call logs in the Dashboard.
Use a secret that protects only this endpoint, and rotate it periodically.