Question: undefined method `[]' for false:FalseClass on adaptivepayments-sdk-ruby

Question

undefined method `[]' for false:FalseClass on adaptivepayments-sdk-ruby

Answers 0
Added at 2017-01-01 19:01
Tags
Question

Someone is having this issue? or now why this is happing on configuring the paypal sdk adaptive?

place the configuration on the yml did not show this message but did not work either, so

i place the sdk configure on: buy action

and on the log shows:

line 58 is PayPal::SDK.configure

NoMethodError (undefined method []' for false:FalseClass):
app/controllers/orders_controller.rb:58:in
buy'

def buy
    require 'paypal-sdk-adaptivepayments'

    PayPal::SDK.configure(
      :mode      => "live",  # Set "live" for production
      :app_id    => "APP-xxxxx",
      :username  => "xxxx.yyyy.com",
      :password  => "xxxx",
      :signature => "xxxxx" )



      @api = PayPal::SDK::AdaptivePayments.new


      order = Order.find(params[:id])


      @pay = @api.build_pay({
        :actionType => "PAY",
        :cancelUrl => carts_url,
        :currencyCode => "US",
        :feesPayer => "SENDER",
        :ipnNotificationUrl => ipn_notification_order_url(order),

        :receiverList => {
          :receiver => [{
            :email =>  seller@seller.com,
            :amount => 1.0,
            :primary => true},
            {:email => buyer@buyer.com,
             :amount => 1.0, 
             :primary => false}]},
             :returnUrl => carts_url })

             @response = @api.pay(@pay)

             # Access response
             if @response.success? && @response.payment_exec_status != "ERROR"
               @response.payKey
               redirect_to @api.payment_url(@response)  # Url to complete payment
             else
               @response.error[0].message
               redirect_to fail_order_path(order)

             end
  end
Answers
Source Show
◀ Wstecz