NAME

Twilio::Rest::Api::V2010::Account::Call::Payment - The Payment resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $payment = $client->calls($call_sid)->payments->create($idempotency_key, $status_callback, \%options);
$client->calls($call_sid)->payments($sid)->update($idempotency_key, $status_callback, \%options);

DESCRIPTION

Twilio enabled secure payments solution for accepting credit and ACH payments over the phone.

This file holds PaymentList, PaymentContext and PaymentInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

PaymentList

Returned by $client->calls($call_sid)->payments. See also Twilio::ListResource.

create

my $payment = $client->calls($call_sid)->payments->create($idempotency_key, $status_callback, \%options);

create an instance of payments. This will start a new payments session. Returns a PaymentInstance.

The required values are:

$idempotency_key

A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated.

$status_callback

Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the expected StatusCallback values

The options are:

bank_account_type

One of consumer-checking, consumer-savings or commercial-checking.

charge_amount

A positive decimal value less than 1,000,000 to charge against the credit card or bank account. Default currency can be overwritten with currency field. Leave blank or set to 0 to tokenize.

confirmation

Whether to prompt the caller to confirm their payment information before submitting to the payment gateway. If true, the caller will hear the last 4 digits of their card or account number and must press 1 to confirm or 2 to cancel. Default is false. One of true or false.

currency

The currency of the charge_amount, formatted as ISO 4127 format. The default value is USD and all values allowed from the Pay Connector are accepted.

description

The description can be used to provide more details regarding the transaction. This information is submitted along with the payment details to the Payment Connector which are then posted on the transactions.

input

A list of inputs that should be accepted. Currently only dtmf is supported. All digits captured during a pay session are redacted from the logs.

min_postal_code_length

A positive integer that is used to validate the length of the PostalCode inputted by the user. User must enter this many digits.

parameter

A single-level JSON object used to pass custom parameters to payment processors. (Required for ACH payments). The information that has to be included here depends on the <Pay> Connector. Read more. A hash or array reference, or a string of JSON.

payment_connector

This is the unique name corresponding to the Pay Connector installed in the Twilio Add-ons. Learn more about <Pay> Connectors. The default value is Default.

payment_method

One of credit-card or ach-debit.

postal_code

Indicates whether the credit card postal code (zip code) is a required piece of payment information that must be provided by the caller. The default is true.

require_matching_inputs

A comma-separated list of payment information fields that require the caller to enter the same value twice for confirmation. Supported values are payment-card-number, expiration-date, security-code, and postal-code.

security_code

Indicates whether the credit card security code is a required piece of payment information that must be provided by the caller. The default is true.

timeout

The number of seconds that <Pay> should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is 5, maximum is 600.

token_type

One of one-time, reusable or payment-method.

valid_card_types

Credit card types separated by space that Pay should accept. The default value is visa mastercard amex

get_context

my $context = $client->calls($call_sid)->payments->get_context($sid);

Returns a PaymentContext, and makes no request.

PaymentContext

Returned by $client->calls($call_sid)->payments($sid). It makes no request until one of these methods is called.

update

my $payment = $client->calls($call_sid)->payments($sid)->update($idempotency_key, $status_callback, \%options);

update an instance of payments with different phases of payment flows. Returns a PaymentInstance.

The required values are:

$idempotency_key

A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated.

$status_callback

Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the Update and Complete/Cancel POST requests.

The options are:

capture

One of payment-card-number, expiration-date, security-code, postal-code, bank-routing-number, bank-account-number, payment-card-number-matcher, expiration-date-matcher, security-code-matcher or postal-code-matcher.

status

One of complete or cancel.

PaymentInstance

See also Twilio::InstanceResource.

It has update, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account that created the Payments resource.

call_sid

The SID of the Call the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF.

date_created

The date and time in GMT that the resource was created specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT that the resource was last updated specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

sid

The SID of the Payments resource.

uri

The URI of the resource, relative to https://api.twilio.com.

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.