简体   繁体   中英

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

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

为了您的方便起见,您可能需要检查将其封装的所有gem: https//github.com/jpablobr/active_paypal_adaptive_payment

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM