class Twilio::REST::Api::V2010::AccountContext::CallContext::PaymentContext
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 PaymentContext
@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 will update the resource.
@param [String] call_sid The SID of the call that will update the resource. This
should be the same call sid that was used to create payments resource.
@param [String] sid The SID of Payments session that needs to be updated. @return [PaymentContext] PaymentContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 179 def initialize(version, account_sid, call_sid, sid) 180 super(version) 181 182 # Path Solution 183 @solution = {account_sid: account_sid, call_sid: call_sid, sid: sid, } 184 @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Payments/#{@solution[:sid]}.json" 185 end
Public Instance Methods
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 235 def inspect 236 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 237 "#<Twilio.Api.V2010.PaymentContext #{context}>" 238 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call/payment.rb 228 def to_s 229 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 230 "#<Twilio.Api.V2010.PaymentContext #{context}>" 231 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 207 def update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset) 208 data = Twilio::Values.of({ 209 'IdempotencyKey' => idempotency_key, 210 'StatusCallback' => status_callback, 211 'Capture' => capture, 212 'Status' => status, 213 }) 214 215 payload = @version.update('POST', @uri, data: data) 216 217 PaymentInstance.new( 218 @version, 219 payload, 220 account_sid: @solution[:account_sid], 221 call_sid: @solution[:call_sid], 222 sid: @solution[:sid], 223 ) 224 end