daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest May 7th, 2016 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $sandbox = TRUE;
  3. $api_version = '95.0';
  4. $api_endpoint = $sandbox ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
  5. $api_username = $sandbox ? 'ranatest16-facilitator_api1.gmail.com' : 'LIVE_USERNAME_GOES_HERE';
  6. $api_password = $sandbox ? 'GNR69ZR6R647RCHE' : 'LIVE_PASSWORD_GOES_HERE';
  7. $api_signature = $sandbox ? 'AFcWxV21C7fd0v3bYYYRCpSSRl31AOxu7RnKZHS2LOR7w7uoz4RYXMoQ' : 'LIVE_SIGNATURE_GOES_HERE';
  8.  
  9. $request_params = array
  10.                     (
  11.                     'METHOD' => 'DoDirectPayment',
  12.                     'USER' => $api_username,
  13.                     'PWD' => $api_password,
  14.                     'SIGNATURE' => $api_signature,
  15.                     'VERSION' => $api_version,
  16.                     'PAYMENTACTION' => 'Sale',                  
  17.                     'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
  18.                     'CREDITCARDTYPE' => 'MasterCard',
  19.                     'ACCT' => '5522340006063638',                        
  20.                     'EXPDATE' => '012017',          
  21.                     'CVV2' => '456',
  22.                     'FIRSTNAME' => 'Tester',
  23.                     'LASTNAME' => 'Testerson',
  24.                     'STREET' => '707 W. Bay Drive',
  25.                     'CITY' => 'Largo',
  26.                     'STATE' => 'FL',                    
  27.                     'COUNTRYCODE' => 'US',
  28.                     'ZIP' => '33770',
  29.                     'AMT' => '100.00',
  30.                     'CURRENCYCODE' => 'USD',
  31.                     'DESC' => 'Testing Payments Pro'
  32.                     );
  33.  
  34. $nvp_string = '';
  35. foreach($request_params as $var=>$val)
  36. {
  37.     $nvp_string .= '&'.$var.'='.urlencode($val);    
  38. }
  39. //echo $nvp_string;
  40.  
  41.         $curl = curl_init();
  42.         curl_setopt($curl, CURLOPT_VERBOSE, 1);
  43.         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  44.  
  45.         curl_setopt($curl, CURLOPT_TIMEOUT, 60);
  46.         curl_setopt($curl, CURLOPT_URL, $api_endpoint);
  47.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  48.         curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);
  49.         $result = curl_exec($curl);
  50.         echo "<pre>";
  51.         var_dump(curl_getinfo($curl));
  52.                 echo "/<pre>";
  53.  
  54.         if(curl_error($curl))
  55. {
  56.     echo 'error:' . curl_error($curl);
  57. }
  58.         curl_close($curl);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand