Create an instance of payments

POST /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments.json

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

  • AccountSid string Required

    The SID of the Account that will create the resource.

  • CallSid string Required

    The SID of the call that will create the resource. Call leg associated with this sid is expected to provide payment information thru DTMF.

application/x-www-form-urlencoded

Body

  • Type of bank account if payment source is ACH. One of consumer-checking, consumer-savings, or commercial-checking. The default value is consumer-checking.

    Values are consumer-checking, consumer-savings, or commercial-checking.

  • 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 is USD and all values allowed from the Connector are accepted.

  • 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.

  • IdempotencyKey string Required

    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.

  • 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.

  • This is the unique name corresponding to the Payment Gateway Connector installed in the Twilio Add-ons. Learn more about Connectors. The default value is Default.

  • Type of payment being captured. One of credit-card or ach-debit. The default value is credit-card.

    Values are credit-card or ach-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.

  • 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.

  • StatusCallback string(uri) Required

    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 is 600.

  • Indicates whether the payment method should be tokenized as a one-time or reusable token. The default value is reusable. 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 or reusable.

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

Responses

  • 201

    Created

    Hide response attributes Show response attributes object
    • account_sid string | null

      The SID of the Account that created the Payments resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • call_sid string | null

      The SID of the Call the resource is associated with.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^CA[0-9a-fA-F]{32}$.

    • date_created string(date-time-rfc-2822) | null

      The RFC 2822 date and time in GMT that the resource was created

    • date_updated string(date-time-rfc-2822) | null

      The RFC 2822 date and time in GMT that the resource was last updated

    • sid string | null

      The SID of the Payments resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^PK[0-9a-fA-F]{32}$.

    • uri string(uri) | null

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

POST /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments.json
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'
Request example
{
  "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"
}
Response examples (201)
{
  "account_sid": "string",
  "call_sid": "string",
  "date_created": "string",
  "date_updated": "string",
  "sid": "string",
  "uri": "https://example.com"
}