2017-05-18 3 views
0

返品ページのコードは次のとおりです。それは正常に実行され、正常に完了します。私は、ページが成功したので、$ requestParamsの変数がページ上で利用可能であると仮定しています。あなただけのデータは、独自の参照あなたは$ transactionResponseで行った同じことを行うことができますのためにダンプを参照する必要がある場合は$ requestParams返品ページにPaypal変数を表示する方法

<?php 
require_once '../library/DPayPal.php'; //Import library 


$token=$_GET["token"];//Returned by paypal, you can save this in SESSION too 
$paypal = new DPaypal(); 
$requestParams = array('TOKEN' => $token); 

$response = $paypal->GetExpressCheckoutDetails($requestParams); 
$payerId=$response["PAYERID"];//Payer id returned by paypal 

//Create request for DoExpressCheckoutPayment 
$requestParams=array(
    "TOKEN"=>$token, 
    "PAYERID"=>$payerId, 
    "PAYMENTREQUEST_0_AMT"=>"20",//Payment amount. This value should be sum of of item values, if there are more items in order 
    "PAYMENTREQUEST_0_CURRENCYCODE"=>"USD",//Payment currency 
    "PAYMENTREQUEST_0_ITEMAMT"=>"20"//Item amount 
); 
$transactionResponse=$paypal->DoExpressCheckoutPayment($requestParams);//Execute transaction 

if(is_array($transactionResponse) && $transactionResponse["ACK"]=="Success"){//Payment was successfull 

echo "Successfull"; 

// Displays Successfull, but NONE of the following commands display any results 


print_r($transactionResponse["PAYMENTREQUEST_0_CURRENCYCODE"]); 
echo $transactionResponse["PAYMENTREQUEST_0_CURRENCYCODE"]; 

print_r($transactionResponse); 
echo $transactionResponse; 
} 



else{ 

echo "Failed"; 
} 

?> 
+0

'$ transactionResponse'と同じように' print_r($ requestParams); 'が成功したためではなく、このページで定義したので利用可能です。 – AbraCadaver

+0

素晴らしいです。ありがとうAbraCadaver –

答えて

0

の変数の値を表示するための正しい構文はどのようなものです。ユーザーに値を表示したい場合は、このようなことをすることができます。

foreach($requestParams as $var => $val) 
{ 
    echo $var . ': ' . $val . '<br />'; 
} 
関連する問題