class Twilio::REST::Api::V2010::AccountContext::CallContext::PaymentInstance
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 PaymentInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@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.
@param [String] sid The SID of Payments session that needs to be updated. @return [PaymentInstance] PaymentInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 257 def initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil) 258 super(version) 259 260 # Marshaled Properties 261 @properties = { 262 'account_sid' => payload['account_sid'], 263 'call_sid' => payload['call_sid'], 264 'sid' => payload['sid'], 265 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 266 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 267 'uri' => payload['uri'], 268 } 269 270 # Context 271 @instance_context = nil 272 @params = {'account_sid' => account_sid, 'call_sid' => call_sid, 'sid' => sid || @properties['sid'], } 273 end
Public Instance Methods
@return [String] The SID of the Account that created the Payments resource.
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 293 def account_sid 294 @properties['account_sid'] 295 end
@return [String] The SID of the Call the resource is associated with.
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 299 def call_sid 300 @properties['call_sid'] 301 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [PaymentContext] PaymentContext
for this PaymentInstance
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 279 def context 280 unless @instance_context 281 @instance_context = PaymentContext.new( 282 @version, 283 @params['account_sid'], 284 @params['call_sid'], 285 @params['sid'], 286 ) 287 end 288 @instance_context 289 end
@return [Time] The RFC 2822 date and time in GMT that the resource was created
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 311 def date_created 312 @properties['date_created'] 313 end
@return [Time] The RFC 2822 date and time in GMT that the resource was last updated
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 317 def date_updated 318 @properties['date_updated'] 319 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 365 def inspect 366 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 367 "<Twilio.Api.V2010.PaymentInstance #{values}>" 368 end
@return [String] The SID of the Payments resource.
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 305 def sid 306 @properties['sid'] 307 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 358 def to_s 359 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 360 "<Twilio.Api.V2010.PaymentInstance #{values}>" 361 end
Update 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 {Update}[https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-update] and {Complete/Cancel}[https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-cancelcomplete] POST requests.
@param [payment.Capture] capture The piece of payment information that you wish
the caller to enter. Must be one of `payment-card-number`, `expiration-date`, `security-code`, `postal-code`, `bank-routing-number`, or `bank-account-number`.
@param [payment.Status] status Indicates whether the current payment session
should be cancelled or completed. When `cancel` the payment session is cancelled. When `complete`, Twilio sends the payment information to the selected <Pay> connector for processing.
@return [PaymentInstance] Updated PaymentInstance
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 347 def update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset) 348 context.update( 349 idempotency_key: idempotency_key, 350 status_callback: status_callback, 351 capture: capture, 352 status: status, 353 ) 354 end
@return [String] The URI of the resource, relative to `api.twilio.com`
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 323 def uri 324 @properties['uri'] 325 end