PayPal Plus沙盒-发票付款 [英] PayPal Plus Sandbox - Pay upon Invoice

查看:95
本文介绍了PayPal Plus沙盒-发票付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在成功地将PayPal Plus集成到我的网站上,但按发票付款"除外.

I'm integrating PayPal Plus, successfully on my site, except "Pay upon Invoice".

这是我的JavaScript代码,用于集成付款墙:

Here's my JavaScript code for integrating the payment wall:

<script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js"
type="text/javascript"></script>

<script type="application/javascript">
var ppp = PAYPAL.apps.PPP({
"approvalUrl": "<?= $createPaymentArr['links'][1]['href']; ?>",
"placeholder": "ppplus",
"language": "de_DE",
"mode": "sandbox",
"showPuiOnSandbox": "true",
"country": "DE"
});
</script>

当我尝试使用按发票付款"时,出现以下错误消息: 很遗憾,我们无法处理您的购买."

When I try to use "Pay upon Invoice" I get this error message: "Unfortunately we can not process your purchase."

我的API调用:

$fields = '{
    "intent":"sale",
    "redirect_urls":{
      "return_url":"http://XYZ.info/ABC/paypal/index.php",
      "cancel_url":"http://XYZ.info/ABC/paypal/index.php"
    },
    "payer":{
      "payment_method":"paypal"
    },
    "transactions":[
    {
      "amount":{
        "total":"7.47",
        "currency":"EUR",
        "details":{
          "subtotal":"7.41",
          "tax":"0.03",
          "shipping":"0.03"
        }
      },
        "item_list":{
            "items":[
                {
                    "quantity":"1",
                    "name":"XYZ",
                    "price":"7.41",
                    "currency":"EUR"
                }
            ],
            "shipping_address":{
              "line1":"XYZ Straße 587",
              "city":"OPA",
              "postal_code":"12345",
              "country_code":"DE"
            }
        },
      "description":"XYZ.info Warenkorb"
    }
  ]
}';

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api".$mode.".paypal.com/v1/payments/payment",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => $fields,
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer ".$arr['access_token'],
    "Content-Type: application/json"
  ),
));

推荐答案

在显示iframe之前,您需要先修补付款. 在修补过程中,只需提供送货地址. 然后,即使在沙箱中,也可以按发票付款.

You need to patch the payment before showing the iframe. During the patch, simply supply the shipping address. Then payment upon invoice works, even in the sandbox.

这篇关于PayPal Plus沙盒-发票付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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