我已经使用此代码在Android应用程序中使用paypal实现了支付的其余api :
if (isset($_POST['paypal_response']) ) {
$json = json_decode( $_POST['paypal_response'], true );
if (isset($json['proof_of_payment']['rest_api']) ) {
echo 'rest api et voila le payment_id : '.$json['proof_of_payment']['rest_api']['payment_id'].'\n';
$http_header_card = array(
'Content-Type:application/json',
'Authorization:Bearer ENxom5Fof1KqAffEsXtxwEDa6E1HTEK__KVdIsaCYF8C'
);
$ch = curl_init();
$get_request = "https://api.sandbox.paypal.com/v1/payments/payment/{".$json['proof_of_payment']['rest_api']['payment_id']."}";
curl_setopt($ch, CURLOPT_URL, $get_request);
curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header_card );
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$html = curl_exec ($ch);
echo $html;
我还实施了自适应支付证明的验证(使用paypal帐户)
但是上面这个,总是发给我这个回复:
{"name":"INTERNAL_SERVICE_ERROR","message":"An internal service error has occurred","information_link":"https://api.sandbox.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR"}1
我不知道我之所以遵循官方文档here
的原因这里是我转换为php的文档的代码:
curl https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI \
-H "Content-Type:application/json" \
-H "Authorization:Bearer ENxom5Fof1KqAffEsXtxwEDa6E1HTEK__KVdIsaCYF8C"
如何解决此问题
感谢