Create an instance of payments
Twilio enabled secure payments solution for accepting credit and ACH payments over the phone.
create an instance of payments. This will start a new payments session
Path parameters
-
The SID of the Account that will create the resource.
-
The SID of the call that will create the resource. Call leg associated with this sid is expected to provide payment information thru DTMF.
Body
-
BankAccountType string
Type of bank account if payment source is ACH. One of
consumer-checking
,consumer-savings
, orcommercial-checking
. The default value isconsumer-checking
.Values are
consumer-checking
,consumer-savings
, orcommercial-checking
. -
ChargeAmount number
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. -
Currency string
The currency of the
charge_amount
, formatted as ISO 4127 format. The default value isUSD
and all values allowed from theConnector are accepted. -
Description string
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.
-
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.
-
Input string
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. -
MinPostalCodeLength integer
A positive integer that is used to validate the length of the
PostalCode
inputted by the user. User must enter this many digits. -
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
Connector. Read more. -
PaymentConnector string
This is the unique name corresponding to the Payment Gateway Connector installed in the Twilio Add-ons. Learn more about
Connectors . The default value isDefault
. -
PaymentMethod string
Type of payment being captured. One of
credit-card
orach-debit
. The default value iscredit-card
.Values are
credit-card
orach-debit
. -
PostalCode boolean
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
. -
SecurityCode boolean
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
. -
Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the expected StatusCallback values
-
Timeout integer
The number of seconds that
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 is600
. -
TokenType string
Indicates whether the payment method should be tokenized as a
one-time
orreusable
token. The default value isreusable
. Do not enter a charge amount when tokenizing. If a charge amount is entered, the payment method will be charged and not tokenized.Values are
one-time
orreusable
. -
ValidCardTypes string
Credit card types separated by space that Pay should accept. The default value is
visa mastercard amex
curl \
-X POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments.json \
--user "username:password" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'BankAccountType=consumer-checking&ChargeAmount=42.0&Currency=string&Description=string&IdempotencyKey=string&Input=string&MinPostalCodeLength=42&PaymentConnector=string&PaymentMethod=credit-card&PostalCode=true&SecurityCode=true&StatusCallback=https%3A%2F%2Fexample.com&Timeout=42&TokenType=one-time&ValidCardTypes=string'
{
"BankAccountType": "consumer-checking",
"ChargeAmount": 42.0,
"Currency": "string",
"Description": "string",
"IdempotencyKey": "string",
"Input": "string",
"MinPostalCodeLength": 42,
"PaymentConnector": "string",
"PaymentMethod": "credit-card",
"PostalCode": true,
"SecurityCode": true,
"StatusCallback": "https://example.com",
"Timeout": 42,
"TokenType": "one-time",
"ValidCardTypes": "string"
}
{
"BankAccountType": "consumer-checking",
"ChargeAmount": 42.0,
"Currency": "string",
"Description": "string",
"IdempotencyKey": "string",
"Input": "string",
"MinPostalCodeLength": 42,
"PaymentConnector": "string",
"PaymentMethod": "credit-card",
"PostalCode": true,
"SecurityCode": true,
"StatusCallback": "https://example.com",
"Timeout": 42,
"TokenType": "one-time",
"ValidCardTypes": "string"
}
{
"account_sid": "string",
"call_sid": "string",
"date_created": "string",
"date_updated": "string",
"sid": "string",
"uri": "https://example.com"
}
{
"account_sid": "string",
"call_sid": "string",
"date_created": "string",
"date_updated": "string",
"sid": "string",
"uri": "https://example.com"
}