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

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



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](www.twilio.com/docs/voice/api/payment-resource#statuscallback)

  • bank_account_type (BankAccountType) (defaults to: :unset)
  • charge_amount (Float) (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](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.

  • 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 (Object) (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](www.twilio.com/console/voice/pay-connectors).

  • 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 [<Pay> Connectors](www.twilio.com/console/voice/pay-connectors). The default value is ‘Default`.

  • payment_method (PaymentMethod) (defaults to: :unset)
  • 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 (TokenType) (defaults to: :unset)
  • 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:



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 55

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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    PaymentInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        call_sid: @solution[:call_sid],
    )
end

#to_sObject

Provide a user friendly representation



112
113
114
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 112

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