Create an instance of payments. This will start a new payments session

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.

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

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

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

application/x-www-form-urlencoded

Body

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

  • 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

  • BankAccountType string

    Values are consumer-checking, consumer-savings, or commercial-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 is USD and all values allowed from the Pay Connector 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.

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

  • 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 Connector. Read more.

  • PaymentConnector string

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

  • PaymentMethod string

    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.

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

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

  • TokenType string

    Values are one-time, reusable, or payment-method.

  • ValidCardTypes string

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

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    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 Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF.

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

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

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

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

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

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

    • uri string | null

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

POST /2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments.json
curl \
 --request POST 'https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments.json' \
 --user "username:password" \
 --header "Content-Type: application/x-www-form-urlencoded" \
 --data 'Input=dtmf&Currency=USD&Parameter=%7B%27name%27%3A%27foobar%27%7D&PostalCode=true&Description=api+testing&ChargeAmount=12.00&SecurityCode=true&PaymentMethod=credit-card&IdempotencyKey=abcd&StatusCallback=https%3A%2F%2Fmyapp.com%2Fpayments&ValidCardTypes=visa+amex&PaymentConnector=stripe_connector'
Request example
{"Input"=>"dtmf", "Currency"=>"USD", "Parameter"=>"{'name':'foobar'}", "PostalCode"=>true, "Description"=>"api testing", "ChargeAmount"=>"12.00", "SecurityCode"=>true, "PaymentMethod"=>"credit-card", "IdempotencyKey"=>"abcd", "StatusCallback"=>"https://myapp.com/payments", "ValidCardTypes"=>"visa amex", "PaymentConnector"=>"stripe_connector"}
Response examples (201)
{
  "sid": "PKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Payments/PKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
  "call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "date_created": "Wed, 18 Dec 2019 20:02:01 +0000",
  "date_updated": "Wed, 18 Dec 2019 20:02:01 +0000"
}