Skip to main content
The <Pay> verb collects payment information from a caller using DTMF and either charges or tokenizes the payment method through a configured Pay connector. Connectors may run in test or live mode. Test-mode connectors accept only the documented test card numbers.

Attributes

ATTRIBUTEDESCRIPTIONOPTIONSDEFAULT
action Optional URL where TeXML requests the next set of instructions after <Pay> completes. The request includes normalized PayResult, the raw Result, and available payment result fields. -
method HTTP request type used for the action URL. GET, POSTPOST
statusCallback Optional URL where Telnyx will send status callbacks for payment progress and completion events. -
statusCallbackMethod HTTP request type used for statusCallback. GET, POSTPOST
paymentConnector The name of the payment connector to use. The connector must be configured in the Telnyx API. Defaults to Default. Default
chargeAmount The amount to charge (e.g. 10.50). Required when transactionType is charge. Ignored for tokenize transactions. -
currency The currency for the charge. Pay currently supports USD. USDUSD
paymentToken An existing payment token to use for the transaction. If provided, the payment data collection steps are skipped. -
paymentMethod The payment method to collect. credit-card collects card number, expiration date, postal code, and security code. ach-debit collects bank routing and account numbers. credit-card, ach-debitcredit-card
transactionType The transaction type. charge processes a payment and returns a ChargeId. tokenize tokenizes the payment data and returns a TokenId. If omitted, Pay infers tokenize when chargeAmount is absent or zero and charge when it is positive. charge, tokenize-
description An optional description for the payment transaction. -
maxAttempts The maximum number of attempts for each payment collection step before failing. Valid values are 1 through 3. 1 - 31
timeout The timeout in seconds for each DTMF input step. Valid values are 1 through 600. 1 - 6005
interDigitTimeout The timeout in seconds between consecutive DTMF digits during input. Valid values are 1 through 600. 1 - 6005
voice The voice used for payment prompts (e.g. female, male). female
language The language used for payment prompts (e.g. en-US, es-ES). en-US
serviceLevel The service level for payment processing. premiumpremium
parameters A JSON string of additional parameters to pass to the payment connector. -
prompts A JSON string of custom prompts for payment collection steps. Can also be specified using nested <Prompt> elements. -
metadata A JSON string of metadata to attach to the payment transaction. -

Child verbs/nouns

NOUN/VERBDESCRIPTION
Parameter Optional key-value parameter merged into the Pay parameters map. Use the name and value attributes to specify the key and value.
Prompt Custom text-to-speech prompt for a specific payment collection step. Use the for attribute to specify the step and include the prompt text in a nested <Say> element.

Connector modes and test cards

Pay connectors can operate in test or live mode. Before contacting the configured processor, a test-mode connector rejects every card number except those below. A test-mode payment using any other card number fails with ErrorType=invalid-card-number. Live-mode connectors pass the captured payment details to the configured payment processor.

Charge a credit card

Collect credit-card details and charge a specific amount. The paymentConnector must name a Pay connector configured for the account:

Tokenize a credit card

Collect credit-card details and tokenize them without charging:
If transactionType is omitted, Pay infers tokenize when chargeAmount is absent or zero and charge when chargeAmount is positive.

Collect ACH bank-account details

Collect a 9-digit bank routing number and a 4–17 digit bank account number:

Custom prompts

Override a payment step’s text-to-speech prompt with a nested <Prompt> and <Say>:
The supported for values are payment-card-number, expiration-date, postal-code, security-code, bank-routing-number, and bank-account-number. Prompts may be qualified by attempt, errorType, and cardType. Qualifiers are optional and may be combined. attempt accepts a space-separated list of 1-based attempt numbers. Card-type values are lowercase and case-sensitive.
The prompts JSON attribute is an alternative to nested <Prompt> elements. Each step may contain a string or a list of prompt objects:

Additional connector parameters

Pass extra string parameters with nested <Parameter> elements. Child parameters override keys with the same name in the parameters JSON attribute.

Status callbacks

When statusCallback is set, TeXML sends callbacks as payment collection progresses and another callback when the Pay session completes. Parameters are form encoded for POST callbacks and query encoded for GET callbacks. The following call and payment context fields are included when available:

Progress callback

A progress callback always contains Status=processing and Result=pending. It can also contain: Progress callbacks accumulate the masked payment data collected so far. For example, the expiration-date callback can include the card number and card type collected by an earlier step.

Completed callback

The final status callback contains Status=completed and a normalized Result of success or failed. It can also contain:

Masked payment-data fields

Progress and completed callbacks include these fields when the corresponding values have been collected:

Action request

After Pay completes, TeXML requests the action URL using method. If action is omitted, TeXML requests the current document URL instead. The response must contain the next TeXML instructions. The action request has its own payload shape; it is not identical to the completed statusCallback payload. The action request also includes any available masked payment-data fields listed above.