Wrong PayPal Transaction id: formatting?

  • Posts: 10
  • Thank you received: 0
11 years 2 months ago #121239

-- HikaShop version -- :2.2.0
-- Joomla version -- : latest
-- PHP version -- : 5.10.1

Hi.
I developed a script for a windows software that requires a challenge code.

This script check if the PayPal Transaction ID is available inside the database.
HikaShop transaction ID's are stored inside the hikashop_history table, but something goes wrong when i query the DB.

I tried to directly check values in rows, and to mysql_fetch aswell.

The script find some values, many not.

This thing is making me fool, since it's possible that the script find the "PayPal transaction id: XXXXXX" only for the ones that i added manually inside the table.

Is hikashop saving something hidden, some errors or formatting?

Using a SELECT * FROM TABLE WHERE history_data = $pay and formartting $pay as "PayPal Transaction id : $transaction_id" always find a value, and others not.

Also i tried to explode only the paypal 17 chars string, but not work!

$pay = "[oaypal id as string]";

// check if Transaction ID is available on the default website.
$query = mysql_query ("SELECT * FROM jh23m_hikashop_history");
$result = mysql_num_rows($query);
while(($row = mysql_fetch_array($query))) {
    $paypal_ids[] =$row['history_data'];
}
//print_r ($paypal_ids);
// ora cerca il valore %pay
$paypal_ids_split = implode("", $paypal_ids);
//print_r ($paypal_ids_split);
$paypal_ids_clean = explode ("PayPal transaction id: ", $paypal_ids_split);
print_r ($paypal_ids_clean);

if (array_search($pay, $paypal_ids_clean,TRUE)){
    echo "Match";
} else 
{ echo "Does not match";
}
echo $pay;

This produce:
Array ( [0] => [1] => 0JW61238FU6854240 [2] => 5EA00979GC149044V [3] => 59P88560S9783170B [4] => 1L697134B06956638 [5] => 1N476458GR470922M [6] => 3N4412142S083993R [7] => 2GN69713EV7294613 [8] => 9WT48148YE725931K [9] => 585690586Y6998523 [10] => 7X9149767T051513K [11] => 5WJ25963L5455313H [12] => 1L717841BA5989748 [13] => 0E750230DV1575308 [14] => 85B43558SH819711N [15] => 78R85507FR2081540 [16] => 96F7363575285431M [17] => 87V99180GV2251342 [18] => 4G459145SE959020V [19] => 86U00726DL9205244 [20] => 70820350T9653825F [21] => 8K002091YN0079914 [22] => 8SD993824R7167708 [23] => 93L886231K973983G [24] => 6E98077468505954G [25] => 770172708D596892K [26] => 22N679682U615734D [27] => 3WR4000656945550Y [28] => 59P88560S9783170B [29] => 8H242117S01162917 [30] => 9WC47475K89394047 [31] => 83L6687699339330K [32] => 1BE09674W4880373N [33] => 3JC01978GH9146509 [34] => 31381161BJ159335S [35] => 17V97629HJ1941344 [36] => 4XG15144CK988864F [37] => 18625833YF123353H [38] => 2GU86013NN2703635 ) Match59P88560S9783170B

But also:
Array ( [0] => [1] => 0JW61238FU6854240 [2] => 5EA00979GC149044V [3] => 59P88560S9783170B [4] => 1L697134B06956638 [5] => 1N476458GR470922M [6] => 3N4412142S083993R [7] => 2GN69713EV7294613 [8] => 9WT48148YE725931K [9] => 585690586Y6998523 [10] => 7X9149767T051513K [11] => 5WJ25963L5455313H [12] => 1L717841BA5989748 [13] => 0E750230DV1575308 [14] => 85B43558SH819711N [15] => 78R85507FR2081540 [16] => 96F7363575285431M [17] => 87V99180GV2251342 [18] => 4G459145SE959020V [19] => 86U00726DL9205244 [20] => 70820350T9653825F [21] => 8K002091YN0079914 [22] => 8SD993824R7167708 [23] => 93L886231K973983G [24] => 6E98077468505954G [25] => 770172708D596892K [26] => 22N679682U615734D [27] => 3WR4000656945550Y [28] => 59P88560S9783170B [29] => 8H242117S01162917 [30] => 9WC47475K89394047 [31] => 83L6687699339330K [32] => 1BE09674W4880373N [33] => 3JC01978GH9146509 [34] => 31381161BJ159335S [35] => 17V97629HJ1941344 [36] => 4XG15144CK988864F [37] => 18625833YF123353H [38] => 2GU86013NN2703635 ) Does not match0JW61238FU6854240

using 0JW61238FU6854240 value.

There is something to know about how the paypal transactions are stored?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 2 months ago #121316

The transaction id is added with trailing \r\n. You don't see them because they don't appear on html pages, but if you look in the database, you should see them in the history table.
You should use something like:
if (array_search($pay."\r\n\r\n", $paypal_ids_clean,TRUE)){

The following user(s) said Thank You: Мыктыбек

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 0
11 years 2 months ago #121404

nicolas wrote: The transaction id is added with trailing \r\n. You don't see them because they don't appear on html pages, but if you look in the database, you should see them in the history table.
You should use something like:
if (array_search($pay."\r\n\r\n", $paypal_ids_clean,TRUE)){



Thanks! im an absolute beginner with php. I solved by using a fuction that clean all withespaces before and after the string. ;)

Please Log in or Create an account to join the conversation.

  • Posts: 39
  • Thank you received: 0
10 years 10 months ago #139732

Hi i want create own transaction server to server i am write some php codes but i can't do it if you know code or some idea can you sent example code php please?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #139813

Hi,

I would recommend to look in the folders of the folder plugins/hikashoppayment of your website. You'll find the full code of all the payment plugins of HikaShop. Plenty of examples to work with.

Please Log in or Create an account to join the conversation.

Time to create page: 0.051 seconds
Powered by Kunena Forum