fnando / paypal-recurring

PayPal Express Checkout API Client for recurring billing.
257 stars 121 forks source link

Pass "custom" within options of PayPal::Recurring.new(options) #10

Closed datnt closed 12 years ago

datnt commented 12 years ago

Hi fnando,

This is my code:

def process(action, options = {}) options = options.reverse_merge( token: @subscription.paypal_payment_token, payer_id: @subscription.paypal_customer_token, description: "Description for payment plan #{@subscription.plan.batch}", amount: @subscription.plan.price, currency: "USD" ) response = PayPal::Recurring.new(options).send(action) raise response.errors.inspect if response.errors.present?

response

end

I tried to put "custom" within the above options scope, i.e: options = options.reverse_merge( ... custom: "...Some thing..." )

But PayPal::Recurring display system errors.

Reference: 1> http://stackoverflow.com/questions/1364360/testing-paypal-subscription-ipn 2> https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside 3> http://railscasts.com/episodes/289-paypal-recurring-billing

Thank you in advance, Dat

datnt commented 12 years ago

Hi fnando,

I found a solution for this.

We should put custom within action "request_payment". Here is my comment on railscast http://railscasts.com/episodes/289-paypal-recurring-billing?

def makerecurring(payment_notifications_url,current_user) process :request_payment, ipn_url: "#{notifications_url}?custom=user_id#{current_user.id}" process :create_recurring_profile, period: :daily, frequency: 1, start_at: Time.zone.now, ipn_url: notifications_url end

Note:

  1. ipn_url should be put within "request_payment" scope
  2. Although I set up ipn_url for "create_recurring_profile" but it does not work.