|
|
|
| Доброго времени суток.
Кто работал с alertPay помогите разобраться с автоприемом денег на сайте. Вроде все делаю по инструкции а приходит: INVALID TOKEN
Вот описание интерфейса: https://dev.alertpay.com/en/integration-tools/html-integration/ipn-v2-guide/88-epd-v2-guide.html
Но что-то не получается разобраться | |
|
|
|
|
|
|
|
для: tvv123456
(12.10.2011 в 01:05)
| | Белый экран и INVALID TOKEN? | |
|
|
|
|
|
|
|
для: 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($ch, CURLOPT_URL, EPD_V2_HANDLER);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$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");
}
|
| |
|
|
|