Hi there, well look here ill post my paypal script and zaypay, both automatic!
zaypay:
And result is:
Some more codes about zaypay:
Or_:
And also:
And last one! SORRY LOL
paypal ill post it later THANKSSSSSSSSSS LOL
zaypay:
Code:
<?php
// option 3, 3EUR to one person
$options[0]["opt"] = "3 EUR Donation | 20 PP";
$options[0]["split"] = array(100);
$options[0]["points"] = 20;
$options[0]["keys"] = array();
$options[0]["keys"][0] = array(id here, ''); // id, key
// option 2, 9EUR split between two people
// $options[1]["opt"] = "9 EUR for 15 point";
// $options[1]["split"] = array(50, 50); // total MUST be 100
// $options[1]["points"] = 15;
// $options[1]["keys"] = array();
// $options[1]["keys"][0] = array(54321, '0r2308fhwe0823thr230r3qjdfaiofnh'); // id, key
// $options[1]["keys"][1] = array(65432, "6c22ea1504ee31d73de318c998857a01");
//<b><font color='green'>+50% More Promotion (75 PP)</font></b>
$message_to_guests = "<br><center><font color='white'>Login in order to donate via zaypay!</font></center>";
$redirect = "localhost/v/index.php/p/v/gifts"; // Website
// To support ModernAAC replace all of "$_SESSION['account']" with "$_SESSION['account_id']" in pay.php.
?>
And result is:

Some more codes about zaypay:
Code:
<?php
/*-----------------------------------------------------------------------
Name : report.php
Version : 1.2-PHP5
Description : Retrieve payment information, when triggerd by Zaypay
Date : June 2009, Amsterdam, The Netherlands
By : Zaypay International B.V. 2008 - 2009 (RDF)
Last changes : Made class easier to use and understand
-----------------------------------------------------------------------*/
require_once('includes/config.php');
require_once('includes/Zaypay.class.php');
require_once('includes/database.php');
$time = date("F j, Y, g:i a");
if (isset($_GET['payment_id'])) {
$result = mysql_query("SELECT * FROM vapus_payment WHERE payID='{$_GET['payment_id']}' LIMIT 1");
$array = mysql_fetch_assoc($result);
$Zaypay = New Zaypay($options[$array['payopt']]["keys"][$array["payto"]][0], $options[$array['payopt']]["keys"][$array["payto"]][1]);
$zaypay_info = $Zaypay->show_payment($_GET['payment_id']);
$payment_id = $zaypay_info['payment']['id'];
$payment_status = $zaypay_info['payment']['status'];
$point = $options[$array["payopt"]]["points"];
// Update to new status in database
mysql_query("UPDATE vapus_payment SET status = '{$payment_status}' WHERE payID = '{$payment_id}'");
// Only give points if the status is "paid"
$account_id = stripslashes(ucwords(strtolower(trim($array['account_id']))));
if ($payment_status == "paid" && $array["status"] != "paid") {
// Update points in account table
mysql_query("UPDATE accounts SET premium_points = premium_points + ".$point." WHERE accounts.id = ".$account_id."");
$archivo = '../../zaypay.log';
// Abre el archivo para obtener el contenido existente
$actual = file_get_contents($archivo);
// Añade una nueva persona al archivo
$actual .= ''.$time.' - Points: '.$point.' - Account ID: '.$account_id.'\n';
// Escribe el contenido al archivo
file_put_contents($archivo, $actual);
// Update db data
mysql_query("UPDATE vapus_payment_storage SET value=value+1 WHERE name='paid_".$array['payopt']."_t'");
mysql_query("UPDATE vapus_payment_storage SET value=value+1 WHERE name='paid_".$array['payopt']."_".$array['payto']."'");
}
}
die ('*ok*');
?>
Code:
<?php
/**
* Caches manipulated variables into files for future use
* @author Charles Weiss < c w e i s s [ a t ] f t w m a r k e t i n g . c o m >
* @copyright Copyright (C) Fetch The Web 2006-2008
* @version 0.1
*/
class ObjectCache {
private $data;
private $ext = '_cache.php'; // The group of the cache file ( appended to end of filename )
private $path = './'; // The FULL path to the cached file
function __construct() {
$this->data = array();
}
/**
* Fetches variable from the cache if cache exists and data has not expired
* @param $id The id of that variable for use in the filename
* @param $lock Optional parameter instructing the class to lock the file.
* @return the cache contents OR false on error
*/
function get($id) {
# if (isset($this->data[$id])) return $this->data[$id]; // Already set, return to sender
$path = $this->path.base64_encode($id).$this->ext;
if (file_exists($path) && is_readable($path)) { // Check if the cache file exists
include $path;
if (isset($expires) && $expires <= time()) {
$this->clear($id);
return false;
} else {
$this->data[$id] = $cache;
return $cache;
}
} else {
return false;
}
}
/**
* Sets variable into the cache
* @param $id The id of that variable for use in the filename
* @param $cache The data to be stored
* @param $lifetime The expiration time (in seconds) from file creation
* @return the cache contents OR false on error
*/
function put($id, $cache, $lifetime = 0) {
$this->data[$id] = $cache;
if (is_resource($cache)) echo "Can't cache resource.";
$path = $this->path.base64_encode($id).$this->ext;
//$this->clear($id);
file_put_contents($path, '<?php $cache='.$cache.';?>');
//if ($lifetime > 0) fwrite($fp, '$expires='.(time()+$lifetime).';');
//echo "Dang!";
if (file_exists($path)) chmod($path, 777);
else return false;
//echo "Key!";
return true;
}
/**
* Deletes the cache file
* @param $id The id of that variable for use in the filename
* @param $lock Optional parameter instructing the class to lock the file.
* @return the true or descriptive string on error
*/
function clear($id) {
if (isset($this->data[$id])) unset($this->data[$id]);
$pretty_id = base64_encode($id);
$path = $this->path.$pretty_id.$this->ext;
if (file_exists($path) && unlink($path)) return true;
else return 'Cache could not be cleared.';
}
}
?>
Code:
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once('includes/config.php');
require_once('includes/Zaypay.class.php');
require_once('includes/database.php');
// Start session engine
session_start();
// Makesure this is not a guest
if(!isset($_SESSION['account_id']) && $_SESSION['account_id']) {
die($message_to_guests);
}
// No zaypay object in the first round
if(isset($_GET['option']) || isset($_SESSION['option'])) {
$reset = 0;
if(!isset($_SESSION['option']) || (isset($_SESSION['option']) && isset($GET['option']) && $_SESSION['option'] != $_GET['option'])) {
$_SESSION['option'] = $_GET['option'];
$option = $_SESSION['option'];
$reset = 1;
}
else
$option = $_SESSION['option'];
if(isset($_SESSION['payto']) && !$reset) {
$pay = $_SESSION['payto'];
} else {
$result = mysql_query("SELECT value FROM vapus_payment_storage WHERE name='paid_".$option."_t'");
// doesn't exist, create
if(!mysql_num_rows($result)) {
$total = 0;
mysql_query("INSERT INTO vapus_payment_storage VALUES('paid_".$option."_t', 0)");
} else {
$data = mysql_fetch_assoc($result);
$total = $data["value"];
}
$pay = 0;
for($i=0;$i<sizeof($options[$option]["keys"]); $i++) {
$result = mysql_query("SELECT value FROM vapus_payment_storage WHERE name='paid_".$option."_".$i."'");
// doesn't exist, create
if(!mysql_num_rows($result)) {
$key_total = 0;
mysql_query("INSERT INTO vapus_payment_storage VALUES('paid_".$option."_".$i."', 0)");
} else {
$data = mysql_fetch_assoc($result);
$key_total = $data["value"];
}
if ( $key_total == 0 || ($key_total / $total) * 100 < $options[$option]["split"][$i] ) {
$pay = $i;
// match found, break loop
break;
}
}
$_SESSION['payto'] = $pay;
}
$Zaypay = New Zaypay($options[$option]["keys"][$pay][0], $options[$option]["keys"][$pay][1]);
}
// Fourth step: check payment
if (isset($_POST['action']) && $_POST['action'] == 'paid' && isset($_POST['paymentid'])) {
$zaypay_info = $Zaypay->show_payment($_POST['paymentid']);
$status = $zaypay_info['payment']['status'];
if (isset($zaypay_info['payment']['verification-needed']) and $zaypay_info['payment']['verification-needed'] == 'true' and isset($_POST['verification_code'])) {
if ($zaypay_info = $Zaypay->verification_code($_POST['paymentid'], $_POST['verification_code'])) {
$status = $zaypay_info['payment']['status'];
}
}
if ($status == 'paid') {
include ('./pages/3-paid.php');
$Zaypay->mark_payload_provided($_POST['paymentid']);
}
elseif ($status == 'prepared' or $status == 'in_progress' or $status == 'paused') {
include ('./pages/2-pay.php');
}
else {
echo "An error has occured [{$status}]";
}
}
// Third step: Let consumer pay
elseif (isset($_POST['action']) && $_POST['action'] == 'pay' && isset($_POST['locale']) && isset($_POST['paymentmethod'])) {
if(!($zaypay_info = $Zaypay->create_payment($_POST['locale'], $_POST['paymentmethod']))){
die ($Zaypay->getError());
}
// Here you could insert the payment information into your database. For Example:
$st = mysql_query("INSERT INTO vapus_payment (payID, account_id, status, payto, payopt) VALUES ('{$Zaypay->getPaymentId()}', '{$_SESSION['account_id']}', 'prepared', '{$pay}', '{$option}')");
if(!$st) die(mysql_error());
// drop cookied
setcookie("payto", "", time() - 3600);
setcookie("option", "", time() - 3600);
include ('./pages/2-pay.php');
}
// First step: Let consumer choose country and language
elseif(isset($_GET['option'])) {
if(!($locales = $Zaypay->list_locales())) {
die($Zaypay->getError());
}
if (isset($_POST['locale_country']) and isset($_POST['locale_language'])) {
$Zaypay->setLocale($_POST['locale_language'] . '-' . $_POST['locale_country']);
}
else {
if(!$Zaypay->locale_for_ip($_SERVER['REMOTE_ADDR']))
$Zaypay->setLocale('en-SE');
}
if(!($payment_methods = $Zaypay->list_payment_methods($Zaypay->getLocale()))){
$error = $Zaypay->getError();
include('./pages/1-error.php');
die();
}
include('./pages/1-choosemethod.php');
}
else {
include('./pages/0-option.php');
if(isset($_SESSION['option']))
unset($_SESSION['option']);
if(isset($_SESSION['payto']))
unset($_SESSION['payto']);
}
?>
Code:
<?php
/*-----------------------------------------------------------------------
Name : Zaypay.class.php
Version : 1.2.1-PHP5
Description : Create and Check payments at Zaypay.com
Date : July 2009, Amsterdam, The Netherlands
By : Zaypay International B.V. 2008 - 2009 (RDF)
Last changes : Added optional amount to create_payment and list_locales
functions
-----------------------------------------------------------------------*/
error_reporting(E_ALL);
class Zaypay {
private $price_setting_id = 0;
private $price_setting_key = null;
private $locale_consumer = null;
private $payment_id = 0;
private $request_method = 'fsock'; // CURL or fsock
private $request_url = 'https://secure.zaypay.com';
private $request_url_scheme = null;
private $request_url_host = null;
private $request_url_port = null;
private $error = null;
/*-----------------------------------------------------------------------
Construct
-----------------------------------------------------------------------*/
public function __construct ($price_setting_id = null, $price_setting_key = null) {
if ($price_setting_id !== null and is_numeric($price_setting_id)) {
$this->price_setting_id = $price_setting_id;
}
if ($price_setting_key !== null) {
$this->price_setting_key = $price_setting_key;
}
}
/*-----------------------------------------------------------------------
Public Functions
-----------------------------------------------------------------------*/
/**
* locale_for_ip function.
*
* @access public
* @param string $ip_address
* @return string locale of ip address
*/
public function locale_for_ip ($ip_address) {
$XML = $this->RequestURL("/{$ip_address}/pay/{$this->price_setting_id}/locale_for_ip?key={$this->price_setting_key}");
$oXML = $this->parseXML($XML);
if (isset($oXML->locale)) {
return ($this->setLocale((string) $oXML->locale));
}
else {
return null;
}
}
/**
* list_locales function.
*
* @access public
* @return array with available countries and languages
*/
public function list_locales ($optional_amount = null) {
$XML = $this->RequestURL("/{$optional_amount}/pay/{$this->price_setting_id}/list_locales?key={$this->price_setting_key}");
$oXML = $this->parseXML($XML);
if ($this->checkXMLError($oXML)) {
return false;
}
foreach ($oXML->languages->language AS $language) {
$language = (array) $language;
$language_list[] = array(
'code' => $language['code'],
'english-name' => $language['english-name'],
'native-name' => $language['native-name']
);
}
foreach ($oXML->countries->country As $country) {
$country = (array) $country;
$country_list[] = array(
'code' => $country['code'],
'name' => $country['name']
);
}
return array('languages' => $language_list, 'countries' => $country_list);
}
/**
* list_payment_methods function.
*
* @access public
* @param string $locale
* @return array with payment methods
*/
public function list_payment_methods ($locale, $optional_amount = null) {
$XML = $this->RequestURL("/{$optional_amount}/{$locale}/pay/{$this->price_setting_id}/payments/new?key={$this->price_setting_key}");
$oXML = $this->parseXML($XML);
$this->setLocale($locale);
if ($this->checkXMLError($oXML)) {
return false;
}
if ($oXML->{'payment-methods'}->{'payment-method'}) {
$payment_method_list = array();
foreach ($oXML->{'payment-methods'}->{'payment-method'} AS $payment_method) {
$payment_method = (array) $payment_method;
$payment_method_list[$payment_method['payment-method-id']] = $payment_method;
}
return $payment_method_list;
}
else {
$this->error = $XML;
return false;
}
}
/**
* create_payment function.
*
* @access public
* @param string $locale
* @param int $method_id
* @return array with payment data
*/
public function create_payment ($locale, $method_id, $optional_amount = null) {
$XML = $this->RequestURL("/{$optional_amount}/{$locale}/pay/{$this->price_setting_id}/payments/create?key={$this->price_setting_key}&payment_method_id={$method_id}");
$oXML = $this->parseXML($XML);
$this->setLocale($locale);
return $this->parsePayment($oXML);
}
/**
* show_payment function.
*
* @access public
* @param int $payment_id
* @return array with payment data
*/
public function show_payment ($payment_id) {
$XML = $this->RequestURL("///pay/{$this->price_setting_id}/payments/{$payment_id}?key={$this->price_setting_key}");
$oXML = $this->parseXML($XML);
return $this->parsePayment($oXML);
}
/**
* verification_code function.
*
* @access public
* @param int $payment_id
* @param string $verification_code
* @return array with payment data
*/
public function verification_code ($payment_id, $verification_code) {
$XML = $this->RequestURL("///pay/{$this->price_setting_id}/payments/{$payment_id}/verification_code?key={$this->price_setting_key}&verification_code={$verification_code}");
$oXML = $this->parseXML($XML);
return $this->parsePayment($oXML);
}
/**
* mark_payload_provided function.
*
* @access public
* @param int $payment_id
* @return array with payment data
*/
public function mark_payload_provided ($payment_id) {
$XML = $this->RequestURL("///pay/{$this->price_setting_id}/payments/{$payment_id}/mark_payload_provided?key={$this->price_setting_key}");
$oXML = $this->parseXML($XML);
return $this->parsePayment($oXML);
}
/*-----------------------------------------------------------------------
Private Functions
-----------------------------------------------------------------------*/
/**
* @access private
* @param string $uri
* @return content of URL
*/
private function RequestURL ($uri) {
if (function_exists('curl_init')) {
$this->request_method = 'CURL';
}
$url = parse_url($this->request_url);
$this->request_url_scheme = (isset($url['scheme'])) ? $url['scheme'] : 'http://';
$this->request_url_host = $url['host'];
$this->request_url_port = (isset($url['port'])) ? $url['port'] : (($this->request_url_scheme == 'https') ? 443 : 80);
if ($this->request_method == 'CURL') {
return $this->RequestURLCURL ($uri);
}
else {
return $this->RequestURLFsock ($uri);
}
}
/**
* @access private
* @param string $uri
* @return content of URL fetched by fsock
*/
private function RequestURLFsock ($uri) {
$buf = '';
$scheme = ($this->request_url_scheme == 'https') ? 'ssl://' : '';
$fp = fsockopen($scheme . $this->request_url_host, $this->request_url_port, $errno, $errstr, 10);
if ($fp) {
$push = "GET {$uri} HTTP/1.1" . "\r\n" .
"Host: {$this->request_url_host}" . "\r\n" .
"Accept: application/xml" . "\r\n" .
"Connection: close" . "\r\n\r\n";
fputs($fp, $push);
while (!feof($fp))
$buf .= fgets($fp, 128);
fclose($fp);
list($headers, $content) = preg_split("/(\r?\n){2}/", $buf, 2);
return $content;
}
else {
return null;
}
}
/**
* @access private
* @param string $uri
* @return content of URL fetched by CURL
*/
private function RequestURLCURL ($uri) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->request_url_scheme . '://' . $this->request_url_host . $uri);
curl_setopt($ch, CURLOPT_PORT, $this->request_url_port);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml'));
curl_setopt($ch, CURLOPT_HEADER, false);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
/**
* @access private
* @param string $XML
* @return XML in Object
*/
private function parseXML ($XML) {
try {
$data = new SimpleXMLElement($XML);
if ($data == false) {
return false;
}
return $data;
}
catch (Exception $e) {
return false;
}
}
/**
* @access private
* @param object $oXML
* @return array with payment_info
*/
private function parsePayment ($oXML) {
if ($this->checkXMLError($oXML)) {
return false;
}
elseif ($oXML->payment) {
return $this->object2array($oXML);
}
else {
return false;
}
}
/**
* @access private
* @param object $payment_object
* @return array with payment_info
*/
private function object2array ($payment_object) {
$this->payment_id = $payment_object->payment->id;
$payment_array = (array) $payment_object;
$payment_array['payment'] = (array) $payment_object->payment;
unset($payment_array['@attributes']);
return ($this->payment_method_info = $payment_array);
}
/**
* @access private
* @param object $oXML
* @return true when error object is present
*/
private function checkXMLError ($oXML) {
if (isset($oXML->error)) {
$this->error = $oXML->error;
return true;
}
else {
return false;
}
}
/*-----------------------------------------------------------------------
SET and GET functions
-----------------------------------------------------------------------*/
/**
* @param string $request_method
* @return true
*/
public function setRequestMethod ($request_method) {
if ($request_method == 'CURL' or $request_method == 'curl') {
$this->request_method = 'CURL';
}
elseif ($request_method == 'fsock') {
$this->request_method = 'fsock';
}
return true;
}
/**
* @param string $locale
* @return true when xx-XX
*/
public function setLocale ($locale) {
if (preg_match('/^([a-z]{2})-([A-Z]{2})$/', $locale)) {
return ($this->locale_consumer = $locale);
}
else {
return false;
}
}
/**
* @return locale of consumer
*/
public function getLocale ($type = null) {
if ($type !== null) {
if (strstr($this->locale_consumer, '-')) {
list($locale['language'], $locale['country']) = explode('-', $this->locale_consumer);
return (isset($locale[$type])) ? $locale[$type] : null;
}
else {
return null;
}
}
return $this->locale_consumer;
}
/**
* @return payment information
*/
public function getPaymentInfo () {
return $this->payment_method_info;
}
/**
* @return payment ID
*/
public function getPaymentId () {
return $this->payment_id;
}
/**
* @return error (if occured)
*/
public function getError () {
return $this->error;
}
}
?>