1

我正在努力弄清楚如何让数字商品与我的自适应支付一起使用。我正在使用,Paypal ruby gem有人可以给我看一个代码示例,用于使用 2 个接收者进行付款Digital Goods吗?

我已经通过贝宝批准了小额支付。

# Build request object
        @pay = @api.build_pay({
          :actionType => "PAY",
          :cancelUrl => "http://localhost:3000/account", #sandbox
          :currencyCode => "USD",
          #:feesPayer => "SENDER",
          :ipnNotificationUrl => "http://596w.localtunnel.com/pay/#{purchased.id}", #sandbox
          :memo => "Test payment",
          :receiverList => {
            :receiver => [{
              :amount => price.round(2),
              :email => "an email", #sandbox
              :paymentType => "DIGITALGOODS",
              :primary => true
              },
              unless account.user.email == "an email"
              {
                :amount => mycut.round(2),
                :email => "anemail", #sandbox
                :paymentType => "DIGITALGOODS" 
                }
              end
                ] },
          :returnUrl => "http://localhost:3000/pay/complete/" #sandbox 
          })

我得到错误:

This feature (Digital Goods) is not supported.
4

3 回答 3

0

如果您成功获取 payKey 但稍后将用户重定向到错误的 url,则可能会出现此错误。

这是嵌入式支付表单的haml代码,包括数字商品。

= javascript_include_tag "//www.paypalobjects.com/js/external/apdg.js"

%form.text-center{:action => ::PAYPAL_ADAPTIVE_GATEWAY.embedded_flow_url, :target => "PPDGFrame"}
  %input#type{:name => "expType", :type => "hidden", :value => "light"}
  %input#paykey{:name => "payKey", :type => "hidden", :value => @payKey}
  %input#submitBtn{:type => "submit", :value => 'Pay with PayPal' }

:javascript
  var returnFromPayPal = function(){
  //do something on PayPal popup closing here
  };
  var dgFlowMini = new PAYPAL.apps.DGFlowMini({ trigger: 'submitBtn', callbackFunction: returnFromPayPal});

  //works only for lightbox mode
  function MyEmbeddedFlow(embeddedFlow) {
      this.embeddedPPObj = embeddedFlow;
      this.paymentSuccess = function () {
           this.embeddedPPObj.closeFlow();
           // handle payment success here
           window.location.reload(true);
      };
      this.paymentCanceled = function () {
           this.embeddedPPObj.closeFlow();
           // handle payment cancellation here
           window.location.reload(true);
      };
   }
   var myEmbeddedPaymentFlow = new MyEmbeddedFlow(dgFlowMini);

::PAYPAL_ADAPTIVE_GATEWAY.embedded_flow_url来自activemerchant,您可以'https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay'用于沙盒或'https://www.paypal.com/webapps/adaptivepayment/flow/pay'生产。

于 2013-07-14T15:24:31.893 回答
0

在https://www.paypal.com/mts记录一张票,他们会为您启用它。对于它的价值,您尝试使用的产品是:用于 Express Checkout 的数字商品。默认情况下,所有帐户都可以使用 Express Checkout 本身,但该团队可以在您的 Sandbox 帐户上启用数字商品。

于 2013-07-14T14:41:46.150 回答
0

据我所知,Paypal 的 Express Payment 选项支持数字商品。如果您可以替换您的集成来使用activemerchant和使用PaypalDigitalGoodsGateway您会帮自己一个忙。

于 2013-07-14T14:20:55.870 回答