Example #1
0
} catch (TeamException $e) {
    $mess = $e->getMessage();
    include 'php/wrongentry.php';
    exit(0);
}
// OK now we are ready to do the PayPal stuff stage 3.
include 'php/credentials.php';
// Step 3 is to get the details
$Req_array = array();
apiapp($Req_array, "METHOD", "GetExpressCheckoutDetails");
apiapp($Req_array, "VERSION", urlencode('51.0'));
apiapp($Req_array, "USER", $API_UserName);
apiapp($Req_array, "PWD", $API_Password);
apiapp($Req_array, "SIGNATURE", $API_Signature);
$utok = urlencode($tok);
apiapp($Req_array, "TOKEN", $utok);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $Req_array));
$chresp = curl_exec($ch);
if (!$chresp) {
    $mess = "Curl failed: " . curl_error($ch) . " (" . curl_errno($ch) . ")";
    include 'php/probpay.php';
    exit(0);
}
// Make an array of the response
$responses = explode('&', $chresp);
Example #2
0
    exit(0);
}
// OK now perform the final PayPal phase to record the payment
include 'php/credentials.php';
// Step 1 is to Set it up
$Req_array = array();
apiapp($Req_array, "METHOD", "DoExpressCheckoutPayment");
apiapp($Req_array, "VERSION", urlencode('51.0'));
apiapp($Req_array, "USER", $API_UserName);
apiapp($Req_array, "PWD", $API_Password);
apiapp($Req_array, "SIGNATURE", $API_Signature);
apiapp($Req_array, "AMT", $amount);
apiapp($Req_array, "PAYMENTACTION", "Sale");
apiapp($Req_array, "CURRENCYCODE", "GBP");
apiapp($Req_array, "TOKEN", urlencode($tok));
apiapp($Req_array, "PAYERID", urlencode($payerid));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $Req_array));
$chresp = curl_exec($ch);
if (!$chresp) {
    $mess = "Curl failed: " . curl_error($ch) . " (" . curl_errno($ch) . ")";
    include 'php/probpay.php';
    exit(0);
}
// Make an array of the response
$responses = explode('&', $chresp);