rishi
rishi

Reputation: 51

paypal adaptive payment rails 3

How to use ipn notification with paypal apadaptive payment gem with active merchant? I want to avoid using metal, directly a controller wanna use. rails 3 ruby 1.9.2 Thanks

Upvotes: 0

Views: 411

Answers (2)

Arun.S
Arun.S

Reputation: 71

Using like this

response = gateway.setup_purchase(
    :return_url => url_for(:action => 'index',:port=>"3001", :only_path => false),
    :cancel_url => url_for(:action => 'create',:port=>"3001", :only_path => false),
    **:ipn_notification_url => payments_notify_action_url**,
    :receiver_list => recipients
)

Here you specify the IPN notification URL and then:

def notify_action
    notify = ActiveMerchant::Billing::Integrations::PaypalAdaptivePayment::Notification.new(request.raw_post)
    p "Notification object is #{notify}"
    if notify.acknowledge
    p "Transaction ID is #{notify.transaction_id}"
    p "Notification object is #{notify}"
    p "Notification status is #{notify.status}"
end

Before that go to the sandbox account.

  1. Choose the test account.
  2. Then click any business account -> click "Enter sandbox account"
  3. Enter email of business account and type password
  4. Choose -> profile settings -> ipn notification -> set return url

Upvotes: 1

Arnaud Leymet
Arnaud Leymet

Reputation: 6132

You may want to check this gem that encapsulates it all for your convenience: https://github.com/jpablobr/active_paypal_adaptive_payment

Upvotes: 0

Related Questions