Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Płatności payu
trifek
post
Post #1





Grupa: Zarejestrowani
Postów: 340
Pomógł: 0
Dołączył: 28.09.2015

Ostrzeżenie: (0%)
-----


Witam serdecznie,
Próbuję podłączyć płatności payu - ale chyba robię coś nie tak sad.gif
Mam taki kod:
  1. $id_payu = 123456; // klucz payu
  2. $zlacz = $zlacz."13a980d4f851f3d9a1cfc792fb1f5e50"; //drugi klucz
  3. $podpis = hash("md5", $zlacz);
  4. $OpenPayU_Signature = "sender=".$id_payu.";algorithm=MD5;signature=".$podpis;
  5.  
  6.  
  7. <form method="POST" action="https://secure.payu.com/api/v2_1/orders" id="payu-payment-form" class="" name="nazwa_formularza">
  8. <input type="hidden" name="notifyUrl" value="<?php echo $gt_myurl;?>order/OrderNotify.php" />
  9. <input type="hidden" name="continueUrl" value="<?php echo $gt_myurl;?>/cms/admin/start.html?strona=edytuj_moje_dane&rekord=<?php echo $_GET['rekord'];?>&stan=ok" />
  10. <input type="hidden" name="customerIp" value="<?php echo IP_prawdziwe();?>" />
  11. <input type="hidden" name="merchantPosId" value="<?php echo $id_payu;?>" />
  12. <input type="hidden" name="description" value="Przedłużenie abonamentu firmy <?php echo baza_odczyt($row['nazwa']);?>" />
  13. <input type="hidden" name="currencyCode" value="PLN" />
  14. <input type="hidden" name="totalAmount" value="<?php echo $kwota_przedluzenia;?>" />
  15. <input type="hidden" name="extOrderId" value="<?php echo baza_odczyt($row['gt_id']);?>.<?php echo rand(1000000,10000000000); ?>" />
  16. <input type="hidden" name="products[0].name" value="Przedłużenie abonamentu firmy <?php echo baza_odczyt($row['nazwa']);?>" />
  17. <input type="hidden" name="products[0].unitPrice" value="<?php echo $kwota_przedluzenia;?>" />
  18. <input type="hidden" name="products[0].quantity" value="1" />
  19. <input type="hidden" name="buyer.email" value="<?php echo baza_odczyt($row['email']);?>" />
  20. <input type="hidden" name="buyer.phone" value="<?php echo baza_odczyt($row['tel']);?>" />
  21. <input type="hidden" name="buyer.firstName" value="<?php echo baza_odczyt($row['nazwa']);?>" />
  22. <input type="hidden" name="OpenPayu-Signature" value="<?php echo $OpenPayU_Signature;?>" /><button type="submit" id="fwefwefw" class="fwefwefw"></button>
  23. </form>


W wyniku tego kodu otrzymuję przykładowo taki formularz:
  1.  
  2. <form method="POST" action="https://secure.payu.com/api/v2_1/orders" id="payu-payment-form" class="" name="nazwa_formularza">
  3. <input type="hidden" name="notifyUrl" value="http://127.0.0.1/lunchtime/order/OrderNotify.php" />
  4. <input type="hidden" name="continueUrl" value="http://127.0.0.1/?stan=ok" />
  5. <input type="hidden" name="customerIp" value="127.0.0.1" />
  6. <input type="hidden" name="merchantPosId" value="123456" />
  7. <input type="hidden" name="description" value="xxxxxxxxxxx" />
  8. <input type="hidden" name="currencyCode" value="PLN" />
  9. <input type="hidden" name="totalAmount" value="10000" />
  10. <input type="hidden" name="extOrderId" value="1.8034607548" />
  11. <input type="hidden" name="products[0].name" value="xxxxxxxxxxx" />
  12. <input type="hidden" name="products[0].unitPrice" value="10000" />
  13. <input type="hidden" name="products[0].quantity" value="1" />
  14. <input type="hidden" name="buyer.email" value="email@wp.pl" />
  15. <input type="hidden" name="buyer.phone" value="telefon" />
  16. <input type="hidden" name="buyer.firstName" value="imii" />
  17. <input type="hidden" name="OpenPayu-Signature" value="sender=123456;algorithm=MD5;signature=09be80f7f539182c97f2883e8c89fb28" /><button type="submit" id="fwefwefw" class="fwefwefw"></button>
  18. </form>
  19.  


Czy to jest poprawne?
Payu zgłasza mi błąd: Dostęp zabroniony.

Nie wiem czy to kwestia danych testowych - czy coś mam nie tak z tymi podpisami :/
Go to the top of the page
+Quote Post
mlawnik
post
Post #2





Grupa: Zarejestrowani
Postów: 455
Pomógł: 49
Dołączył: 12.04.2010

Ostrzeżenie: (0%)
-----


Pisz, po to mają support.


--------------------
Pozdrawiam,
mlawnik

Cytat(nospor)
Jedzmy gówno.... miliony much nie może się przecież mylić
Go to the top of the page
+Quote Post
trueblue
post
Post #3





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


123456 to Twój POS id?


--------------------
Go to the top of the page
+Quote Post
trifek
post
Post #4





Grupa: Zarejestrowani
Postów: 340
Pomógł: 0
Dołączył: 28.09.2015

Ostrzeżenie: (0%)
-----


nie, wkleiłem tutaj specjalnie takie (przykładowe) smile.gif

Ten post edytował trifek 29.07.2016, 18:50:07
Go to the top of the page
+Quote Post
trueblue
post
Post #5





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


Hash jest poprawnie obliczany?
No, i raczej powiadomienia nie przyjdą na Twój localhost.


--------------------
Go to the top of the page
+Quote Post
trifek
post
Post #6





Grupa: Zarejestrowani
Postów: 340
Pomógł: 0
Dołączył: 28.09.2015

Ostrzeżenie: (0%)
-----


localhost - to wiem.... Tego hasha nie jestem pewien :/
Go to the top of the page
+Quote Post
Pyton_000
post
Post #7





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Cytat
Parametr algorithm może przyjmować poniższe wartości:

SHA-256,
SHA-384,
SHA-512,


Ten post edytował Pyton_000 31.07.2016, 17:09:21
Go to the top of the page
+Quote Post
trifek
post
Post #8





Grupa: Zarejestrowani
Postów: 340
Pomógł: 0
Dołączył: 28.09.2015

Ostrzeżenie: (0%)
-----


Nie pomogło sad.gif
Znalazłem taki link: http://developers.payu.com/pl/classic_api....ning_parameters

Zmodyfikowałem formularz na takie coś:
  1. $pos_id = 123456;
  2. $session_idd = rand(1000000,10000000000));
  3. $pos_auth_key = 'oU2mdz6';
  4. $amount = 10000;
  5. $desc = "Przedłużenie xyz";
  6. $first_name = "imie";
  7. $last_name = 'nazwisko';
  8. $email_m = "email@mail.pl";
  9. $client_ip = IP_prawdziwe();
  10. $ts = strtotime(date("Y-m-d H:i:s"));
  11. $key1 = 'a6705d62fd76d65346329864512a25ca';
  12. $key2 = 'dd732fkune300f53b5bdafc934c1daa1d';
  13.  
  14.  
  15. $client_ipX = urlencode($client_ip);
  16. $amountX = urlencode($amount);
  17. $descX = urlencode($desc);
  18. $email_mX = urlencode($email_m);
  19. $first_nameX = urlencode($first_name);
  20. $last_nameX = urlencode($last_name);
  21. $pos_auth_keyX = urlencode($pos_auth_key);
  22.  
  23. $sig = ("amount=".$amountX."&client_ip=".$client_ipX."&desc=".$descX."&email=".$email_mX."&first_name=".$first_nameX."&js=1&last_name=".$last_nameX."&pos_auth_key=".$pos_auth_keyX."&pos_id=$pos_id&session_id=$session_idd.&ts=$ts&$key2");
  24. $sig = hash('sha256', $sig);


Mam taki formularz:
  1. <form action="https://secure.payu.com/paygw/UTF/NewPayment" method="POST" name="nazwa_formularza">
  2. <input type="hidden" name="first_name" value="<?php echo $first_name;?>">
  3. <input type="hidden" name="last_name" value="<?php echo $last_name;?>">
  4. <input type="hidden" name="email" value="<?php echo $email_m;?>">
  5. <input type="hidden" name="merchantPosId" value="<?php echo $pos_id;?>">
  6. <input type="hidden" name="pos_id" value="<?php echo $pos_id;?>">
  7. <input type="hidden" name="pos_auth_key" value="<?php echo $pos_auth_key;?>">
  8. <input type="hidden" name="session_id" value="<?php echo $session_idd; ?>">
  9. <input type="hidden" name="amount" value="<?php echo $amount;?>">
  10. <input type="hidden" name="desc" value="<?php echo $desc;?>">
  11. <input type="hidden" name="notifyUrl" value="<?php echo $gt_myurl;?>order/payu.php" />
  12. <input type="hidden" name="continueUrl" value="<?php echo $gt_myurl;?>/cms/admin/start.html?strona=edytuj_moje_dane&rekord=<?php echo $_GET['rekord'];?>&stan=ok" />
  13. <input type="hidden" name="customerIp" value="<?php echo $client_ip;?>" />
  14. <input type="hidden" name="js" value="1">
  15. <input type="hidden" name="ts" value="<?php echo $ts;?>">
  16. <input type="submit" value="" id="fwefwefw" class="fwefwefw">
  17. <input type="hidden" name="sig" value="<?php echo $sig; ?>">
  18. </form>

Co w efekcie daje formularz:
  1. <form action="https://secure.payu.com/paygw/UTF/NewPayment" method="POST" name="nazwa_formularza">
  2. <input type="hidden" name="first_name" value="firma podstawowa123362">
  3. <input type="hidden" name="last_name" value="x">
  4. <input type="hidden" name="email" value="email@wp.pl">
  5. <input type="hidden" name="merchantPosId" value="123456">
  6. <input type="hidden" name="pos_id" value="123456">
  7. <input type="hidden" name="pos_auth_key" value="oU2mdz6">
  8. <input type="hidden" name="session_id" value="12461086139">
  9. <input type="hidden" name="amount" value="10000">
  10. <input type="hidden" name="desc" value="Przedłużenie xyz">
  11. <input type="hidden" name="notifyUrl" value="http://127.0.0.1/pliki/order/payu.php" />
  12. <input type="hidden" name="continueUrl" value="http://127.0.0.1/plik/index.html?stan=ok" />
  13. <input type="hidden" name="customerIp" value="127.0.0.1" />
  14. <input type="hidden" name="js" value="1">
  15. <input type="hidden" name="ts" value="1470049656">
  16. <input type="submit" value="" id="fwefwefw" class="fwefwefw">
  17. <input type="hidden" name="sig" value="2d1aa1ab0ab646b7117e21d0565bf69fb1fda48834ba24a625a3cfa8aab9e568">
  18. </form>

Payu zwraca mi błąd:
Przepraszamy, nie udało się utworzyć transakcji (kod błędu: 103)

Prosimy o kontakt ze sklepem i podanie numeru błędu.
Dokonanie płatności będzie możliwe w inny sposób.


CO robię nie tak?
Go to the top of the page
+Quote Post
trueblue
post
Post #9





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


Sprawdź czy na ich danych otrzymujesz taki sam hash jak w przykładzie.


--------------------
Go to the top of the page
+Quote Post
motyl-pl
post
Post #10





Grupa: Zarejestrowani
Postów: 294
Pomógł: 31
Dołączył: 2.04.2010

Ostrzeżenie: (0%)
-----


"103 brak lub błędna wartość parametru sig" kod 103

http://developers.payu.com/pl/classic_api.html


--------------------
Go to the top of the page
+Quote Post
trifek
post
Post #11





Grupa: Zarejestrowani
Postów: 340
Pomógł: 0
Dołączył: 28.09.2015

Ostrzeżenie: (0%)
-----


tylko co źle generuje?sad.gif Masz może jakiś pomysł?
Go to the top of the page
+Quote Post
trueblue
post
Post #12





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


Podaj przykładowe dane (ts również) i pokaż jaki hash wyliczyłeś.


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 09:52