PayPal Plus Sandbox - 按发票付款

时间:2016-03-30 11:36:13

标签: paypal paypal-sandbox paypal-adaptive-payments paypal-rest-sdk

我在我的网站上成功整合了PayPal Plus,除了" Pay on Invoice"。

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

<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>

当我尝试使用&#34; Pay on Invoice&#34;我收到此错误消息: &#34;很遗憾,我们无法处理您的购买行为。&#34;

PayPal's Error Message

我的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"
  ),
));

1 个答案:

答案 0 :(得分:2)

您需要在显示iframe之前修补付款。 在补丁期间,只需提供送货地址。 然后,即使在沙箱中,也可以在发票上付款。