class PagSeguro::PaymentRequest

Attributes

abandon_url[RW]

Determines for which url PagSeguro will send the buyer when he doesn’t complete the payment.

currency[RW]

Set the payment currency. Defaults to BRL.

extra_amount[RW]

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.

extra_params[RW]

The extra parameters for payment request

max_age[RW]

Set the payment request duration, in seconds.

max_uses[RW]

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.

notification_url[RW]

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.

primary_receiver[RW]

Set and get primary receiver email.

receivers[R]

Get the payment receivers.

redirect_url[RW]

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.

reference[RW]

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.

sender[R]

Get the payment sender.

shipping[R]

Get the shipping info.

Public Instance Methods

items() click to toggle source

Products/items in this payment request.

# File lib/pagseguro/payment_request.rb, line 65
def items
  @items ||= Items.new
end
receivers=(receivers) click to toggle source

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
register() click to toggle source

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
sender=(sender) click to toggle source

Set the payment sender.

# File lib/pagseguro/payment_request.rb, line 70
def sender=(sender)
  @sender = ensure_type(Sender, sender)
end
shipping=(shipping) click to toggle source

Set the shipping info.

# File lib/pagseguro/payment_request.rb, line 82
def shipping=(shipping)
  @shipping = ensure_type(Shipping, shipping)
end

Private Instance Methods

api_version() click to toggle source
# File lib/pagseguro/payment_request.rb, line 113
def api_version
  'v2'
end
before_initialize() click to toggle source
# File lib/pagseguro/payment_request.rb, line 107
def before_initialize
  self.extra_params = []
  self.currency = "BRL"
  @receivers = []
end
params() click to toggle source
# File lib/pagseguro/payment_request.rb, line 103
def params
  RequestSerializer.new(self).to_params
end
xml_params() click to toggle source
# File lib/pagseguro/payment_request.rb, line 99
def xml_params
  RequestSerializer.new(self).to_xml_params
end