class PagSeguro::PaymentRequest
Attributes
Determines for which url PagSeguro
will send the buyer when he doesn’t complete the payment.
Set the payment currency. Defaults to BRL.
Set the extra amount to be applied to the transaction’s total. This value can be used to add an extra charge to the transaction or provide a discount, if negative.
The extra parameters for payment request
Set the payment request duration, in seconds.
How many times the payment redirect uri returned by the payment web service can be accessed. Optional. After this payment request is submitted, the payment redirect uri returned by the payment web service will remain valid for the number of uses specified here.
Determines for which url PagSeguro
will send the order related notifications codes. Optional. Any change happens in the transaction status, a new notification request will be send to this url. You can use that for update the related order.
Set and get primary receiver email.
Get the payment receivers.
Set the redirect url. The URL that will be used by PagSeguro
to redirect the user after the payment information is processed. Typically this is a confirmation page on your web site.
Set the reference code. Optional. You can use the reference code to store an identifier so you can associate the PagSeguro
transaction to a transaction in your system. Tipically this is the order id.
Get the payment sender.
Get the shipping info.
Public Instance Methods
Products/items in this payment request.
# File lib/pagseguro/payment_request.rb, line 65 def items @items ||= Items.new end
Set the receivers.
# File lib/pagseguro/payment_request.rb, line 75 def receivers=(receivers) receivers.each do |receiver| @receivers << ensure_type(Receiver, receiver) end end
Calls the PagSeguro
web service and register this request for payment.
# File lib/pagseguro/payment_request.rb, line 87 def register request = if @receivers.empty? Request.post('checkout', api_version, params) else Request.post_xml('checkouts', api_version, credentials, xml_params) end Response.new(request) end
Set the payment sender.
# File lib/pagseguro/payment_request.rb, line 70 def sender=(sender) @sender = ensure_type(Sender, sender) end
Set the shipping info.
# File lib/pagseguro/payment_request.rb, line 82 def shipping=(shipping) @shipping = ensure_type(Shipping, shipping) end
Private Instance Methods
# File lib/pagseguro/payment_request.rb, line 113 def api_version 'v2' end
# File lib/pagseguro/payment_request.rb, line 107 def before_initialize self.extra_params = [] self.currency = "BRL" @receivers = [] end
# File lib/pagseguro/payment_request.rb, line 103 def params RequestSerializer.new(self).to_params end
# File lib/pagseguro/payment_request.rb, line 99 def xml_params RequestSerializer.new(self).to_xml_params end