
To set up Twilio Pay, you'll need to create a Twilio account and enable the Twilio Pay feature. This will give you access to the Twilio Pay dashboard, where you can manage your payments and configure your settings.
First, navigate to the Twilio Pay dashboard and click on the "Settings" icon in the top right corner. From there, you can configure your payment methods, including linking your bank account or credit card.
To link a bank account, you'll need to enter your account information, including your account number and routing number. This will allow you to receive payments directly into your bank account.
Once you've linked a bank account, you can configure your payment settings, including setting up payment schedules and notifications.
Attributes and Parameters
Twilio Pay allows you to modify its default behavior with various attributes. The input attribute can be set to dtmf, which is its default value.
You can also specify a custom action URL, which must use HTTPS and supports POST only. The statusCallback attribute is a relative or absolute URL, and it defaults to none.
Twilio Pay supports several payment methods, including ach-debit and credit-card, with credit-card being the default. You can also set the bankAccountType attribute to consumer-checking, consumer-savings, or commercial-checking, with consumer-checking being the default.
Here are some key attributes and their allowed values:
Twilio also allows you to send custom parameters in the request to the payment processor, as well as receive custom parameters from the payment processor. These custom parameters can be added as properties on the POST request body to your action URL.
A different take: Payment Processor
Charge Amount
The chargeAmount attribute is a crucial part of processing payments, and it's essential to understand how it works. It takes a decimal value with no currency prefix and defaults to USD.
If you want to process a payment, you'll need to set a value for chargeAmount, which will make the transaction a charge transaction. If the value is greater than 0, the transaction will be a charge transaction.

You can use chargeAmount="20.45" to process a payment in the amount of $20.45, for example. The chargeAmount attribute can be overridden with a specific currency, but it defaults to USD.
To make a tokenize transaction, simply omit the chargeAmount attribute or set its value to 0. This will allow you to tokenize the payment without charging the customer.
TokenType
The tokenType attribute is a crucial setting when working with tokens. It can take either one-time or reusable as its value.
If you need to generate a one-time token, use tokenType="one-time". This is perfect for situations where you want to charge a customer once.
For recurring payments, tokenType="reusable" is the way to go. This allows you to store a customer's payment information for future use.
Stripe Pay Connector users should note that payment-method is also a possible value for tokenType.
Error Handling and Retry
When your payment processor fails to respond, Twilio will retry the request up to 5 times, passing the same transaction_id in the retried request.
Twilio expects the payment processor to handle the retried request properly, especially if the transaction is still in progress. If the transaction succeeds after more than 10 seconds from the initial request, the charge_id should be returned to the retry request made by Twilio.
In the case of a duplicate transaction, the payment processor should either return an error stating it was a duplicate transaction or return the original charge_id/token_id from the first attempted response to Twilio. This is where the transaction_id acts as an idempotency token to avoid duplicate charges.
Curious to learn more? Check out: Etsy Payment Processor
Error Handling and Retry
If the payment processor fails to respond to Twilio's request within 10 seconds, Twilio will retry the request up to 5 times.
This retry logic is crucial to ensure that transactions are processed correctly, even if there's a temporary delay in communication. The transaction_id behaves as an idempotency token to avoid duplicate charges done by the payment processor in the case where a response is dropped in transit to Twilio.
Twilio expects the payment processor to handle the retried request properly, returning the original charge_id or token_id if the transaction is still in progress and succeeds after more than 10 seconds from the initial request.
It's essential to note that if a duplicate transaction is attempted, the payment processor should either return an error stating it was a duplicate transaction or return the original charge_id/token_id. This ensures that the transaction is processed correctly and efficiently.
Related reading: Original Brand Manufacturer
Error Response Structure
When an error occurs, Twilio expects a specific error response structure from the payment processor. The charge_id field is required in the response for a charge error.
In case of a tokenize error, the token_id field is expected. The parameters field is optional.
The payment processor will return an object with an ID number for the charge transaction, any applicable error code/message, and custom parameters if necessary. This object should contain a "charge_id" property with a value of some identification number associated with the charge transaction.
Here's an interesting read: Crowd Strike Error
Testing and Prerequisites
To get started with Twilio Pay, you'll need to complete some prerequisites. First, you'll need to own a Twilio Voice-enabled phone number, which can be purchased through the Twilio Console.
To buy a phone number, navigate to the Buy a Number page, check the "Voice" checkbox, and click the Search button. You'll see a list of available phone numbers and their capabilities, so find one you like and click the Buy button.
In order to use Twilio's Pay Connectors, you must enable PCI mode in the Twilio Console. This ensures Twilio captures payment details in a PCI-compliant manner and redacts sensitive PCI information from all call logs.
To enable PCI Mode, navigate to the Twilio Voice Settings in the Twilio Console, click on the Enable PCI Mode button, and then agree to Twilio's Terms of Service by clicking the I Agree button.
Here are the steps to buy a phone number and enable PCI mode:
- Buy a Twilio Voice-enabled phone number through the Twilio Console.
- Enable PCI Mode in the Twilio Console by navigating to Voice Settings, clicking Enable PCI Mode, and agreeing to Twilio's Terms of Service.
Prerequisites

To start testing and setting up Twilio, you'll need to meet a few prerequisites. First, you'll need to own a Twilio Voice-enabled phone number. You can buy one by navigating to the Buy a Number page in the Twilio Console and searching for a number that suits your needs.
To use Twilio's Pay Connectors, you'll need to enable PCI mode in the Twilio Console. This ensures that Twilio captures payment details in a PCI-compliant manner and redacts sensitive PCI information from all call logs.
To enable PCI Mode, follow these steps:
- Navigate to the Twilio Voice Settings in the Twilio Console.
- Click on the Enable PCI Mode button.
- Click on I Agree on the pop-up to accept Twilio's Terms of Service.
- Click on the Save button.
Go Live and Supported Features
To go live with Twilio Pay, you'll need to contact Twilio Support for approval. They'll require the latest, non-expired Attestation of Compliance (AOC) from your payment gateway, the URL of your payment gateway, and confirmation that you've reviewed the PCI-compliance of your downstream payment gateway.
Once approved, you can move your Connector to LIVE mode in the Console, and your payment gateway URL will become immutable. This means you can no longer change it.
Check this out: Gateway Coal Co. V. Mine Workers
Here are the specific requirements for approval:
- Latest, non-expired Attestation of Compliance (AOC) from your payment gateway
- URL of your payment gateway
- Confirmation that you've reviewed the PCI-compliance of your downstream payment gateway
If you need to change the payment gateway URL after switching to LIVE mode, you'll need to open a Support ticket with the same information.
Go Live with Connector
To go live with your connector, you'll need to contact Twilio Support for approval. They'll ask for some specific information, so it's best to have it ready.
You'll need to submit the latest, non-expired Attestation of Compliance (AOC) from your payment gateway. This document is crucial for Twilio to validate your payment gateway's compliance.
The URL of your payment gateway will also be required. Make sure it's accurate and up-to-date.
Twilio will also need confirmation that you've reviewed the PCI-compliance of your downstream payment gateway. This is a critical step in ensuring the security of your payment processing.
Here's a list of the required information:
- Latest, non-expired Attestation of Compliance (AOC) from your payment gateway
- URL of your payment gateway
- Confirmation of PCI-compliance review for your downstream payment gateway
Once approved, you can move your connector to live mode in the Twilio Console. Your payment gateway URL will become immutable, so make sure it's correct before submitting the request.
If you need to change the payment gateway URL after switching to live mode, you'll need to open a support ticket with the same information.
A fresh viewpoint: Pci Dss Payment Gateway
Supported Transaction Types

Twilio supports two transaction types: charge and tokenize.
With these two transaction types, you can easily integrate payment functionality into your application.
A charge transaction is a straightforward payment method, where the customer's payment method is charged directly.
Tokenize transactions, on the other hand, store sensitive payment information securely, allowing for easier checkout processes in the future.
Frequently Asked Questions
How much does Twilio pay?
Twilio salaries in the US range from around $79,000 to $265,703 per year, depending on the role. Hourly pay can vary from $21.64 to $150 per hour.
Featured Images: pexels.com


