2

我正在整合貝寶加,成功地在我的網站上,除了「支付發票」。貝寶加沙箱 - 付款後發票

這裏的支付牆整合我的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> 

當我嘗試使用「發票後支付」我得到這個錯誤信息:「很遺憾,我們無法處理您的購買」

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" 
), 
)); 
+0

我有完全相同的問題,只是用完了想法。 – Chris

回答

2

你需要顯示的iframe之前修補付款。 在修補程序中,只需提供送貨地址。 然後發票付款工程,即使在沙箱。