class Twilio::REST::Api::V2010::AccountContext::CallContext::PaymentList
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
Public Class Methods
Initialize the PaymentList
@param [Version] version Version
that contains the resource @param [String] account_sid The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created the Payments resource.
@param [String] call_sid The SID of the
{Call}[https://www.twilio.com/docs/voice/api/call-resource] the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF.
@return [PaymentList] PaymentList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 29 def initialize(version, account_sid: nil, call_sid: nil) 30 super(version) 31 32 # Path Solution 33 @solution = {account_sid: account_sid, call_sid: call_sid} 34 @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Payments.json" 35 end
Public Instance Methods
Create the PaymentInstance
@param [String] 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.
@param [String] status_callback Provide an absolute or relative URL to receive
status updates regarding your Pay session. Read more about the {expected StatusCallback values}[https://www.twilio.com/docs/voice/api/payment-resource#statuscallback]
@param [payment.BankAccountType] bank_account_type Type of bank account if
payment source is ACH. One of `consumer-checking`, `consumer-savings`, or `commercial-checking`. The default value is `consumer-checking`.
@param [String] 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.
@param [String] currency The currency of the `charge_amount`, formatted as {ISO
4127}[http://www.iso.org/iso/home/standards/currency_codes.htm] format. The default value is `USD` and all values allowed from the <Pay> Connector are accepted.
@param [String] 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.
@param [String] 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.
@param [String] 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.
@param [Hash] parameter A single level JSON string that is required when
accepting certain information specific only to ACH payments. The information that has to be included here depends on the <Pay> Connector. {Read more}[https://www.twilio.com/console/voice/pay-connectors].
@param [String] payment_connector This is the unique name corresponding to the
Payment Gateway Connector installed in the Twilio Add-ons. Learn more about {<Pay> Connectors}[https://www.twilio.com/console/voice/pay-connectors]. The default value is `Default`.
@param [payment.PaymentMethod] payment_method Type of payment being captured.
One of `credit-card` or `ach-debit`. The default value is `credit-card`.
@param [Boolean] 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`.
@param [Boolean] 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`.
@param [String] 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`.
@param [payment.TokenType] token_type 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.
@param [String] valid_card_types Credit card types separated by space that Pay
should accept. The default value is `visa mastercard amex`
@return [PaymentInstance] Created PaymentInstance
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 93 def create(idempotency_key: nil, status_callback: nil, bank_account_type: :unset, charge_amount: :unset, currency: :unset, description: :unset, input: :unset, min_postal_code_length: :unset, parameter: :unset, payment_connector: :unset, payment_method: :unset, postal_code: :unset, security_code: :unset, timeout: :unset, token_type: :unset, valid_card_types: :unset) 94 data = Twilio::Values.of({ 95 'IdempotencyKey' => idempotency_key, 96 'StatusCallback' => status_callback, 97 'BankAccountType' => bank_account_type, 98 'ChargeAmount' => charge_amount, 99 'Currency' => currency, 100 'Description' => description, 101 'Input' => input, 102 'MinPostalCodeLength' => min_postal_code_length, 103 'Parameter' => Twilio.serialize_object(parameter), 104 'PaymentConnector' => payment_connector, 105 'PaymentMethod' => payment_method, 106 'PostalCode' => postal_code, 107 'SecurityCode' => security_code, 108 'Timeout' => timeout, 109 'TokenType' => token_type, 110 'ValidCardTypes' => valid_card_types, 111 }) 112 113 payload = @version.create('POST', @uri, data: data) 114 115 PaymentInstance.new( 116 @version, 117 payload, 118 account_sid: @solution[:account_sid], 119 call_sid: @solution[:call_sid], 120 ) 121 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 125 def to_s 126 '#<Twilio.Api.V2010.PaymentList>' 127 end