Пример #1
0
<?php

include "ppwps_include_path.inc";
require_once "utility.php";
require_once "constants.php";
require_once "EWPServices.php";
$buttonParams = array("cmd" => "_xclick", "business" => DEFAULT_EMAIL_ADDRESS, "cert_id" => DEFAULT_CERT_ID, "charset" => "UTF-8", "item_name" => htmlspecialchars($_POST["item_name"]), "item_number" => htmlspecialchars($_POST["item_number"]), "amount" => htmlspecialchars($_POST["amount"]), "currency_code" => htmlspecialchars($_POST["currency_code"]), "return" => htmlspecialchars($_POST["returnURL"]), "cancel_return" => htmlspecialchars($_POST["cancelURL"]), "notify_url" => htmlspecialchars($_POST["notifyURL"]), "custom" => "PayPal EWP Sample");
$envURL = "https://www." . DEFAULT_ENV . ".paypal.com";
$buttonReturn = EWPServices::encryptButton($buttonParams, realpath(DEFAULT_EWP_CERT_PATH), realpath(DEFAULT_EWP_PRIVATE_KEY_PATH), DEFAULT_EWP_PRIVATE_KEY_PWD, realpath(PAYPAL_CERT_PATH), $envURL, BUTTON_IMAGE);
if (!$buttonReturn["status"]) {
    Utils::PPError($buttonReturn["error_msg"], $buttonReturn["error_no"]);
    exit;
}
$button = $buttonReturn["encryptedButton"];
?>

<html>
<head>
	<title>PayPal Website Payment Standard Buy Now</title>
</head>
<body alink=#0000FF vlink=#0000FF>
<br>
<center>
<font size=2 color=black face=Verdana><b>Encrypted Website Payment (EWP) Buttons</b></font>
<br><br>
<font color=red>
	<b>You must be logged into <a href="https://<?php 
echo DEFAULT_DEV_CENTRAL;
?>
.paypal.com" target="_blank">Developer Central</a></b>
</font>
Пример #2
0
 protected function paypal_encrypt($arr)
 {
     require_once "crypt/EWPServices.php";
     $blob = EWPServices::encryptButton($arr, $this->public_cert, $this->private_key, '', $this->paypal_cert, $this->paypal_url);
     if (!$blob) {
         die('error getting encrypted button');
     }
     return $blob;
 }