Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

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

Closed
datnt opened this issue Jun 7, 2012 · 1 comment
Closed

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

datnt opened this issue Jun 7, 2012 · 1 comment

Comments

@datnt
Copy link

datnt commented Jun 7, 2012

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
Copy link
Author

datnt commented Jun 8, 2012

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.

@datnt datnt closed this as completed Jun 8, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant