Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Capture Payments

Studio uses Widgets to represent various parts of Twilio's API that can then be stitched together in your Studio Flow to build out robust applications that require no coding on your part.



New to Twilio Studio? Check out our Getting Started guide!

The Capture Payments Widget allows you to securely capture credit card details on a call and either tokenize or process a payment using a Payment Gateway. This widget uses the underlying TwiML verb <Pay>.

Capture Payments widget.


Use of Capture Payments requires PCI Mode to be enabled in Voice Settings(link takes you to an external page). The Widget may not appear in your Widget Library for a couple of minutes after toggling this setting to true.



Currently, the Capture Payments Widget only supports Stripe Pay Connector so you can use this Widget to perform charge and tokenize transactions using Stripe Payment Gateway.

Optional Configuration for Capture Payments

optional-configuration-for-capture-payments page anchor

The Capture Payments Widget also accepts a number of configuration options that you can use to configure the call language, max attempts, the duration before timeout, credit card types accepted, and other payment properties.

TimeoutSets the limit in seconds to wait for the caller to press another digit before moving on to validate the digits captured.5
Max AttemptsNumber of times to retry when collecting information.2
LanguageLanguage to speak when prompting the caller for credit card details.empty
Valid Card TypesCredit card types that should be accepted. Allows multiple values.empty
Request Security CodeWhether to prompt for credit card security code.true
Request Postal CodeWhether to prompt for credit card postal code.true
Pay ConnectorUnique Name corresponding to the Payment Gateway Connector installed in Twilio Add-onsempty
Payment Token TypeSelect one-time payment or reusable payment.Reusable
Charge Card with AmountAmount to be charged.empty
CurrencyCurrency to use when charging the card.US Dollar (USD)
DescriptionDescription of the payment.empty
Minimum Postal Code LengthMinimum length of postal code if Request Postal Code is set to true.empty
Payment MethodThe payment method to be used (credit-card or ach-debit)credit-card
Bank Account TypeBank account type being charged if using ach-debit as the Payment Methodconsumer-checking

Capture Payments Transitions

capture-payments-transitions page anchor

These events trigger transitions from this Widget to another Widget in your Flow. For more information on working with Studio transitions, see this guide.

SuccessPayment has completed successfully.
Max Failed AttemptsMaximum number of failed attempts has been reached.
Provider ErrorError communicating with Payment Provider.
Pay InterruptedPayment process interrupted by caller pressing *.
Hang UpCaller hung up during payment process.
Validation ErrorInvalid attributes received.

Capture Payments Variables

capture-payments-variables page anchor

When the Capture Payments Widget executes, it will have stored the following variables for use throughout your Studio Flow (where MY_WIDGET_NAME is the name of your actual widget). For more information on working with variables in Studio, see this guide.

Find definitions and examples for these variables at the Payment page.

NameLiquid Template Language
Expiration Date{{widgets.MY_WIDGET_NAME.ExpirationDate}}
Payment Card Number{{widgets.MY_WIDGET_NAME.PaymentCardNumber}}
Payment Card Postal Code{{widgets.MY_WIDGET_NAME.PaymentCardPostalCode}}
Payment Card Type{{widgets.MY_WIDGET_NAME.PaymentCardType}}
Payment Confirmation Code{{widgets.MY_WIDGET_NAME.PaymentConfirmationCode}}
Payment Token{{widgets.MY_WIDGET_NAME.PaymentToken}}
Security Code{{widgets.MY_WIDGET_NAME.SecurityCode}}

Example: Service Payment

example-service-payment page anchor

This example shows a Flow that enables a customer to pay for their order. The customer will press 1 to confirm the total amount to be charged before they are prompted with questions about their payment information. The call will then notify the customer if their payment was successful. Notice that the connector is not specified which would mean the default Pay Connector is used (the connector with the unique name Default associated with your account).

Twilio Studio Capture Payments Widget Example Updated.


Learn how to set up your payment provider with Twilio in How to capture your first payment using <Pay>.

Now that you know the basics of the Capture Payments Widget, you may want to learn more about Payments:

  • Learn all properties of Payments in the Payment documentation
  • Learn more about the TwiML <Pay> verb that powers this Widget

We can't wait to see what you build!

Rate this page: