PayOne界面不接受我的HASH值

时间:2013-12-10 14:28:52

标签: php hash payment-gateway payment-processing payone

我一直试图让PayOne FrontEnd接口接受我的请求中的哈希值,绝对没有用。我有一张支持票,但需要一个相对较快的解决方案,所以我在这里。

返回的错误是“Hashwert Nicht Korrekt”(哈希值不正确)。

这是我的代码:

$request="authorization"; 
$portalid = 2017373; 
$aid = 24413; 
$key = "secretkeychangedforsecuritoyreasons"; // Key (configurable in the payment portal) 

$id[1]=  "PART_100"; 
$pr[1]=  2000;
$no[1] = 1; 
$de[1] = "Registration Fee";
$va[1] = 19; 
$amount = round($pr[1]*$no[1]);
$clearingtype = "cc";
$mode = "test";
$currency="EUR"; 
$reference="24393"; 
$customerid="24393"; 

    $hash = md5(
             $aid . 
             $amount . 
             $currency . 
             $customerid .
             $clearingtype . 
             $de[1] . 
             $id[1] . 
             $mode .
             $no[1] . 
             $portalid . 
             $pr[1] . 
             $reference . 
             $request . 
             $va[1] . 
             $key
     ); 

$url="https://secure.pay1.de/frontend/?request=" . $request . 
"&aid=" . $aid . 
"&mode=" . $mode .
"&clearingtype=" . $clearingtype .
"&portalid=" . $portalid . 
"&customerid=" . $customerid . 
"&currency=" . $currency . 
"&amount=" . $amount . 
"&reference=" . $reference . 
"&id[1]=" . $id[1] . 
"&pr[1]=" . $pr[1] . 
"&no[1]=" . $no[1] . 
"&de[1]=" . $de[1] . 
"&va[1]=" . $va[1] . 
"&hash=" . $hash; 

header("Location: $url");

我已经检查并重新检查了文档,并且在我将它放在一起的方式中找不到任何错误。如果我更改像portalid等单个值,它会抛出相应的错误。

任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:1)

我在client-api-documentation中找到了以下部分:

  

注意:   PAYONE平台期望计算    哈希    值    转换    至    降低    案件;    例如   87dbc7c369b85b7a699adff1a2b27bab

也许你的哈希里面有一些大写字母?我做了一个" .toLowerCase()" (在Java中)加密哈希。

另一个选择:你忘记了一些参数。 在第一眼看来,我无法看到以下内容:mid

答案 1 :(得分:0)

我们使用以下内容:

$req['aid']          = 09876; // Sub-AccountID
$req['portalid']     = 6789012; // portal-ID
$req['mode']         = "live"; // Live || test
$req['request']      = "authorization"; // Request
$req['id[1]']        = $YourProductID; // e.g. articleno
$req['pr[1]']        = $singleprice;
$req['no[1]']        = $count; // count or pieces
$req['de[1]']        = $articledescription;
$req['amount']       = $summary; // price summary
$req['currency']     = "EUR";
$req['reference']    = $unique_ref.$YourProductId; //my unique is time()
$req['customerid']   = $userId;
$req['clearingtype'] = $clearing; // cc || wlt
$req['encoding']     = "UTF-8";
$req['targetwindow'] = "top";

ksort($req); //so i know its important to sort

//building the hash
foreach ($req as $key => $val) {
    $req['hash'] = $req['hash'] . $val;
}

// all in md5() ... note your own payment ID
$req['hash'] = md5($req['hash'] . $YourPayOneID);

希望它有所帮助;)