9

I am using Paypals Adaptive Payments and Embedded flow feature to provide checkout via a minibrowser. Everything seems to be working correctly in the sandbox environment except that when the payment is completed successfully, the user is never redirected to my returnUrl set in the PAY API request. Same goes for my cancelUrl.

After the payment is complete, the user is shown an order overview in the minibrowser and a button labelled "close". If a user clicks this button, the minibrowser is closed.

If a user clicks cancel at any time, the minibrowser is closed.

There doesn't seem to be a way to have my page aware of the change besides setting up some polling or something which doesn't make sense, my returnUrl and cancelUrl should be used somewhere, right?

这是我获取重定向 url 的代码(使用自适应支付 gem):

pay_request = PaypalAdaptive::Request.new
data = {
  'requestEnvelope' => {'errorLanguage' => 'en_US'},
  'currencyCode' => 'USD',
  'receiverList' =>
          { 'receiver' => [
            {'email' => '...', 'amount'=> 10.00}
          ]},
  'actionType' => 'PAY',
  'returnUrl' => 'http://www.example.com/paid',
  'cancelUrl' => 'http://www.example.com/cancelled',
  'ipnNotificationUrl' => 'http://www.example.com/ipn'
}

pay_response = pay_request.pay(data)
redirect_to pay_response.approve_paypal_payment_url "mini"

以下是我设置贝宝 js 的方式:

var dg = new PAYPAL.apps.DGFlowMini({ trigger: "buyit", expType: "mini" });

这一切似乎都很简单,不知道我错过了什么。

4

2 回答 2

9

嗯 - 似乎是我们这边的一个错误 - 只是自己尝试过并与我们的集成团队确认。:-(

不幸的是,除了您提到的(检查弹出窗口是否存在)之外,我能想到的另一个短期修复是从您的服务器端调用 PaymentDetails API 来检查付款的状态。我已经打开了我们这边的错误,但没有 ETA。

编辑 10/18:对不起,我错了。这是有效的——只是我们的开发人员指南没有提供所有必需的信息。在迷你浏览器流的情况下,您需要提供“callbackFunction”并将您的 dgFlow 变量命名为“dgFlowMini”。(后者很重要——因为 apdg.js 期望定义 'dgFlowMini' 变量)这是有效的代码:

var returnFromPayPal = function(){
   alert("Returned from PayPal");
   // Here you would need to pass on the payKey to your server side handle to call the PaymentDetails API to make sure Payment has been successful or not
  // based on the payment status- redirect to your success or cancel/failed urls
}
var dgFlowMini = new PAYPAL.apps.DGFlowMini({trigger: 'em_authz_button', expType: 'mini', callbackFunction: 'returnFromPayPal'});

我在这里有一个工作示例:https ://pp-ap-sample.appspot.com/adaptivesample?action=pay (确保选择 mini 作为体验类型)

我们将更新我们的文档并清理 apdg.js 以消除对 JS 变量名的依赖。

于 2012-10-18T00:26:17.267 回答
2

看起来嵌入式流的 PayPal 体验变得更糟了。现在您在调用迷你或灯箱后会收到一条错误消息,提示“无法完成付款。此功能目前不可用。”

于 2015-07-02T03:43:55.010 回答