Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
C++. Мастер-класс в задачах и примерах. Авторы: Кузнецов М.В., Симдянов И.В. Самоучитель PHP 5 / 6 (3 издание). Авторы: Кузнецов М.В., Симдянов И.В. PHP 5. На примерах. Авторы: Кузнецов М.В., Симдянов И.В., Голышев С.В. Объектно-ориентированное программирование на PHP. Авторы: Кузнецов М.В., Симдянов И.В. MySQL на примерах. Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

Форум PHP

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: Работа с alertPay не могу разобраться с token
 
 автор: tvv123456   (12.10.2011 в 01:05)   письмо автору
 
 

Доброго времени суток.
Кто работал с alertPay помогите разобраться с автоприемом денег на сайте. Вроде все делаю по инструкции а приходит: INVALID TOKEN
Вот описание интерфейса: https://dev.alertpay.com/en/integration-tools/html-integration/ipn-v2-guide/88-epd-v2-guide.html
Но что-то не получается разобраться

  Ответить  
 
 автор: mister_pipin   (12.10.2011 в 12:40)   письмо автору
 
   для: tvv123456   (12.10.2011 в 01:05)
 

Белый экран и INVALID TOKEN?

  Ответить  
 
 автор: tvv123456   (12.10.2011 в 18:52)   письмо автору
 
   для: mister_pipin   (12.10.2011 в 12:40)
 

Ну, так-то да, но это все происходит в скрипте(есть у самой системы) вот он:
Все время присылает "не тот токен". Не могу никак разобраться с этой платежкой, а на русском не нашел описания

<?
define
("EPD_V2_HANDLER""https://www.alertpay.com/epd2.ashx");
    
define("TOKEN_IDENTIFIER""token="urlencode("ap_merchant=shares@вааs.com&ap_purchasetype=service&ap_itemname=Pay points&ap_amount=10&ap_currency=USD&ap_description=Описание платежа&apc_userid=5&ap_test=1&ap_image=go"));
    
    
// get the token from Alertpay
    
$token urlencode($_GET['token']);
    
//$token = urlencode("ap_merchant=apdevforum@gmail.com&ap_purchasetype=item-goods&ap_itemname=Pay points&ap_amount=10&ap_currency=USD&ap_description=Описание платежа&apc_userid=5&ap_test=1");

    //preappend the identifier string "token=" 
    
$token TOKEN_IDENTIFIER.$token;
    
mail("wwwww@mail.ru","alertpay","Первый токен ".$token,"from:hoiho@yandex.ru\r\nContent-type:text/plain;Charset=windows-1251\r\n");
    
/**
     * 
     * Sends the URL encoded TOKEN string to the Alertpay's EPD handler
     * using cURL and retrieves the response.
     * 
     * variable $response holds the response string from the Alertpay's EPD V2.
     */
    
    
$response '';
    
    
$ch curl_init();

    
curl_setopt($chCURLOPT_URLEPD_V2_HANDLER);
    
curl_setopt($chCURLOPT_POSTtrue);
    
curl_setopt($chCURLOPT_POSTFIELDS$token);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_HEADERfalse);
    
curl_setopt($chCURLOPT_TIMEOUT60);
    
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);

    
$response curl_exec($ch);

    
curl_close($ch);
    
    if(
strlen($response) > 0)
    {
        if(
urldecode($response) == "INVALID TOKEN")
        {
        
$mes=""
 foreach (
$_REQUEST as $key=>$value)
 {
 
$mes.= htmlspecialchars($key)."->".htmlspecialchars($value)."||";
 }
            
mail("wwwwwww","alertpay","не тот токен".$mes."|","from:hoiho@yandex.ru\r\nContent-type:text/plain;Charset=windows-1251\r\n");
        }
        else
        {
            
//urldecode the received response from Alertpay's EPD V2
            
$response urldecode($response);
            
            
//split the response string by the delimeter "&"
            
$aps explode("&"$response);
                
            
//create a file to save the response information from Alertpay's EPD V2    
            
$myFile "EPDRes.txt";
            
//$fh = fopen($myFile,'a') or die("can't open the file");
            
            //define an array to put the EPD information
            
$info = array();
            
            foreach (
$aps as $ap)
            {
                
//put the EPD information into an associative array $info
                
$ele explode("="$ap);
                
$info[$ele[0]] = $ele[1];
                
                
//write the information to the file EPDRes.txt
                //fwrite($fh, "$ele[0] \t");
                //fwrite($fh, "=\t");
                //fwrite($fh, "$ele[1]\r\n");
            
}
            
            
//fclose($fh);
            
            //setting information about the transaction from the EPD information array
            
$receivedMerchantEmailAddress $info['ap_merchant'];
            
$transactionStatus $info['ap_status'];
            
$testModeStatus $info['ap_test'];
            
$purchaseType $info['ap_purchasetype'];
            
$totalAmountReceived $info['ap_totalamount'];
            
$feeAmount $info['ap_feeamount'];
            
$netAmount $info['ap_netamount'];
            
$transactionReferenceNumber $info['ap_referencenumber'];
            
$currency $info['ap_currency'];
            
$transactionDate $info['ap_transactiondate'];
            
$transactionType $info['ap_transactiontype'];
            
                
            
//setting information about the purchased item from the EPD information array
            
$myItemName $info['ap_itemname'];
            
$myItemCode $info['ap_itemcode'];
            
$myItemDescription $info['ap_description'];
            
$myItemQuantity $info['ap_quantity'];
            
$myItemAmount $info['ap_amount'];
            
            
//setting extra information about the purchased item from the EPD information array
            
$additionalCharges $info['ap_additionalcharges'];
            
$shippingCharges $info['ap_shippingcharges'];
            
$taxAmount $info['ap_taxamount'];
            
$discountAmount $info['ap_discountamount'];
            
            
//setting your customs fields received from the EPD information array
            
$userd_id $info['apc_userid'];
            
            
$date date(m.".".d.".".Y);
$id_user = (int)$userd_id;
$sum round($myItemAmount,2);

            
        }
    }
    else
    {
         
mail("twwwwwwww","alertpay","Непрошло","from:hoiho@yandex.ru\r\nContent-type:text/plain;Charset=windows-1251\r\n");
    }

  Ответить  
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования