Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = $input;
- error_reporting(E_ALL);
- $access_code = '5Jn3Q3sZvg9OPbDzIYAv';
- $currency = 'AED';
- $customer_email = '[email protected]';
- $merchant_reference = 'Test0110';
- $order_description = 'Glam360 payment';
- $language = $data['language'];
- $merchant_identifier = 'AsjeyPfd';
- $command = 'PURCHASE';
- $amount_in_cents = $data['amount'] * 100;
- // creating signature
- $sha_request_phrase = 'kjads';
- $source = $sha_request_phrase.'access_code='.$access_code.'amount='.$amount_in_cents.'command='.$command.'currency='.$currency.'customer_email='.$customer_email.
- 'language='.$language.'merchant_identifier='.$merchant_identifier.'merchant_reference='.$merchant_reference.$sha_request_phrase;
- $signature = hash("sha256", $source);
- $requestParams = [
- 'access_code' => $access_code ,
- 'amount' => $amount_in_cents,
- 'currency' => $currency,
- 'customer_email' => $customer_email,
- 'merchant_reference' => $merchant_reference,
- // 'order_description' => $order_description,
- 'language' => $language,
- 'merchant_identifier' => $merchant_identifier,
- 'signature' => $signature,
- 'command' => $command,
- ];
- $redirectUrl = 'https://sbcheckout.payfort.com/FortAPI/paymentPage';
- echo "<html xmlns='http://www.w3.org/1999/xhtml'>\n<head></head>\n<body>\n";
- echo "<form action='$redirectUrl' method='post' name='frm'>\n";
- foreach ($requestParams as $a => $b) {
- echo "\t<input type='hidden' name='".htmlentities($a)."' value='".htmlentities($b)."'>\n";
- }
- echo "\t<script type='text/javascript'>\n";
- echo "\t\tdocument.frm.submit();\n";
- echo "\t</script>\n";
- echo "</form>\n</body>\n</html>";
Add Comment
Please, Sign In to add comment