Ruby on Rails Thursday, January 31, 2013

Hi all

I am working with the paypal recurring gem and rails 3.

I am subscribing different plans for a demo site. with "Basic" and "Premium" plans.

I am doing a refund process for test.


def refund_payment
    ppr = PayPal::Recurring.new({
      :profile_id => self.paypal_recurring_profile_token,
      :transaction_id => "#7RX73297E7023873T",
      :reference      => "1234",
      :refund_type    => :full,
      :currency       => "USD"
    })
    response = ppr.refund
    raise response.errors.inspect if response.errors.present?
    response
  end

For profie id it gets the profile id from the table for each transaction. But incase of transaction id there are no transaction id in response while getting a payment to paypal.
I just hardcoded the transaction id from the last transaction from the website. But it showing error.

[{:code=>"10004", :messages=>["Transaction refused because of an invalid argument. See additional error messages for details.", "The transaction id is not valid"]}]
Thanks in advance
Debadatta

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/8wzz2AKXQTMJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment