Class: Twilio::REST::Api::V2010::AccountContext::CallContext::PaymentList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call/payment.rb

Overview

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 [email protected]

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil, call_sid: nil) ⇒ PaymentList

Initialize the PaymentList

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created the Payments resource.

  • call_sid (String) (defaults to: nil)

    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.


29
30
31
32
33
34
35
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 29

def initialize(version, account_sid: nil, call_sid: nil)
  super(version)

  # Path Solution
  @solution = {account_sid: , call_sid: call_sid}
  @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Payments.json"
end

Instance Method Details

#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) ⇒ PaymentInstance

Create the PaymentInstance

Parameters:

  • idempotency_key (String) (defaults to: nil)

    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 (String) (defaults to: nil)

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

  • bank_account_type (payment.BankAccountType) (defaults to: :unset)

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

  • charge_amount (String) (defaults to: :unset)

    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) (defaults to: :unset)

    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) (defaults to: :unset)

    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) (defaults to: :unset)

    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 (String) (defaults to: :unset)

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

  • parameter (Hash) (defaults to: :unset)

    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.

  • payment_connector (String) (defaults to: :unset)

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

  • payment_method (payment.PaymentMethod) (defaults to: :unset)

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

  • postal_code (Boolean) (defaults to: :unset)

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

  • security_code (Boolean) (defaults to: :unset)

    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 (String) (defaults to: :unset)

    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 (payment.TokenType) (defaults to: :unset)

    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.

  • valid_card_types (String) (defaults to: :unset)

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

Returns:


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 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)
  data = Twilio::Values.of({
      'IdempotencyKey' => idempotency_key,
      'StatusCallback' => status_callback,
      'BankAccountType' => ,
      'ChargeAmount' => charge_amount,
      'Currency' => currency,
      'Description' => description,
      'Input' => input,
      'MinPostalCodeLength' => min_postal_code_length,
      'Parameter' => Twilio.serialize_object(parameter),
      'PaymentConnector' => payment_connector,
      'PaymentMethod' => payment_method,
      'PostalCode' => postal_code,
      'SecurityCode' => security_code,
      'Timeout' => timeout,
      'TokenType' => token_type,
      'ValidCardTypes' => valid_card_types,
  })

  payload = @version.create('POST', @uri, data: data)

  PaymentInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      call_sid: @solution[:call_sid],
  )
end

#to_sObject

Provide a user friendly representation


125
126
127
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 125

def to_s
  '#<Twilio.Api.V2010.PaymentList>'
end