Redirection means Authorization and Purchase operation and helps you to complete the payment process. Redirection provides you with the benefit of redirecting the customer to payfort's gateway to fill out the credit card details and whenever he makes a purchase his payment is authorized and hold for certain period of time until you capture it or void it on your side.
How it works?
When a customer makes a purchase on your website then his purchase needs to be authorized
We offer you to Redirect your customer from your website to PayFORT’s gateway page to fill out his credit card details during these operations. The Authorization operation holds the amount from the Customer’s credit card for a period of time until you capture or void the transaction. If no capture or void transaction is processed during this period, the transaction will be voided automatically. In Purchase you will send one single request to the PayFORT server in order to authorize and capture the transaction amount.
Looking to void a payment? You can void an authorized payment at any time. However, captured payments can only be refunded.
Endpoints
You can use the sandbox endpoint to test your payment processing page for redirection or you can use the production endpoint if you want to go live.
SandBox
POST https://sbcheckout.payfort.com/FortAPI/paymentPage
Live
POST https://checkout.payfort.com/FortAPI/paymentPage
Parameters Submission Type
When you design your form(html page ) you have to provide the Endpoints in the form method. Providing these endpoints in your page will redirect your request to the PayFORT server. The page can be designed in the programming language of your choice. But you have to include the below mentioned code in your html based form. When you create an HTML based form your request will be sent through the HTML form only. Below is the sample code for the same.
Form Post Request.
<form method=“post” action=“https://sbcheckout.payfort.com/FortAPI/paymentPage” id=“form1” name=“form1”> </form>
The above code snippet is an HTML based form that will post a request to PayFORT server and you are also required to submit parameters in the form so that PayFORT server can understand your request and process the same. There are various parameters that are required to be sent to the PayFORT server which are nothing but set of commands and set of requests which the PayFORT server understands. However, If you are not familiar with HTML tags and forms then you can checkout this site.
Visit the link to check the different parameters to be sent in a redirection request.
Sample Request
You can design your form in any programming language.Here is the sample request (written different languages) which is sent for authorizing a purchase.
$requestParams = array( 'command' => 'AUTHORIZATION', 'access_code' => 'zx0IPmPy5jp1vAz8Kpg7', 'merchant_identifier' => 'CycHZxVj', 'merchant_reference' => 'XYZ9239-yu898', 'amount' => '10000', 'currency' => 'AED', 'language' => 'en', 'customer_email' => 'test@payfort.com', 'signature' => '7cad05f0212ed933c9a5d5dffa31661acf2c827a', 'order_description' => 'iPhone 6-S', );
import cgi requestParams = { 'command' => 'AUTHORIZATION', 'access_code' => 'zx0IPmPy5jp1vAz8Kpg7', 'merchant_identifier' => 'CycHZxVj', 'merchant_reference' => 'XYZ9239-yu898', 'amount' => '10000', 'currency' => 'AED', 'language' => 'en', 'customer_email' => 'test@payfort.com', 'signature' => '7cad05f0212ed933c9a5d5dffa31661acf2c827a', 'order_description' => 'iPhone 6-S', };
require 'cgi' requestParams = { 'command' => 'AUTHORIZATION', 'access_code' => 'zx0IPmPy5jp1vAz8Kpg7', 'merchant_identifier' => 'CycHZxVj', 'merchant_reference' => 'XYZ9239-yu898', 'amount' => '10000', 'currency' => 'AED', 'language' => 'en', 'customer_email' => 'test@payfort.com', 'signature' => '7cad05f0212ed933c9a5d5dffa31661acf2c827a', 'order_description' => 'iPhone 6-S', }; requestParams.each {|key, value| puts key +value ; }
Sample code for redirection
Here are the sample code for redirecting the request to PayFORT.
$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>";
redirectUrl = 'https://sbcheckout.payfort.com/FortAPI/paymentPage';
print "<html xmlns='http://www.w3.org/1999/xhtml'>\n<head></head>\n<body>\n";
print "<form action='redirectUrl' method='post' name='frm'>\n";
for (slug, title) in requestParams.items():
print "\t<input type='hidden' name='"+ cgi.escape(slug)+"' value='"+ cgi.escape(title)+"'>\n";
print "</form>";
print "\t<script type='text/javascript'>\n";
print "\t\tdocument.frm.submit();\n";
print "\t</script>\n";
print "\n</body>\n</html>";
redirectUrl = 'https://sbcheckout.payfort.com/FortAPI/paymentPage';
puts "<html xmlns='http://www.w3.org/1999/xhtml'>\n<head></head>\n<body>\n";
puts "<form action='redirectUrl' method='post' name='frm'>\n";
requestParams.each {|key, value|
puts "\t<input type='hidden' name='"+ CGI.escapeHTML(key)+"' value='"+ CGI.escapeHTML(value)+"'>\n";
}
puts "</form>\n";
puts "\t<script type='text/javascript'>\n";
puts "\t\tdocument.frm.submit();\n";
puts "\t</script>\n";
puts "</body>\n</html>";
Go to Full API
Check out our full API by visiting this link
Need further help?
Thanks for using PayFort.com. If you need any help or support, then message our support team at support@payfort.com.