First Data Payeezy Gateway Payment Pages - Quick Development Guide

This guide is intended for use by developers who are not using existing shopping cart software, and are looking for the quickest and easiest way to code a custom solution for use with First Data Payeezy Gateway Payment Pages. This document will not cover the creation of a shopping cart or "Buy Now" button, just the payment process itself.

The Payment Form

The first thing you'll need to set up is the payment form on the site. The example HTML form code below only contains the essential fields required for a valid transaction; additional fields are available for use and can be referenced here. Note that if you'd like to use Relay Response, additional fields are required. Otherwise the Return Link Method defined in the Receipt Page settings area of the Payeezy Gateway Payment Pages interface will be used.

<form method="post" action="https://checkout.globalgatewaye4.firstdata.com">
<input type="hidden" name="x_login" value="WSPTEST001" /> <!-- Payment Page ID located in the Payeezy Gateway Payment Pages administration interface -->
<input type="hidden" name="x_fp_sequence" value="1337" /> <!-- Random number used in the x_fp_hash calculation -->
<input type="hidden" name="x_fp_timestamp" value="1287098097" /> <!-- Current UTC timestamp -->
<input type="hidden" name="x_currency_code" value="USD" />
<!-- 
    The x_currency_code field isn’t actually required, but is here for clarity.
    By default, the currency defined in the Payeezy Gateway Payment Page administration interface will be used.
    If you are specifying a currency code, it must also be used in the x_fp_hash calculation (see the PHP example below).
-->
<input type="hidden" name="x_amount" value="19.95" /> <!-- Order amount -->
<input type="hidden" name="x_fp_hash" value="0688a6886e25775ddf6b2947b578f793" /> <!-- Calculated hash value -->
<input type="hidden" name="x_show_form" value="PAYMENT_FORM" /> 
<input type="submit" name="checkout" value="Checkout Now" />
</form>


So, if you were setting up the above form in PHP, your script might look something like this:

<form method="post" action="https://checkout.globalgatewaye4.firstdata.com">
<input type="hidden" name="x_login" value="<?php echo $pageid = 'WSPTEST001'; ?>" />
<input type="hidden" name="x_fp_sequence" value="<?php echo $sequence = rand(1,9999); ?>" />
<input type="hidden" name="x_fp_timestamp" value="<?php echo $timestamp = time(); ?>" />
<input type="hidden" name="x_currency_code" value="<?php echo $currency = 'USD'; ?>" />
<input type="hidden" name="x_amount" value="<?php echo $amount = 19.95; ?>" />
<input type="hidden" name="x_fp_hash" value="<?php echo hash_hmac("md5", $pageid . "^" . $sequence . "^" . $timestamp . "^" . $amount . "^" . $currency, $key = 'KJsk~87HOljEpJFK0Njl0KT2'); ?>" />
<!-- 
    The $key variable is set to the Transaction Key, which can be
    located on the Security tab when viewing an individual Payeezy Gateway Payment Page
    in the Payeezy Gateway Payment Pages administration interface.
		
    NOTE: it's insecure and unnecessary to send the transaction key as its
    own form variable, so make sure this isn't included in your form markup.
-->
<input type="hidden" name="x_show_form" value="PAYMENT_FORM" />
<input type="submit" name="checkout" value="Checkout Now" />
</form>


At this point, you should be able to submit payments successfully. However, you won't be able to do anything with returned transaction data unless you write a handler for that.

The Handler

A very basic handler written in PHP might look like this:

<?php

 if     ($_REQUEST['x_response_code'] == '1') { echo 'Your payment was successful'; }
 elseif ($_REQUEST['x_response_code'] == '2') { echo 'Your payment was declined'; }
 elseif ($_REQUEST['x_response_code'] == '3') { echo 'Your payment encountered an error'; }

?>
	


This handler will perform different actions based on the response it receives from Payeezy Gateway: whether a transaction was successful, declined, or encountered an error during processing. You'll likely want to do more than just print text to the browser though - you can make use of the returned data to update your inventory database, empty the customer's shopping cart, send out notification emails, and so on. A list of the returned variables can be found here.

Powered by Zendesk