# TwiML™ Voice: \<Prompt>

The `<Prompt>` noun allows you to customize the default prompts used by `<Pay>`.

By default, when Twilio executes `<Pay>` TwiML instructions (**without** `<Prompt>`), the caller will hear default prompts for each step of the payment process. You can modify what the caller hears for a given payment step by nesting `<Prompt>` within `<Pay>`'s opening and closing tags.

You can customize prompts with text-to-speech or a pre-recorded audio file. For text-to-speech, you must nest `<Say>` TwiML within `<Prompt>`'s opening and closing tags. In order to play a pre-recorded audio file, you must nest `<Play>` TwiML within `<Prompt>`'s opening and closing tags.

There are seven payment steps in the `<Pay>` process, which are [listed below in the `for` attribute section](#for). You need separate `<Prompt>`s for each payment step prompt that you wish to customize.

The TwiML example below shows how to use `<Pay>`, `<Prompt>`, and `<Say>` to customize the prompt for the `payment-card-number` step (i.e. when the caller is prompted to enter their payment card number) with text-to-speech.

Prompt for card number

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
const pay = response.pay();
const prompt = pay.prompt({
    for: 'payment-card-number'
});
prompt.say('Please enter your 16 digit Visa or Mastercard number.');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay()
prompt = Prompt(for_='payment-card-number')
prompt.say('Please enter your 16 digit Visa or Mastercard number.')
pay.append(prompt)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay();
        var prompt = new Prompt(for_: "payment-card-number");
        prompt.Say("Please enter your 16 digit Visa or Mastercard number.");
        pay.Append(prompt);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Say say = new Say
            .Builder("Please enter your 16 digit Visa or Mastercard number.")
            .build();
        Prompt prompt = new Prompt.Builder().for_(Prompt.For
            .PAYMENT_CARD_NUMBER).say(say).build();
        Pay pay = new Pay.Builder().prompt(prompt).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					For_: "payment-card-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your 16 digit Visa or Mastercard number.",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay();
$prompt = $pay->prompt(['for' => 'payment-card-number']);
$prompt->say('Please enter your 16 digit Visa or Mastercard number.');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay do |pay|
  pay.prompt(for: 'payment-card-number') do |prompt|
    prompt
      .say(message: 'Please enter your 16 digit Visa or Mastercard number.')
  end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Pay>
   <Prompt for="payment-card-number">
     <Say>Please enter your 16 digit Visa or Mastercard number.</Say>
   </Prompt>
  </Pay>
</Response>
```

The following TwiML example causes the caller to hear a pre-recorded audio file during the `payment-card-number` payment step.

Prompt for card number with MP3

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
const pay = response.pay();
const prompt = pay.prompt({
    for: 'payment-card-number'
});
prompt.play('https://myurl.com/twilio/twiml/audio/card_number.mp3');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Play, Prompt, VoiceResponse

response = VoiceResponse()
pay = Pay()
prompt = Prompt(for_='payment-card-number')
prompt.play('https://myurl.com/twilio/twiml/audio/card_number.mp3')
pay.append(prompt)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay();
        var prompt = new Prompt(for_: "payment-card-number");
        prompt
            .Play(new Uri("https://myurl.com/twilio/twiml/audio/card_number.mp3"));
        pay.Append(prompt);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Play;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Play play = new Play
            .Builder("https://myurl.com/twilio/twiml/audio/card_number.mp3")
            .build();
        Prompt prompt = new Prompt.Builder().for_(Prompt.For
            .PAYMENT_CARD_NUMBER).play(play).build();
        Pay pay = new Pay.Builder().prompt(prompt).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					For_: "payment-card-number",
					InnerElements: []twiml.Element{
						&twiml.VoicePlay{
							Url: "https://myurl.com/twilio/twiml/audio/card_number.mp3",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay();
$prompt = $pay->prompt(['for' => 'payment-card-number']);
$prompt->play('https://myurl.com/twilio/twiml/audio/card_number.mp3');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay do |pay|
  pay.prompt(for: 'payment-card-number') do |prompt|
    prompt.play(url: 'https://myurl.com/twilio/twiml/audio/card_number.mp3')
  end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Pay>
   <Prompt for="payment-card-number">
     <Play>https://myurl.com/twilio/twiml/audio/card_number.mp3</Play>
   </Prompt>
  </Pay>
</Response>
```

## Attributes

The table below lists `<Prompt>`'s attributes. Click on an attribute name to learn more about that attribute.

| Attribute Name                                                         | Allowed Values                                                                                                                                                                                                                                                                                                                                                                                        | Default Values |
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| [for](#for)<br /><br /> *required*                                     | <ul><li>`payment-card-number`</li><li>`expiration-date`</li><li>`security-code`</li><li>`postal-code`</li><li>`bank-routing-number`</li><li>`bank-account-number`</li><li>`payment-processing`</li></ul>                                                                                                                                                                                              | none           |
| [cardType](#cardtype)<br /><br />  *optional*                          | <ul><li>`visa`</li><li>`mastercard`</li><li>`amex`</li><li>`maestro`</li><li>`discover`</li><li>`optima`</li><li>`jcb`</li><li>`diners-club`</li><li>`enroute`</li></ul><br /> Multiple values are allowed and must be space delimited.<br /><br /> Example:<br /> `visa amex mastercard`                                                                                                             | none           |
| [attempt](#attempt)<br /><br />  *optional*                            | An integer from `1`-`10`                                                                                                                                                                                                                                                                                                                                                                              | none           |
| [requireMatchingInputs](#requirematchinginputs)<br /><br /> *optional* | <ul><li>`true`</li><li>`false`</li></ul>                                                                                                                                                                                                                                                                                                                                                              | `false`        |
| [errorType](#errortype)<br /><br /> *optional*                         | <ul><li>`timeout`</li><li>`invalid-card-number`</li><li>`invalid-card-type`</li><li>`invalid-date`</li><li>`invalid-security-code`</li><li>`invalid-bank-routing-number`</li><li>`invalid-bank-account-number`</li><li>`input-matching-failed`</li></ul><br /> Multiple values are allowed and must be space delimited.<br /><br /> Example:<br /> `timeout invalid-bank-account-number invalid-date` | none           |

### for

`<Prompt>`'s `for` attribute specifies which payment step's prompt you wish to customize.

The following table lists the possible values of the `for` attribute, along with a description of each payment step.

| Possible Value / Payment Step | Description                                                                |
| ----------------------------- | -------------------------------------------------------------------------- |
| `payment-card-number`         | The customer is asked for credit or debit card information                 |
| `expiration-date`             | The customer is asked for the expiration date for their payment card       |
| `security-code`               | The customer is asked for the security code (CVV) for their payment card   |
| `postal-code`                 | The customer is asked for the postal code associated with the payment card |
| `bank-routing-number`         | The customer is asked for their bank's routing number                      |
| `bank-account-number`         | The customer is asked for their bank account number                        |
| `payment-processing`          | The payment is processing                                                  |

### cardType

The `cardType` attribute allows you to customize a payment step's prompt for specific payment card types.

This is useful to customize the prompt when asking for a security code, as different card types have security codes of different lengths.

The following TwiML example customizes the prompt for the `security-code` payment step if the credit card number provided by the caller was a Visa card.

Prompt for a Visa security code (3 digits)

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
const pay = response.pay();
const prompt = pay.prompt({
    for: 'security-code',
    cardType: 'visa'
});
prompt.say('Please enter security code for your Visa card. It’s the 3 digits located on the back of your card');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay()
prompt = Prompt(card_type='visa', for_='security-code')
prompt.say(
    'Please enter security code for your Visa card. It’s the 3 digits located on the back of your card'
)
pay.append(prompt)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;
using System.Linq;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay();
        var prompt = new Prompt(cardType: new []{Prompt.CardTypeEnum.Visa}
            .ToList(), for_: "security-code");
        prompt
            .Say("Please enter security code for your Visa card. It’s the 3 digits located on the back of your card");
        pay.Append(prompt);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Say say = new Say
            .Builder("Please enter security code for your Visa card. It’s the 3 digits located on the back of your card").build();
        Prompt prompt = new Prompt.Builder().cardTypes(Prompt.CardType.VISA)
            .for_(Prompt.For.SECURITY_CODE).say(say).build();
        Pay pay = new Pay.Builder().prompt(prompt).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					For_: "payment-card-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter security code for your Visa card. It’s the 3 digits located on the back of your card",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay();
$prompt = $pay->prompt(['for' => 'security-code', 'cardType' => 'visa']);
$prompt->say('Please enter security code for your Visa card. It’s the 3 digits located on the back of your card');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay do |pay|
  pay.prompt(for: 'security-code', card_type: 'visa') do |prompt|
    prompt
      .say(message: 'Please enter security code for your Visa card. It’s the 3 digits located on the back of your card')
  end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Pay>
   <Prompt for="security-code" cardType="visa">
     <Say>Please enter security code for your Visa card. It’s the 3 digits located on the back of your card</Say>
   </Prompt>
  </Pay>
</Response>
```

The following TwiML example customizes the prompt for the `security-code` payment step if the credit card number provided by the caller was an American Express card.

Prompt for an American Express security code (4 digits)

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
const pay = response.pay();
const prompt = pay.prompt({
    for: 'security-code',
    cardType: 'amex'
});
prompt.say('Please enter security code for your American Express card. It’s the 4 digits located on the front of your card');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay()
prompt = Prompt(card_type='amex', for_='security-code')
prompt.say(
    'Please enter security code for your American Express card. It’s the 4 digits located on the front of your card'
)
pay.append(prompt)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;
using System.Linq;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay();
        var prompt = new Prompt(cardType: new []{Prompt.CardTypeEnum.Amex}
            .ToList(), for_: "security-code");
        prompt
            .Say("Please enter security code for your American Express card. It’s the 4 digits located on the front of your card");
        pay.Append(prompt);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Say say = new Say
            .Builder("Please enter security code for your American Express card. It’s the 4 digits located on the front of your card").build();
        Prompt prompt = new Prompt.Builder().cardTypes(Prompt.CardType.AMEX)
            .for_(Prompt.For.SECURITY_CODE).say(say).build();
        Pay pay = new Pay.Builder().prompt(prompt).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					CardType: "amex",
					For_:     "security-code",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter security code for your American Express card. It’s the 4 digits located on the front of your card",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay();
$prompt = $pay->prompt(['for' => 'security-code', 'cardType' => 'amex']);
$prompt->say('Please enter security code for your American Express card. It’s the 4 digits located on the front of your card');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay do |pay|
  pay.prompt(for: 'security-code', card_type: 'amex') do |prompt|
    prompt
      .say(message: 'Please enter security code for your American Express card. It’s the 4 digits located on the front of your card')
  end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Pay>
   <Prompt for="security-code" cardType="amex">
     <Say>
      Please enter security code for your American Express card. It’s the 4 digits located on the front of your card
     </Say>
   </Prompt>
  </Pay>
</Response>
```

### attempt

If a customer fails to input a payment step's information, the customer will be prompted again to enter that step's information. You can customize what the customer hears for each attempt to gather a payment step's information using the `attempt` attribute.

This can be used to provide more helpful prompts if a customer fails to enter their information after an initial prompt for a given payment step.

The TwiML example below would cause the customer to hear, "Please enter your expiration date, two digits for the month and two digits for the year." during the `expiration-date` step. If the caller fails to enter an expiration date, the next `<Prompt>` will execute and the caller will hear, "Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2." Since the second `<Prompt>`'s `attempt` value is `2 3`, the caller would hear this longer prompt during a third attempt if necessary.

Change prompt for subsequent attempts

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
const pay = response.pay();
const prompt = pay.prompt({
    for: 'expiration-date',
    attempt: '1'
});
prompt.say('Please enter your expiration date, two digits for the month and two digits for the year.');
const prompt2 = pay.prompt({
    for: 'expiration-date',
    attempt: '2 3'
});
prompt2.say('Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay()
prompt = Prompt(attempt='1', for_='expiration-date')
prompt.say(
    'Please enter your expiration date, two digits for the month and two digits for the year.'
)
pay.append(prompt)
prompt2 = Prompt(attempt='2 3', for_='expiration-date')
prompt2.say(
    'Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2'
)
pay.append(prompt2)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;
using System.Linq;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay();
        var prompt = new Prompt(attempt: new []{1}.ToList(),
            for_: "expiration-date");
        prompt
            .Say("Please enter your expiration date, two digits for the month and two digits for the year.");
        pay.Append(prompt);
        var prompt2 = new Prompt(attempt: new []{2, 3}.ToList(),
            for_: "expiration-date");
        prompt2
            .Say("Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2");
        pay.Append(prompt2);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;
import java.util.Arrays;

public class Example {
    public static void main(String[] args) {
        Say say = new Say
            .Builder("Please enter your expiration date, two digits for the month and two digits for the year.").build();
        Prompt prompt = new Prompt.Builder().attempts(1).for_(Prompt.For
            .EXPIRATION_DATE).say(say).build();
        Say say2 = new Say
            .Builder("Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2").build();
        Prompt prompt2 = new Prompt.Builder().attempts(Arrays.asList(2, 3))
            .for_(Prompt.For.EXPIRATION_DATE).say(say2).build();
        Pay pay = new Pay.Builder().prompt(prompt).prompt(prompt2).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					Attempt: "1",
					For_:    "expiration-date",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your expiration date, two digits for the month and two digits for the year.",
						},
					},
				},
				&twiml.VoicePrompt{
					Attempt: "2 3",
					For_:    "expiration-date",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay();
$prompt = $pay->prompt(['for' => 'expiration-date', 'attempt' => '1']);
$prompt->say('Please enter your expiration date, two digits for the month and two digits for the year.');
$prompt2 = $pay->prompt(['for' => 'expiration-date', 'attempt' => '2 3']);
$prompt2->say('Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay do |pay|
  pay.prompt(for: 'expiration-date', attempt: '1') do |prompt|
    prompt
      .say(message: 'Please enter your expiration date, two digits for the month and two digits for the year.')
  end
  pay.prompt(for: 'expiration-date', attempt: '2 3') do |prompt2|
    prompt2
      .say(message: 'Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2')
  end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
 <Pay>
  <Prompt for="expiration-date" attempt="1">
    <Say>Please enter your expiration date, two digits for the month and two digits for the year.</Say>
  </Prompt>
  <Prompt for="expiration-date" attempt="2 3">
    <Say>Please enter your expiration date, two digits for the month and two digits for the year. For example, if your expiration date is March 2022, then please enter 0 3 2 2</Say>
  </Prompt>
 </Pay>
</Response>
```

### requireMatchingInputs

The `requireMatchingInputs` attribute allows you to prompt a customer to re-input their bank account number or bank routing number and tell Twilio to check whether or not the two inputs match.

> \[!WARNING]
>
> The `requireMatchingInputs` attribute is only available for use for ACH payments/tokenizations at this time.
>
> Therefore, you can only use `requireMatchingInputs` with `for` attributes of `bank-account-number` or `bank-routing-number`.

If the two inputs do not match, Twilio will restart that payment step's prompts. The customer will once again hear the first prompt to enter their information and the second prompt to re-enter the information.

Require caller to enter bank account information twice

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
const pay = response.pay({
    paymentMethod: 'ach-debit',
    chargeAmount: '13.22'
});
const prompt = pay.prompt({
    for: 'bank-account-number'
});
prompt.say('Thanks for using our service. Please enter your bank account number.');
const prompt2 = pay.prompt({
    for: 'bank-account-number',
    requireMatchingInputs: true
});
prompt2.say('Thank you. Please enter your bank account number again.');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay(payment_method='ach-debit', charge_amount='13.22')
prompt = Prompt(for_='bank-account-number')
prompt.say(
    'Thanks for using our service. Please enter your bank account number.')
pay.append(prompt)
prompt2 = Prompt(require_matching_inputs=True, for_='bank-account-number')
prompt2.say('Thank you. Please enter your bank account number again.')
pay.append(prompt2)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;


class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay(paymentMethod: Pay.PaymentMethodEnum.AchDebit, chargeAmount: "13.22");
        var prompt = new Prompt(for_: Prompt.ForEnum.BankAccountNumber);
        prompt.Say("Thanks for using our service. Please enter your bank account number.");
        pay.Append(prompt);
        var prompt2 = new Prompt(requireMatchingInputs: true, for_: Prompt.ForEnum.BankAccountNumber);
        prompt2.Say("Thank you. Please enter your bank account number again.");
        pay.Append(prompt2);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Say say = new Say.Builder("Thanks for using our service. Please enter your bank account number.").build();
        Prompt prompt = new Prompt.Builder().for_(Prompt.For.BANK_ACCOUNT_NUMBER).say(say).build();
        Say say2 = new Say.Builder("Thank you. Please enter your bank account number again.").build();
        Prompt prompt2 = new Prompt.Builder().requireMatchingInputs(true).for_(Prompt.For.BANK_ACCOUNT_NUMBER).say(say2).build();
        Pay pay = new Pay.Builder().paymentMethod(Pay.PaymentMethod.ACH_DEBIT).chargeAmount("13.22").prompt(prompt).prompt(prompt2).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			ChargeAmount:  "13.22",
			PaymentMethod: "ach-debit",
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					For_: "bank-account-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Thanks for using our service. Please enter your bank account number.",
						},
					},
				},
				&twiml.VoicePrompt{
					For_:                  "expiration-date",
					RequireMatchingInputs: "true",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Thank you. Please enter your bank account number again.",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay(['paymentMethod' => 'ach-debit', 'chargeAmount' => '13.22']);
$prompt = $pay->prompt(['for' => 'bank-account-number']);
$prompt->say('Thanks for using our service. Please enter your bank account number.');
$prompt2 = $pay->prompt(['for' => 'bank-account-number', 'requireMatchingInputs' => 'true']);
$prompt2->say('Thank you. Please enter your bank account number again.');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay(payment_method: 'ach-debit', charge_amount: '13.22') do |pay|
    pay.prompt(for: 'bank-account-number') do |prompt|
        prompt.say(message: 'Thanks for using our service. Please enter your bank account number.')
end
    pay.prompt(for: 'bank-account-number', require_matching_inputs: true) do |prompt2|
        prompt2.say(message: 'Thank you. Please enter your bank account number again.')
end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Pay paymentMethod="ach-debit" chargeAmount="13.22">
        <Prompt for="bank-account-number">
            <Say>Thanks for using our service. Please enter your bank account number.</Say>
        </Prompt>
        <Prompt for="bank-account-number" requireMatchingInputs="true">
            <Say>Thank you. Please enter your bank account number again.</Say>
        </Prompt>
    </Pay>
</Response>
```

You should use two `<Prompt>`s with the same `for` attribute. The second `<Prompt>` should have `requireMatchingInputs` set to `true`. This will give the caller two different prompts: one to enter a piece of information once, and one that tells the caller to re-enter the information for verification purposes.

Optionally, you can use a third `<Prompt>` (with the same `for` attribute) with the `errorType` attribute set to `input-matching-failed` to customize the prompt the caller hears if their inputs did not match. The TwiML example below illustrates this behavior.

Use with requireMatchingInputs and errorType

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
const pay = response.pay({
    paymentMethod: 'ach-debit',
    chargeAmount: '13.22'
});
const prompt = pay.prompt({
    for: 'bank-account-number'
});
prompt.say('Thanks for using our service. Please enter your bank account number.');
const prompt2 = pay.prompt({
    for: 'bank-account-number',
    requireMatchingInputs: true
});
prompt2.say('Thank you. Please enter your bank account number again.');
const prompt3 = pay.prompt({
    for: 'bank-account-number',
    errorType: 'input-matching-failed'
});
prompt3.say('Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay(payment_method='ach-debit', charge_amount='13.22')
prompt = Prompt(for_='bank-account-number')
prompt.say(
    'Thanks for using our service. Please enter your bank account number.')
pay.append(prompt)
prompt2 = Prompt(require_matching_inputs=True, for_='bank-account-number')
prompt2.say('Thank you. Please enter your bank account number again.')
pay.append(prompt2)
prompt3 = Prompt(
    error_type='input-matching-failed', for_='bank-account-number')
prompt3.say(
    'Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.'
)
pay.append(prompt3)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;
using System.Linq;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay(paymentMethod: Pay.PaymentMethodEnum.AchDebit, chargeAmount: "13.22");
        var prompt = new Prompt(for_: Prompt.ForEnum.BankAccountNumber);
        prompt.Say("Thanks for using our service. Please enter your bank account number.");
        pay.Append(prompt);
        var prompt2 = new Prompt(requireMatchingInputs: true, for_: Prompt.ForEnum.BankAccountNumber);
        prompt2.Say("Thank you. Please enter your bank account number again.");
        pay.Append(prompt2);
        var prompt3 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.InputMatchingFailed}.ToList(), for_: Prompt.ForEnum.BankAccountNumber);
        prompt3.Say("Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.");
        pay.Append(prompt3);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Say say = new Say.Builder("Thanks for using our service. Please enter your bank account number.").build();
        Prompt prompt = new Prompt.Builder().for_(Prompt.For.BANK_ACCOUNT_NUMBER).say(say).build();
        Say say2 = new Say.Builder("Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.").build();
        Prompt prompt2 = new Prompt.Builder().errorTypes(Prompt.ErrorType.INPUT_MATCHING_FAILED).for_(Prompt.For.BANK_ACCOUNT_NUMBER).say(say2).build();
        Say say3 = new Say.Builder("Thank you. Please enter your bank account number again.").build();
        Prompt prompt3 = new Prompt.Builder().requireMatchingInputs(true).for_(Prompt.For.BANK_ACCOUNT_NUMBER).say(say3).build();
        Pay pay = new Pay.Builder().paymentMethod(Pay.PaymentMethod.ACH_DEBIT).chargeAmount("13.22").prompt(prompt).prompt(prompt3).prompt(prompt2).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			ChargeAmount:  "13.22",
			PaymentMethod: "ach-debit",
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					For_: "bank-account-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Thanks for using our service. Please enter your bank account number.",
						},
					},
				},
				&twiml.VoicePrompt{
					For_:                  "bank-account-number",
					RequireMatchingInputs: "true",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Thank you. Please enter your bank account number again.",
						},
					},
				},
				&twiml.VoicePrompt{
					ErrorType: "input-matching-failed",
					For_:      "bank-account-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay(['paymentMethod' => 'ach-debit', 'chargeAmount' => '13.22']);
$prompt = $pay->prompt(['for' => 'bank-account-number']);
$prompt->say('Thanks for using our service. Please enter your bank account number.');
$prompt2 = $pay->prompt(['for' => 'bank-account-number', 'requireMatchingInputs' => 'true']);
$prompt2->say('Thank you. Please enter your bank account number again.');
$prompt3 = $pay->prompt(['for' => 'bank-account-number', 'errorType' => 'input-matching-failed']);
$prompt3->say('Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay(payment_method: 'ach-debit', charge_amount: '13.22') do |pay|
    pay.prompt(for: 'bank-account-number') do |prompt|
        prompt.say(message: 'Thanks for using our service. Please enter your bank account number.')
end
    pay.prompt(for: 'bank-account-number', require_matching_inputs: true) do |prompt2|
        prompt2.say(message: 'Thank you. Please enter your bank account number again.')
end
    pay.prompt(for: 'bank-account-number', error_type: 'input-matching-failed') do |prompt3|
        prompt3.say(message: 'Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.')
end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Pay paymentMethod="ach-debit" chargeAmount="13.22">
        <Prompt for="bank-account-number">
            <Say>Thanks for using our service. Please enter your bank account number.</Say>
        </Prompt>
        <Prompt for="bank-account-number" requireMatchingInputs="true">
            <Say>Thank you. Please enter your bank account number again.</Say>
        </Prompt>
        <Prompt for="bank-account-number" errorType="input-matching-failed">
            <Say>Sorry, your two bank account number inputs did not match. Please enter your bank account number again. We will then ask a second time again.</Say>
        </Prompt>
    </Pay>
</Response>
```

### errorType

The `errorType` attribute allows you to customize the prompt that the caller hears if their input for a given payment step was invalid.

The following are possible values of `errorType` and descriptions of the cause of the error.

| errorType                     | Description                                                                                                                                                                                                                                                                                                                                          |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `timeout`                     | `<Pay>` received a timeout when executing a payment step                                                                                                                                                                                                                                                                                             |
| `invalid-card-number`         | `<Pay>` didn't receive the appropriate number of digits for either credit card number, expiration date, security code or zip code. Or card number entered didn't pass the validation. This reason can be used to apply further customization on the message to play such as informing payee/caller that the incorrect number of digits were entered. |
| `invalid-card-type`           | The card number entered didn't match the accepted card types. For example, if only visa or mastercard are accepted and payee enters amex, InvalidReason parameter will contain this value.                                                                                                                                                           |
| `invalid-date`                | `<Pay>` didn't receive the correct number of digits for the date.                                                                                                                                                                                                                                                                                    |
| `invalid-security-code`       | This reason is generated when the payee entered an invalid security code. For example, if credit card number is amex and user entered 3 digits for the security code.                                                                                                                                                                                |
| `invalid-postal-code`         | `<Pay>` didn't receive the correct number of digits for the postal/zip code.                                                                                                                                                                                                                                                                         |
| `invalid-bank-routing-number` | `<Pay>` either didn't receive the appropriate number of digits for the routing number or the routing number provided failed the validation performed by `<Pay>`.                                                                                                                                                                                     |
| `invalid-bank-account-number` | `<Pay>` didn't receive the minimum number of digits required for the bank account number.                                                                                                                                                                                                                                                            |
| `input-matching-failed`       | The first and second inputs by the customer did not match. Only will be returned when `requireMatchingInputs` is set to `true`. Only available for ACH payments/tokenizations at this time.                                                                                                                                                          |

## Example usage

### Customize prompts for credit card payments

The following examples show the TwiML you can use to customize all prompts for `<Pay>` when accepting a credit card payment:

A full example for a credit card transaction

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
const pay = response.pay({
    paymentMethod: 'credit-card',
    validCardTypes: 'visa mastercard amex'
});
const prompt = pay.prompt({
    for: 'payment-card-number'
});
prompt.say('Please enter your credit card number.');
const prompt2 = pay.prompt({
    for: 'payment-card-number',
    errorType: 'timeout'
});
prompt2.say('You didn\'t enter your credit card number. Please enter your credit card number.');
const prompt3 = pay.prompt({
    for: 'payment-card-number',
    errorType: 'invalid-card-number'
});
prompt3.say('You entered an invalid credit card number. Please try again.');
const prompt4 = pay.prompt({
    for: 'payment-card-number',
    errorType: 'invalid-card-type'
});
prompt4.say('The card number you entered isn\'t from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.');
const prompt5 = pay.prompt({
    for: 'expiration-date'
});
prompt5.say('Please enter your credit card\'s expiration date. Two digits for the month and two digits for the year.');
const prompt6 = pay.prompt({
    for: 'expiration-date',
    errorType: 'timeout'
});
prompt6.say('Sorry. You didn\'t enter an expiration date. Please enter your card\'s expiration date. Two digits for the month and two digits for the year.');
const prompt7 = pay.prompt({
    for: 'expiration-date',
    errorType: 'invalid-date'
});
prompt7.say('The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.');
const prompt8 = pay.prompt({
    for: 'security-code',
    cardType: 'visa mastercard'
});
prompt8.say('Please enter your security code. It\'s the 3 digits located on the back of your card.');
const prompt9 = pay.prompt({
    for: 'security-code',
    errorType: 'timeout',
    cardType: 'visa mastercard'
});
prompt9.say('You didn\'t enter your credit card security code. Please enter your security code. It\'s the 3 digits located on the back of your card.');
const prompt10 = pay.prompt({
    for: 'security-code',
    errorType: 'invalid-security-code',
    cardType: 'visa mastercard'
});
prompt10.say('That was an invalid security code. The security code must be 3 digits. Please try again.');
const prompt11 = pay.prompt({
    for: 'security-code',
    cardType: 'amex'
});
prompt11.say('Please enter your security code. It\'s the 4 digits located on the front of your card.');
const prompt12 = pay.prompt({
    for: 'security-code',
    errorType: 'timeout',
    cardType: 'amex'
});
prompt12.say('You didn\'t enter your credit card security code.  Please enter your security code. It\'s the 4 digits located on the front of your card.');
const prompt13 = pay.prompt({
    for: 'security-code',
    errorType: 'invalid-security-code',
    cardType: 'amex'
});
prompt13.say('That was an invalid security code. The security code must be 4 digits. Please try again.');
const prompt14 = pay.prompt({
    for: 'postal-code'
});
prompt14.say('Please enter your 5 digit billing zip code.');
const prompt15 = pay.prompt({
    for: 'postal-code',
    errorType: 'timeout'
});
prompt15.say('You didn\'t enter your billing zip code. Please enter your 5 digit billing zip code.');
const prompt16 = pay.prompt({
    for: 'payment-processing'
});
prompt16.say('Thank you. Please wait while we process your payment.');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay(
    payment_method='credit-card', valid_card_types='visa mastercard amex')
prompt = Prompt(for_='payment-card-number')
prompt.say('Please enter your credit card number.')
pay.append(prompt)
prompt2 = Prompt(error_type='timeout', for_='payment-card-number')
prompt2.say(
    'You didn\'t enter your credit card number. Please enter your credit card number.'
)
pay.append(prompt2)
prompt3 = Prompt(error_type='invalid-card-number', for_='payment-card-number')
prompt3.say('You entered an invalid credit card number. Please try again.')
pay.append(prompt3)
prompt4 = Prompt(error_type='invalid-card-type', for_='payment-card-number')
prompt4.say(
    'The card number you entered isn\'t from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.'
)
pay.append(prompt4)
prompt5 = Prompt(for_='expiration-date')
prompt5.say(
    'Please enter your credit card\'s expiration date. Two digits for the month and two digits for the year.'
)
pay.append(prompt5)
prompt6 = Prompt(error_type='timeout', for_='expiration-date')
prompt6.say(
    'Sorry. You didn\'t enter an expiration date. Please enter your card\'s expiration date. Two digits for the month and two digits for the year.'
)
pay.append(prompt6)
prompt7 = Prompt(error_type='invalid-date', for_='expiration-date')
prompt7.say(
    'The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.'
)
pay.append(prompt7)
prompt8 = Prompt(card_type='visa mastercard', for_='security-code')
prompt8.say(
    'Please enter your security code. It\'s the 3 digits located on the back of your card.'
)
pay.append(prompt8)
prompt9 = Prompt(
    error_type='timeout', card_type='visa mastercard', for_='security-code')
prompt9.say(
    'You didn\'t enter your credit card security code. Please enter your security code. It\'s the 3 digits located on the back of your card.'
)
pay.append(prompt9)
prompt10 = Prompt(
    error_type='invalid-security-code',
    card_type='visa mastercard',
    for_='security-code')
prompt10.say(
    'That was an invalid security code. The security code must be 3 digits. Please try again.'
)
pay.append(prompt10)
prompt11 = Prompt(card_type='amex', for_='security-code')
prompt11.say(
    'Please enter your security code. It\'s the 4 digits located on the front of your card.'
)
pay.append(prompt11)
prompt12 = Prompt(error_type='timeout', card_type='amex', for_='security-code')
prompt12.say(
    'You didn\'t enter your credit card security code.  Please enter your security code. It\'s the 4 digits located on the front of your card.'
)
pay.append(prompt12)
prompt13 = Prompt(
    error_type='invalid-security-code', card_type='amex', for_='security-code')
prompt13.say(
    'That was an invalid security code. The security code must be 4 digits. Please try again.'
)
pay.append(prompt13)
prompt14 = Prompt(for_='postal-code')
prompt14.say('Please enter your 5 digit billing zip code.')
pay.append(prompt14)
prompt15 = Prompt(error_type='timeout', for_='postal-code')
prompt15.say(
    'You didn\'t enter your billing zip code. Please enter your 5 digit billing zip code.'
)
pay.append(prompt15)
prompt16 = Prompt(for_='payment-processing')
prompt16.say('Thank you. Please wait while we process your payment.')
pay.append(prompt16)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;
using System.Linq;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay(paymentMethod: Pay.PaymentMethodEnum.CreditCard, validCardTypes: new []{Pay.ValidCardTypesEnum.Visa, Pay.ValidCardTypesEnum.Mastercard, Pay.ValidCardTypesEnum.Amex}.ToList());
        var prompt = new Prompt(for_: Prompt.ForEnum.PaymentCardNumber);
        prompt.Say("Please enter your credit card number.");
        pay.Append(prompt);
        var prompt2 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.Timeout}.ToList(), for_: Prompt.ForEnum.PaymentCardNumber);
        prompt2.Say("You didn't enter your credit card number. Please enter your credit card number.");
        pay.Append(prompt2);
        var prompt3 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.InvalidCardNumber}.ToList(), for_: Prompt.ForEnum.PaymentCardNumber);
        prompt3.Say("You entered an invalid credit card number. Please try again.");
        pay.Append(prompt3);
        var prompt4 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.InvalidCardType}.ToList(), for_: Prompt.ForEnum.PaymentCardNumber);
        prompt4.Say("The card number you entered isn't from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.");
        pay.Append(prompt4);
        var prompt5 = new Prompt(for_: Prompt.ForEnum.ExpirationDate);
        prompt5.Say("Please enter your credit card's expiration date. Two digits for the month and two digits for the year.");
        pay.Append(prompt5);
        var prompt6 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.Timeout}.ToList(), for_: Prompt.ForEnum.ExpirationDate);
        prompt6.Say("Sorry. You didn't enter an expiration date. Please enter your card's expiration date. Two digits for the month and two digits for the year.");
        pay.Append(prompt6);
        var prompt7 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.InvalidDate}.ToList(), for_: Prompt.ForEnum.ExpirationDate);
        prompt7.Say("The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.");
        pay.Append(prompt7);
        var prompt8 = new Prompt(cardType: new []{Prompt.CardTypeEnum.Visa, Prompt.CardTypeEnum.Mastercard}.ToList(), for_: Prompt.ForEnum.SecurityCode);
        prompt8.Say("Please enter your security code. It's the 3 digits located on the back of your card.");
        pay.Append(prompt8);
        var prompt9 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.Timeout}.ToList(), cardType: new []{Prompt.CardTypeEnum.Visa, Prompt.CardTypeEnum.Mastercard}.ToList(), for_: Prompt.ForEnum.SecurityCode);
        prompt9.Say("You didn't enter your credit card security code. Please enter your security code. It's the 3 digits located on the back of your card.");
        pay.Append(prompt9);
        var prompt10 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.InvalidSecurityCode}.ToList(), cardType: new []{Prompt.CardTypeEnum.Visa, Prompt.CardTypeEnum.Mastercard}.ToList(), for_: Prompt.ForEnum.SecurityCode);
        prompt10.Say("That was an invalid security code. The security code must be 3 digits. Please try again.");
        pay.Append(prompt10);
        var prompt11 = new Prompt(cardType: new []{Prompt.CardTypeEnum.Amex}.ToList(), for_: Prompt.ForEnum.SecurityCode);
        prompt11.Say("Please enter your security code. It's the 4 digits located on the front of your card.");
        pay.Append(prompt11);
        var prompt12 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.Timeout}.ToList(), cardType: new []{Prompt.CardTypeEnum.Amex}.ToList(), for_: Prompt.ForEnum.SecurityCode);
        prompt12.Say("You didn't enter your credit card security code.  Please enter your security code. It's the 4 digits located on the front of your card.");
        pay.Append(prompt12);
        var prompt13 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.InvalidSecurityCode}.ToList(), cardType: new []{Prompt.CardTypeEnum.Amex}.ToList(), for_: Prompt.ForEnum.SecurityCode);
        prompt13.Say("That was an invalid security code. The security code must be 4 digits. Please try again.");
        pay.Append(prompt13);
        var prompt14 = new Prompt(for_: Prompt.ForEnum.PostalCode);
        prompt14.Say("Please enter your 5 digit billing zip code.");
        pay.Append(prompt14);
        var prompt15 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.Timeout}.ToList(), for_: Prompt.ForEnum.PostalCode);
        prompt15.Say("You didn't enter your billing zip code. Please enter your 5 digit billing zip code.");
        pay.Append(prompt15);
        var prompt16 = new Prompt(for_: Prompt.ForEnum.PaymentProcessing);
        prompt16.Say("Thank you. Please wait while we process your payment.");
        pay.Append(prompt16);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;
import java.util.Arrays;

public class Example {
    public static void main(String[] args) {
        Say say = new Say.Builder("Please enter your credit card number.").build();
        Prompt prompt = new Prompt.Builder().for_(Prompt.For.PAYMENT_CARD_NUMBER).say(say).build();
        Say say2 = new Say.Builder("You didn't enter your credit card number. Please enter your credit card number.").build();
        Prompt prompt2 = new Prompt.Builder().errorTypes(Prompt.ErrorType.TIMEOUT).for_(Prompt.For.PAYMENT_CARD_NUMBER).say(say2).build();
        Say say3 = new Say.Builder("Please enter your credit card's expiration date. Two digits for the month and two digits for the year.").build();
        Prompt prompt3 = new Prompt.Builder().for_(Prompt.For.EXPIRATION_DATE).say(say3).build();
        Say say4 = new Say.Builder("You didn't enter your credit card security code. Please enter your security code. It's the 3 digits located on the back of your card.").build();
        Prompt prompt4 = new Prompt.Builder().cardTypes(Arrays.asList(Prompt.CardType.VISA, Prompt.CardType.MASTERCARD)).errorTypes(Prompt.ErrorType.TIMEOUT).for_(Prompt.For.SECURITY_CODE).say(say4).build();
        Say say5 = new Say.Builder("Thank you. Please wait while we process your payment.").build();
        Prompt prompt5 = new Prompt.Builder().for_(Prompt.For.PAYMENT_PROCESSING).say(say5).build();
        Say say6 = new Say.Builder("You didn't enter your credit card security code.  Please enter your security code. It's the 4 digits located on the front of your card.").build();
        Prompt prompt6 = new Prompt.Builder().cardTypes(Prompt.CardType.AMEX).errorTypes(Prompt.ErrorType.TIMEOUT).for_(Prompt.For.SECURITY_CODE).say(say6).build();
        Say say7 = new Say.Builder("The card number you entered isn't from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.").build();
        Prompt prompt7 = new Prompt.Builder().errorTypes(Prompt.ErrorType.INVALID_CARD_TYPE).for_(Prompt.For.PAYMENT_CARD_NUMBER).say(say7).build();
        Say say8 = new Say.Builder("Please enter your 5 digit billing zip code.").build();
        Prompt prompt8 = new Prompt.Builder().for_(Prompt.For.POSTAL_CODE).say(say8).build();
        Say say9 = new Say.Builder("That was an invalid security code. The security code must be 4 digits. Please try again.").build();
        Prompt prompt9 = new Prompt.Builder().cardTypes(Prompt.CardType.AMEX).errorTypes(Prompt.ErrorType.INVALID_SECURITY_CODE).for_(Prompt.For.SECURITY_CODE).say(say9).build();
        Say say10 = new Say.Builder("That was an invalid security code. The security code must be 3 digits. Please try again.").build();
        Prompt prompt10 = new Prompt.Builder().cardTypes(Arrays.asList(Prompt.CardType.VISA, Prompt.CardType.MASTERCARD)).errorTypes(Prompt.ErrorType.INVALID_SECURITY_CODE).for_(Prompt.For.SECURITY_CODE).say(say10).build();
        Say say11 = new Say.Builder("You didn't enter your billing zip code. Please enter your 5 digit billing zip code.").build();
        Prompt prompt11 = new Prompt.Builder().errorTypes(Prompt.ErrorType.TIMEOUT).for_(Prompt.For.POSTAL_CODE).say(say11).build();
        Say say12 = new Say.Builder("Please enter your security code. It's the 3 digits located on the back of your card.").build();
        Prompt prompt12 = new Prompt.Builder().cardTypes(Arrays.asList(Prompt.CardType.VISA, Prompt.CardType.MASTERCARD)).for_(Prompt.For.SECURITY_CODE).say(say12).build();
        Say say13 = new Say.Builder("The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.").build();
        Prompt prompt13 = new Prompt.Builder().errorTypes(Prompt.ErrorType.INVALID_DATE).for_(Prompt.For.EXPIRATION_DATE).say(say13).build();
        Say say14 = new Say.Builder("You entered an invalid credit card number. Please try again.").build();
        Prompt prompt14 = new Prompt.Builder().errorTypes(Prompt.ErrorType.INVALID_CARD_NUMBER).for_(Prompt.For.PAYMENT_CARD_NUMBER).say(say14).build();
        Say say15 = new Say.Builder("Sorry. You didn't enter an expiration date. Please enter your card's expiration date. Two digits for the month and two digits for the year.").build();
        Prompt prompt15 = new Prompt.Builder().errorTypes(Prompt.ErrorType.TIMEOUT).for_(Prompt.For.EXPIRATION_DATE).say(say15).build();
        Say say16 = new Say.Builder("Please enter your security code. It's the 4 digits located on the front of your card.").build();
        Prompt prompt16 = new Prompt.Builder().cardTypes(Prompt.CardType.AMEX).for_(Prompt.For.SECURITY_CODE).say(say16).build();
        Pay pay = new Pay.Builder().paymentMethod(Pay.PaymentMethod.CREDIT_CARD).validCardTypes(Arrays.asList(Pay.ValidCardTypes.VISA, Pay.ValidCardTypes.MASTERCARD, Pay.ValidCardTypes.AMEX)).prompt(prompt).prompt(prompt2).prompt(prompt14).prompt(prompt7).prompt(prompt3).prompt(prompt15).prompt(prompt13).prompt(prompt12).prompt(prompt4).prompt(prompt10).prompt(prompt16).prompt(prompt6).prompt(prompt9).prompt(prompt8).prompt(prompt11).prompt(prompt5).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```go
package main

import (
	"fmt"

	"github.com/twilio/twilio-go/twiml"
)

func main() {
	twiml, _ := twiml.Voice([]twiml.Element{
		&twiml.VoicePay{
			PaymentMethod:  "security-code",
			ValidCardTypes: "visa mastercard amex",
			InnerElements: []twiml.Element{
				&twiml.VoicePrompt{
					For_: "payment-card-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your credit card number.",
						},
					},
				},
				&twiml.VoicePrompt{
					For_:                  "payment-card-number",
					ErrorType:             "timeout",
					RequireMatchingInputs: "true",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "You didn't enter your credit card number. Please enter your credit card number.",
						},
					},
				},
				&twiml.VoicePrompt{
					ErrorType: "invalid-card-number",
					For_:      "payment-card-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "You didn't enter your credit card number. Please enter your credit card number.",
						},
					},
				},
				&twiml.VoicePrompt{
					ErrorType: "input-card-type",
					For_:      "payment-card-number",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "The card number you entered isn't from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.",
						},
					},
				},
				&twiml.VoicePrompt{
					For_: "expiration-date",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your credit card's expiration date. Two digits for the month and two digits for the year.",
						},
					},
				},
				&twiml.VoicePrompt{
					ErrorType:             "timeout",
					For_:                  "expiration-date",
					RequireMatchingInputs: "true",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Sorry. You didn't enter an expiration date. Please enter your card's expiration date. Two digits for the month and two digits for the year.",
						},
					},
				},
				&twiml.VoicePrompt{
					ErrorType: "invalid-date",
					For_:      "expiration-date",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.",
						},
					},
				},
				&twiml.VoicePrompt{
					CardType: "visa mastercard",
					For_:     "security-code",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your security code. It's the 3 digits located on the back of your card.",
						},
					},
				},
				&twiml.VoicePrompt{
					CardType:  "visa mastercard",
					ErrorType: "timeout",
					For_:      "security-code",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "You didn't enter your credit card security code. Please enter your security code. It's the 3 digits located on the back of your card.",
						},
					},
				},
				&twiml.VoicePrompt{
					CardType:              "visa mastercard",
					ErrorType:             "invalid-security-code",
					For_:                  "security-code",
					RequireMatchingInputs: "true",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "That was an invalid security code. The security code must be 3 digits. Please try again.",
						},
					},
				},
				&twiml.VoicePrompt{
					CardType: "amex",
					For_:     "security-code",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your security code. It's the 4 digits located on the front of your card.",
						},
					},
				},
				&twiml.VoicePrompt{
					CardType:  "amex",
					ErrorType: "timeout",
					For_:      "security-code",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "You didn't enter your credit card security code.  Please enter your security code. It's the 4 digits located on the front of your card.",
						},
					},
				},
				&twiml.VoicePrompt{
					CardType:  "amex",
					ErrorType: "invalid-security-code",
					For_:      "security-code",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "That was an invalid security code. The security code must be 4 digits. Please try again.",
						},
					},
				},
				&twiml.VoicePrompt{
					For_: "postal-code",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Please enter your 5 digit billing zip code.",
						},
					},
				},
				&twiml.VoicePrompt{
					For_:      "postal-code",
					ErrorType: "timeout",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "You didn't enter your billing zip code. Please enter your 5 digit billing zip code.",
						},
					},
				},

				&twiml.VoicePrompt{
					For_: "payment-processing",
					InnerElements: []twiml.Element{
						&twiml.VoiceSay{
							Message: "Thank you. Please wait while we process your payment.",
						},
					},
				},
			},
		},
	})

	fmt.Print(twiml)
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay(['paymentMethod' => 'credit-card', 'validCardTypes' => 'visa mastercard amex']);
$prompt = $pay->prompt(['for' => 'payment-card-number']);
$prompt->say('Please enter your credit card number.');
$prompt2 = $pay->prompt(['for' => 'payment-card-number', 'errorType' => 'timeout']);
$prompt2->say('You didn\'t enter your credit card number. Please enter your credit card number.');
$prompt3 = $pay->prompt(['for' => 'payment-card-number', 'errorType' => 'invalid-card-number']);
$prompt3->say('You entered an invalid credit card number. Please try again.');
$prompt4 = $pay->prompt(['for' => 'payment-card-number', 'errorType' => 'invalid-card-type']);
$prompt4->say('The card number you entered isn\'t from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.');
$prompt5 = $pay->prompt(['for' => 'expiration-date']);
$prompt5->say('Please enter your credit card\'s expiration date. Two digits for the month and two digits for the year.');
$prompt6 = $pay->prompt(['for' => 'expiration-date', 'errorType' => 'timeout']);
$prompt6->say('Sorry. You didn\'t enter an expiration date. Please enter your card\'s expiration date. Two digits for the month and two digits for the year.');
$prompt7 = $pay->prompt(['for' => 'expiration-date', 'errorType' => 'invalid-date']);
$prompt7->say('The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.');
$prompt8 = $pay->prompt(['for' => 'security-code', 'cardType' => 'visa mastercard']);
$prompt8->say('Please enter your security code. It\'s the 3 digits located on the back of your card.');
$prompt9 = $pay->prompt(['for' => 'security-code', 'errorType' => 'timeout', 'cardType' => 'visa mastercard']);
$prompt9->say('You didn\'t enter your credit card security code. Please enter your security code. It\'s the 3 digits located on the back of your card.');
$prompt10 = $pay->prompt(['for' => 'security-code', 'errorType' => 'invalid-security-code', 'cardType' => 'visa mastercard']);
$prompt10->say('That was an invalid security code. The security code must be 3 digits. Please try again.');
$prompt11 = $pay->prompt(['for' => 'security-code', 'cardType' => 'amex']);
$prompt11->say('Please enter your security code. It\'s the 4 digits located on the front of your card.');
$prompt12 = $pay->prompt(['for' => 'security-code', 'errorType' => 'timeout', 'cardType' => 'amex']);
$prompt12->say('You didn\'t enter your credit card security code.  Please enter your security code. It\'s the 4 digits located on the front of your card.');
$prompt13 = $pay->prompt(['for' => 'security-code', 'errorType' => 'invalid-security-code', 'cardType' => 'amex']);
$prompt13->say('That was an invalid security code. The security code must be 4 digits. Please try again.');
$prompt14 = $pay->prompt(['for' => 'postal-code']);
$prompt14->say('Please enter your 5 digit billing zip code.');
$prompt15 = $pay->prompt(['for' => 'postal-code', 'errorType' => 'timeout']);
$prompt15->say('You didn\'t enter your billing zip code. Please enter your 5 digit billing zip code.');
$prompt16 = $pay->prompt(['for' => 'payment-processing']);
$prompt16->say('Thank you. Please wait while we process your payment.');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay(payment_method: 'credit-card', valid_card_types: 'visa mastercard amex') do |pay|
    pay.prompt(for: 'payment-card-number') do |prompt|
        prompt.say(message: 'Please enter your credit card number.')
end
    pay.prompt(for: 'payment-card-number', error_type: 'timeout') do |prompt2|
        prompt2.say(message: "You didn't enter your credit card number. Please enter your credit card number.")
end
    pay.prompt(for: 'payment-card-number', error_type: 'invalid-card-number') do |prompt3|
        prompt3.say(message: 'You entered an invalid credit card number. Please try again.')
end
    pay.prompt(for: 'payment-card-number', error_type: 'invalid-card-type') do |prompt4|
        prompt4.say(message: "The card number you entered isn't from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.")
end
    pay.prompt(for: 'expiration-date') do |prompt5|
        prompt5.say(message: "Please enter your credit card's expiration date. Two digits for the month and two digits for the year.")
end
    pay.prompt(for: 'expiration-date', error_type: 'timeout') do |prompt6|
        prompt6.say(message: "Sorry. You didn't enter an expiration date. Please enter your card's expiration date. Two digits for the month and two digits for the year.")
end
    pay.prompt(for: 'expiration-date', error_type: 'invalid-date') do |prompt7|
        prompt7.say(message: 'The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.')
end
    pay.prompt(for: 'security-code', card_type: 'visa mastercard') do |prompt8|
        prompt8.say(message: "Please enter your security code. It's the 3 digits located on the back of your card.")
end
    pay.prompt(for: 'security-code', error_type: 'timeout', card_type: 'visa mastercard') do |prompt9|
        prompt9.say(message: "You didn't enter your credit card security code. Please enter your security code. It's the 3 digits located on the back of your card.")
end
    pay.prompt(for: 'security-code', error_type: 'invalid-security-code', card_type: 'visa mastercard') do |prompt10|
        prompt10.say(message: 'That was an invalid security code. The security code must be 3 digits. Please try again.')
end
    pay.prompt(for: 'security-code', card_type: 'amex') do |prompt11|
        prompt11.say(message: "Please enter your security code. It's the 4 digits located on the front of your card.")
end
    pay.prompt(for: 'security-code', error_type: 'timeout', card_type: 'amex') do |prompt12|
        prompt12.say(message: "You didn't enter your credit card security code.  Please enter your security code. It's the 4 digits located on the front of your card.")
end
    pay.prompt(for: 'security-code', error_type: 'invalid-security-code', card_type: 'amex') do |prompt13|
        prompt13.say(message: 'That was an invalid security code. The security code must be 4 digits. Please try again.')
end
    pay.prompt(for: 'postal-code') do |prompt14|
        prompt14.say(message: 'Please enter your 5 digit billing zip code.')
end
    pay.prompt(for: 'postal-code', error_type: 'timeout') do |prompt15|
        prompt15.say(message: "You didn't enter your billing zip code. Please enter your 5 digit billing zip code.")
end
    pay.prompt(for: 'payment-processing') do |prompt16|
        prompt16.say(message: 'Thank you. Please wait while we process your payment.')
end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Pay paymentMethod="credit-card" validCardTypes="visa mastercard amex">
    <!-- Prompts for credit card number -->
    <Prompt for="payment-card-number">
      <Say>Please enter your credit card number.</Say>
    </Prompt>
    <Prompt for="payment-card-number" errorType="timeout">
      <Say>You didn't enter your credit card number. Please enter your credit card number.</Say>
    </Prompt>
    <Prompt for="payment-card-number" errorType="invalid-card-number">
      <Say>You entered an invalid credit card number. Please try again.</Say>
    </Prompt>
    <Prompt for="payment-card-number" errorType="invalid-card-type">
      <Say>The card number you entered isn't from one of our accepted credit card issuers. Please enter a Visa, MasterCard, or American Express credit card number.</Say>
    </Prompt>
    <!-- Prompts for expiration date -->
    <Prompt for="expiration-date">
      <Say>Please enter your credit card's expiration date. Two digits for the month and two digits for the year.</Say>
    </Prompt>
    <Prompt for="expiration-date" errorType="timeout">
      <Say>Sorry. You didn't enter an expiration date. Please enter your card's expiration date. Two digits for the month and two digits for the year.</Say>
    </Prompt>
    <Prompt for="expiration-date" errorType="invalid-date">
      <Say>The date you entered was incorrect or is in the past. Please enter the expiration date. Two digits for the month and two digits for the year. For example, to enter July twenty twenty two, enter 0 7 2 2.</Say>
    </Prompt>
    <!-- Prompts for three-digit security code -->
    <Prompt for="security-code" cardType="visa mastercard">
      <Say>Please enter your security code. It's the 3 digits located on the back of your card.</Say>
    </Prompt>
    <Prompt for="security-code" errorType="timeout" cardType="visa mastercard">
      <Say>You didn't enter your credit card security code. Please enter your security code. It's the 3 digits located on the back of your card.</Say>
    </Prompt>
    <Prompt for="security-code" errorType="invalid-security-code" cardType="visa mastercard">
      <Say>That was an invalid security code. The security code must be 3 digits. Please try again.</Say>
    </Prompt>
    <!-- Prompts for four-digit security code (American Express) -->
    <Prompt for="security-code" cardType="amex">
      <Say>Please enter your security code. It's the 4 digits located on the front of your card.</Say>
    </Prompt>
    <Prompt for="security-code" errorType="timeout" cardType="amex">
      <Say>You didn't enter your credit card security code.  Please enter your security code. It's the 4 digits located on the front of your card.</Say>
    </Prompt>
    <Prompt for="security-code" errorType="invalid-security-code" cardType="amex">
      <Say>That was an invalid security code. The security code must be 4 digits. Please try again.</Say>
    </Prompt>
    <!-- Prompts for postal/zip code -->
    <Prompt for="postal-code">
      <Say>Please enter your 5 digit billing zip code.</Say>
    </Prompt>
    <Prompt for="postal-code" errorType="timeout">
      <Say>You didn't enter your billing zip code. Please enter your 5 digit billing zip code.</Say>
    </Prompt>
    <!-- Prompt after customer has entered all payment information -->
    <Prompt for="payment-processing">
      <Say>Thank you. Please wait while we process your payment.</Say>
    </Prompt>
  </Pay>
</Response>
```

### Customize prompts for ACH payments

The following examples show the TwiML you can use to customize all prompts for `<Pay>` when accepting an ACH payment:

A full example for an ACH/debit transaction

```js
const VoiceResponse = require('twilio').twiml.VoiceResponse;

const response = new VoiceResponse();
const pay = response.pay({
    timeout: '5',
    maxAttempts: '3',
    paymentMethod: 'ach-debit',
    language: 'en-US'
});
const prompt = pay.prompt({
    for: 'bank-routing-number'
});
prompt.say('Please enter your bank routing number.');
const prompt2 = pay.prompt({
    for: 'bank-routing-number',
    errorType: 'timeout'
});
prompt2.say('You didn\'t enter your routing number. Please enter your bank routing number.');
const prompt3 = pay.prompt({
    for: 'bank-routing-number',
    errorType: 'invalid-bank-routing-number'
});
prompt3.say('That was an invalid bank routing number. Please try again.');
const prompt4 = pay.prompt({
    for: 'bank-account-number'
});
prompt4.say('Please enter your bank account number.');
const prompt5 = pay.prompt({
    for: 'bank-account-number',
    errorType: 'timeout'
});
prompt5.say('You didn\'t enter your bank account number. Please enter your bank account number.');
const prompt6 = pay.prompt({
    for: 'payment-processing'
});
prompt6.say('Thank you. Please wait while we process your payment.');

console.log(response.toString());
```

```py
from twilio.twiml.voice_response import Pay, Prompt, VoiceResponse, Say

response = VoiceResponse()
pay = Pay(
    timeout='5',
    max_attempts='3',
    payment_method='ach-debit',
    language='en-US')
prompt = Prompt(for_='bank-routing-number')
prompt.say('Please enter your bank routing number.')
pay.append(prompt)
prompt2 = Prompt(error_type='timeout', for_='bank-routing-number')
prompt2.say('You didn\'t enter your routing number. Please enter your bank routing number.')
pay.append(prompt2)
prompt3 = Prompt(error_type='invalid-bank-routing-number', for_='bank-routing-number')
prompt3.say('That was an invalid bank routing number. Please try again.')
pay.append(prompt3)
prompt4 = Prompt(for_='bank-account-number')
prompt4.say('Please enter your bank account number.')
pay.append(prompt4)
prompt5 = Prompt(error_type='timeout', for_='bank-account-number')
prompt5.say('You didn\'t enter your bank account number. Please enter your bank account number.')
pay.append(prompt5)
prompt6 = Prompt(for_='payment-processing')
prompt6.say('Thank you. Please wait while we process your payment.')
pay.append(prompt6)
response.append(pay)

print(response)
```

```cs
using System;
using Twilio.TwiML;
using Twilio.TwiML.Voice;
using System.Linq;

class Example
{
    static void Main()
    {
        var response = new VoiceResponse();
        var pay = new Pay(timeout: 5, maxAttempts: 3, paymentMethod: Pay.PaymentMethodEnum.AchDebit, language: "en-US");
        var prompt = new Prompt(for_: Prompt.ForEnum.BankRoutingNumber);
        prompt.Say("Please enter your bank routing number.");
        pay.Append(prompt);
        var prompt2 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.Timeout}.ToList(), for_: Prompt.ForEnum.BankRoutingNumber);
        prompt2.Say("You didn't enter your routing number. Please enter your bank routing number.");
        pay.Append(prompt2);
        var prompt3 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.InvalidBankRoutingNumber}.ToList(), for_: Prompt.ForEnum.BankRoutingNumber);
        prompt3.Say("That was an invalid bank routing number. Please try again.");
        pay.Append(prompt3);
        var prompt4 = new Prompt(for_: Prompt.ForEnum.BankAccountNumber);
        prompt4.Say("Please enter your bank account number.");
        pay.Append(prompt4);
        var prompt5 = new Prompt(errorType: new []{Prompt.ErrorTypeEnum.Timeout}.ToList(), for_: Prompt.ForEnum.BankAccountNumber);
        prompt5.Say("You didn't enter your bank account number. Please enter your bank account number.");
        pay.Append(prompt5);
        var prompt6 = new Prompt(for_: Prompt.ForEnum.PaymentProcessing);
        prompt6.Say("Thank you. Please wait while we process your payment.");
        pay.Append(prompt6);
        response.Append(pay);

        Console.WriteLine(response.ToString());
    }
}
```

```java
import com.twilio.twiml.voice.Pay;
import com.twilio.twiml.voice.Prompt;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;


public class Example {
    public static void main(String[] args) {
        Say say = new Say.Builder("Please enter your bank routing number.").build();
        Prompt prompt = new Prompt.Builder().for_(Prompt.For.BANK_ROUTING_NUMBER).say(say).build();
        Say say2 = new Say.Builder("Thank you. Please wait while we process your payment.").build();
        Prompt prompt2 = new Prompt.Builder().for_(Prompt.For.PAYMENT_PROCESSING).say(say2).build();
        Say say3 = new Say.Builder("That was an invalid bank routing number. Please try again.").build();
        Prompt prompt3 = new Prompt.Builder().errorTypes(Prompt.ErrorType.INVALID_BANK_ROUTING_NUMBER).for_(Prompt.For.BANK_ROUTING_NUMBER).say(say3).build();
        Say say4 = new Say.Builder("You didn't enter your bank account number. Please enter your bank account number.").build();
        Prompt prompt4 = new Prompt.Builder().errorTypes(Prompt.ErrorType.TIMEOUT).for_(Prompt.For.BANK_ACCOUNT_NUMBER).say(say4).build();
        Say say5 = new Say.Builder("Please enter your bank account number.").build();
        Prompt prompt5 = new Prompt.Builder().for_(Prompt.For.BANK_ACCOUNT_NUMBER).say(say5).build();
        Say say6 = new Say.Builder("You didn't enter your routing number. Please enter your bank routing number.").build();
        Prompt prompt6 = new Prompt.Builder().errorTypes(Prompt.ErrorType.TIMEOUT).for_(Prompt.For.BANK_ROUTING_NUMBER).say(say6).build();
        Pay pay = new Pay.Builder().timeout(5).maxAttempts(3).paymentMethod(Pay.PaymentMethod.ACH_DEBIT).language(Pay.Language.EN_US).prompt(prompt).prompt(prompt6).prompt(prompt3).prompt(prompt5).prompt(prompt4).prompt(prompt2).build();
        VoiceResponse response = new VoiceResponse.Builder().pay(pay).build();

        try {
            System.out.println(response.toXml());
        } catch (TwiMLException e) {
            e.printStackTrace();
        }
    }
}
```

```php
<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$pay = $response->pay(['timeout' => '5', 'maxAttempts' => '3', 'paymentMethod' => 'ach-debit', 'language' => 'en-US']);
$prompt = $pay->prompt(['for' => 'bank-routing-number']);
$prompt->say('Please enter your bank routing number.');
$prompt2 = $pay->prompt(['for' => 'bank-routing-number', 'errorType' => 'timeout']);
$prompt2->say('You didn\'t enter your routing number. Please enter your bank routing number.');
$prompt3 = $pay->prompt(['for' => 'bank-routing-number', 'errorType' => 'invalid-bank-routing-number']);
$prompt3->say('That was an invalid bank routing number. Please try again.');
$prompt4 = $pay->prompt(['for' => 'bank-account-number']);
$prompt4->say('Please enter your bank account number.');
$prompt5 = $pay->prompt(['for' => 'bank-account-number', 'errorType' => 'timeout']);
$prompt5->say('You didn\'t enter your bank account number. Please enter your bank account number.');
$prompt6 = $pay->prompt(['for' => 'payment-processing']);
$prompt6->say('Thank you. Please wait while we process your payment.');

echo $response;
```

```rb
require 'twilio-ruby'

response = Twilio::TwiML::VoiceResponse.new
response.pay(timeout: '5', max_attempts: '3', payment_method: 'ach-debit', language: 'en-US') do |pay|
    pay.prompt(for: 'bank-routing-number') do |prompt|
        prompt.say(message: 'Please enter your bank routing number.')
end
    pay.prompt(for: 'bank-routing-number', error_type: 'timeout') do |prompt2|
        prompt2.say(message: "You didn't enter your routing number. Please enter your bank routing number.")
end
    pay.prompt(for: 'bank-routing-number', error_type: 'invalid-bank-routing-number') do |prompt3|
        prompt3.say(message: 'That was an invalid bank routing number. Please try again.')
end
    pay.prompt(for: 'bank-account-number') do |prompt4|
        prompt4.say(message: 'Please enter your bank account number.')
end
    pay.prompt(for: 'bank-account-number', error_type: 'timeout') do |prompt5|
        prompt5.say(message: "You didn't enter your bank account number. Please enter your bank account number.")
end
    pay.prompt(for: 'payment-processing') do |prompt6|
        prompt6.say(message: 'Thank you. Please wait while we process your payment.')
end
end

puts response
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Pay timeout="5" maxAttempts="3" paymentMethod="ach-debit" language="en-US">
    <Prompt for="bank-routing-number">
      <Say>Please enter your bank routing number.</Say>
    </Prompt>
    <Prompt for="bank-routing-number" errorType="timeout">
      <Say>You didn't enter your routing number. Please enter your bank routing number.</Say>
    </Prompt>
    <Prompt for="bank-routing-number" errorType="invalid-bank-routing-number">
      <Say>That was an invalid bank routing number. Please try again.</Say>
    </Prompt>
    <Prompt for="bank-account-number">
      <Say>Please enter your bank account number.</Say>
    </Prompt>
    <Prompt for="bank-account-number" errorType="timeout">
      <Say>You didn't enter your bank account number. Please enter your bank account number.</Say>
    </Prompt>
    <Prompt for="payment-processing">
      <Say>Thank you. Please wait while we process your payment.</Say>
    </Prompt>
  </Pay>
</Response>
```
