jan_flanders

Untitled

May 8th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.50 KB | None | 0 0
  1. <?php
  2. /********************************************************
  3. GetExpressCheckoutDetails.php
  4.  
  5. This functionality is called after the buyer returns from
  6. PayPal and has authorized the payment.
  7.  
  8. Displays the payer details returned by the
  9. GetExpressCheckoutDetails response and calls
  10. DoExpressCheckoutPayment.php to complete the payment
  11. authorization.
  12.  
  13. Called by ReviewOrder.php.
  14.  
  15. Calls DoExpressCheckoutPayment.php and APIError.php.
  16.  
  17. ********************************************************/
  18.  
  19.  
  20. require_once 'ppNVP/CallerService.php';
  21. session_start();
  22.  
  23. $token = urlencode ( $_REQUEST ['token'] );
  24.  
  25. /* Build a second API request to PayPal, using the token as the
  26.         ID to get the details on the payment authorization
  27.         */
  28. $nvpstr = "&TOKEN=" . $token;
  29.  
  30. /* Make the API call and store the results in an array.  If the
  31.         call was a success, show the authorization details, and provide
  32.         an action to complete the payment.  If failed, show the error
  33.         */
  34. $resArray = hash_call ( "GetExpressCheckoutDetails", $nvpstr );
  35. $_SESSION ['reshash'] = $resArray;
  36. $ack = strtoupper ( $resArray ["ACK"] );
  37. if ($ack != "SUCCESS") {
  38.     //Redirecting to APIError.php to display errors.
  39.     $location = "APIError.php";
  40.     header ( "Location: $location" );
  41.     exit();
  42. }
  43.  
  44. /* Collect the necessary information to complete the
  45.    authorization for the PayPal payment
  46.    */
  47.  
  48. $_SESSION['token']=$_REQUEST['token'];
  49. $_SESSION['payer_id'] = $_REQUEST['PayerID'];
  50.  
  51. $_SESSION['paymentAmount']=$_REQUEST['paymentAmount'];
  52. $_SESSION['currCodeType']=$_REQUEST['currencyCodeType'];
  53. $_SESSION['paymentType']=$_REQUEST['paymentType'];
  54.  
  55. $resArray=$_SESSION['reshash'];
  56.  
  57. /* Display the  API response back to the browser .
  58.    If the response from PayPal was a success, display the response parameters
  59.    */
  60.  
  61. ?>
  62.  
  63.  
  64.  
  65. <html>
  66. <head>
  67.     <title>PayPal PHP SDK - ExpressCheckout API</title>
  68.     <link href="sdk.css" rel="stylesheet" type="text/css" />
  69.  
  70. </head>
  71. <body>
  72.    
  73.     <form>
  74.      <center>
  75.            <table width =400>
  76.             <tr>
  77.                 <td><b>Order Total:</b></td>
  78.                 <td>
  79.                   <?=$_REQUEST['currencyCodeType'] ?> <?=$_REQUEST['paymentAmount']?></td>
  80.             </tr>
  81.             <tr>
  82.                 <td ><b>Shipping Address: </b></td>
  83.             </tr>
  84.             <tr>
  85.                 <td >
  86.                     Street 1:</td>
  87.                 <td>
  88.                    <?=$resArray['SHIPTOSTREET'] ?></td>
  89.  
  90.             </tr>
  91.             <tr>
  92.                 <td >
  93.                     Street 2:</td>
  94.                 <td><?=$resArray['SHIPTOSTREET2'] ?>
  95.                 </td>
  96.             </tr>
  97.             <tr>
  98.                 <td >
  99.                     City:</td>
  100.  
  101.                 <td>
  102.                     <?=$resArray['SHIPTOCITY'] ?></td>
  103.             </tr>
  104.             <tr>
  105.                 <td >
  106.                     State:</td>
  107.                 <td>
  108.                     <?=$resArray['SHIPTOSTATE'] ?></td>
  109.             </tr>
  110.             <tr>
  111.                 <td >
  112.                     Postal code:</td>
  113.  
  114.                 <td>
  115.                     <?=$resArray['SHIPTOZIP'] ?></td>
  116.             </tr>
  117.             <tr>
  118.                 <td >
  119.                     Country:</td>
  120.                 <td>
  121.                      <?=$resArray['SHIPTOCOUNTRYNAME'] ?></td>
  122.             </tr>
  123.             <tr>
  124.                 <td class="thinfield">
  125.                      <a href="DoExpressCheckoutPayment.php">Pay</a>
  126.                 </td>
  127.             </tr>
  128.         </table>
  129.     </center>
  130.     </form>
  131.  
  132. </body>
  133. </html>
Advertisement
Add Comment
Please, Sign In to add comment