sheena2994

Untitled

Jan 30th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. $data = $input;
  2. error_reporting(E_ALL);
  3. $access_code = '5Jn3Q3sZvg9OPbDzIYAv';
  4. $currency = 'AED';
  5. $customer_email = '[email protected]';
  6. $merchant_reference = 'Test0110';
  7. $order_description = 'Glam360 payment';
  8. $language = $data['language'];
  9. $merchant_identifier = 'AsjeyPfd';
  10. $command = 'PURCHASE';
  11. $amount_in_cents = $data['amount'] * 100;
  12.  
  13. // creating signature
  14. $sha_request_phrase = 'kjads';
  15.  
  16. $source = $sha_request_phrase.'access_code='.$access_code.'amount='.$amount_in_cents.'command='.$command.'currency='.$currency.'customer_email='.$customer_email.
  17. 'language='.$language.'merchant_identifier='.$merchant_identifier.'merchant_reference='.$merchant_reference.$sha_request_phrase;
  18.  
  19. $signature = hash("sha256", $source);
  20.  
  21. $requestParams = [
  22. 'access_code' => $access_code ,
  23. 'amount' => $amount_in_cents,
  24. 'currency' => $currency,
  25. 'customer_email' => $customer_email,
  26. 'merchant_reference' => $merchant_reference,
  27. // 'order_description' => $order_description,
  28. 'language' => $language,
  29. 'merchant_identifier' => $merchant_identifier,
  30. 'signature' => $signature,
  31. 'command' => $command,
  32. ];
  33.  
  34. $redirectUrl = 'https://sbcheckout.payfort.com/FortAPI/paymentPage';
  35. echo "<html xmlns='http://www.w3.org/1999/xhtml'>\n<head></head>\n<body>\n";
  36. echo "<form action='$redirectUrl' method='post' name='frm'>\n";
  37.  
  38. foreach ($requestParams as $a => $b) {
  39. echo "\t<input type='hidden' name='".htmlentities($a)."' value='".htmlentities($b)."'>\n";
  40. }
  41. echo "\t<script type='text/javascript'>\n";
  42. echo "\t\tdocument.frm.submit();\n";
  43. echo "\t</script>\n";
  44. echo "</form>\n</body>\n</html>";
Add Comment
Please, Sign In to add comment