使用Paypal在Rails 3.2中预先批准的付款 [英] preapproved payments with paypal in rails 3.2

查看:178
本文介绍了使用Paypal在Rails 3.2中预先批准的付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将此信息发送给贝宝,以使用预批准的付款功能:

I send this info to paypal for using preapproved payment feature:

response = gateway.preapprove_payment( 
  :return_url =>  user_orders_url(current_user),
  :cancel_url => user_orders_url(current_user),
  :requestEnvelope => {"errorLanguage" => "en_US"},
  :start_date => Time.now,
  :end_date => Time.now + (60*60*24) * 30,
  :currency_code =>"USD",
  :senderEmail =>"email address of sender",
  :max_amount => "20.00",
  :maxNumberOfPayments => "1",
  :notify_url => ipn_notification_user_orders_url(current_user),
  )
 redirect_to (gateway.redirect_url_for(response["preapprovalKey"]))
 p response

我在贝宝页面上收到一条消息:

I get a message in paypal page:

This transaction is invalid. Please return to the recipient's website and try again.

我正在使用此宝石

I am using the method build_preapproval_payment from this gem https://github.com/jpablobr/active_paypal_adaptive_payment/blob/master/lib/active_merchant/billing/gateways/paypal_adaptive_payment.rb

这是我的日志控制台中的输出:

This is the output in my log console:

#<ActiveMerchant::Billing::AdaptivePaymentResponse:0xb7c6838 @json="{\"responseEnvelope\":{\"timestamp\":\"2012-07-23T09:32:42.631-07:00\",\"ack\":\"Success\",\"correlationId\":\"0c4df4aefe651\",\"build\":\"DEV\"},\"preapprovalKey\":\"PA-8D4362235H161382C\"}", @response=#<Hashie::Rash preapproval_key="PA-8D4362235H161382C" response_envelope=#<Hashie::Rash ack="Success" build="DEV" correlation_id="0c4df4aefe651" timestamp="2012-07-23T09:32:42.631-07:00">>, @xml_request="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<PreapprovalRequest>\n  <requestEnvelope>\n    <detailLevel>ReturnAll</detailLevel>\n    <errorLanguage>en_US</errorLanguage>\n    <senderEmail>sender_email</senderEmail>\n  </requestEnvelope>\n  <endingDate>2012-08-22T18:32:40</endingDate>\n  <startingDate>2012-07-23T18:32:40</startingDate>\n  <maxTotalAmountOfAllPayments>20.00</maxTotalAmountOfAllPayments>\n  <maxNumberOfPayments>1</maxNumberOfPayments>\n  <currencyCode>USD</currencyCode>\n  <cancelUrl>http://localhost:3000/en/u/maserranocaceres/orders</cancelUrl>\n  <returnUrl>http://localhost:3000/en/u/maserranocaceres/orders</returnUrl>\n  <ipnNotificationUrl>http://localhost:3000/en/u/maserranocaceres/orders/ipn_notification</ipnNotificationUrl>\n</PreapprovalRequest>\n", @request={"PreapprovalRequest"=>{"requestEnvelope"=>{"detailLevel"=>"ReturnAll", "errorLanguage"=>"en_US", "senderEmail"=>"microf_1342709287_biz@gmail.com"}, "endingDate"=>"2012-08-22T18:32:40", "startingDate"=>"2012-07-23T18:32:40", "maxTotalAmountOfAllPayments"=>"20.00", "maxNumberOfPayments"=>"1", "currencyCode"=>"USD", "cancelUrl"=>"http://localhost:3000/en/u/maserranocaceres/orders", "returnUrl"=>"http://localhost:3000/en/u/maserranocaceres/orders", "ipnNotificationUrl"=>"http://localhost:3000/en/u/maserranocaceres/orders/ipn_notification"}}, @action="Preapproval">

我在哪里出错?

谢谢!

推荐答案

好吧,根据我对该gem的源代码的调查,用于预先批准付款的正确redirect_url方法是 redirect_pre_approval_url_for

Well, according to my investigation of the source code of that gem the proper redirect_url method for preapproved payments is redirect_pre_approval_url_for

redirect_pre_approval_url_for(令牌)

这篇关于使用Paypal在Rails 3.2中预先批准的付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆