Screen Shot 2013-09-21 at 9.48.03 PMI have a client who wanted to pass his Gravity Forms information to his First Data Hosted Payment page.

He had already set up the form on his site and the payment page in his First Data account, he just needed me to make the Gravity Form work with that payment page.

I set his Gravity Forms confirmation to look like this screen shot. To make sure I got the query string variables correct, I used the Gravity Forms ‘Insert Merge Tag’ dropdown.


Then I added a WordPress page with the slug first-data-payment which has the following code:

//
<strong>Please wait while we redirect you to our payment page.</strong>

<form id="payment" action="https://demo.globalgatewaye4.firstdata.com/payment" method="post">
  <input type="hidden" name="x_login" value="your_login_id" /> 
  <input type="hidden" name="x_amount" value="<?php echo str_replace('$', '', $_GET['amount']) ?>" /> 
  <input type="hidden" name="x_fp_sequence" value="<?php echo $sequence = rand(1,9999) ?>" /> 
  <input type="hidden" name="x_fp_timestamp" value="<?php echo $timestr = time() ?>" /> 
  <input type="hidden" name="x_fp_hash" value="<?php echo hash_hmac('md5','your_login_id^'.$sequence.'^'.$timestr.'^'.
str_replace('$','',$_GET['amount']).'^','your_transaction_key') ?>" /> 
  <input type="hidden" name="x_show_form" value="PAYMENT_FORM" /> 
  <input type="hidden" name="x_first_name" value="<?php echo $_GET['first'] ?>" /> 
  <input type="hidden" name="x_last_name" value="<?php echo $_GET['last'] ?>" />  
  <input type="hidden" name="x_address" value="<?php echo $_GET['add'].', '.$_GET['add2'] ?>" /> 
  <input type="hidden" name="x_city" value="<?php echo $_GET['city'] ?>" /> 
  <input type="hidden" name="x_state" value="<?php echo $_GET['state'] ?>" /> 
  <input type="hidden" name="x_zip" value="<?php echo $_GET['zip'] ?>" />
</form>
<script type="text/javascript">
    document.getElementById('payment').submit();
</script>
//

You will need to find your login ID and your Transaction Key in your First Data account and replace those in the code. The variables that you want to use will probably change as well. But, hopefully, this will get you started in the right direction.

Note: that I use [php] instead of <?php in my WordPress pages to take advantage of the PHP Code plugin which lets me use php code in my WordPress pages.

1 thought on “WordPress, Gravity Forms and First Data Hosted Payment Pages”

  1. This freaking rocks! A client of mine has multiple website and different integration methods. I struggled with an integration with Photocrati last year for a month probably and the he asked me to add processing to another site that I actually use Gravity Forms on. I seriously cannot believe it is this simple (logically, I believe the problem is Photocrati’s horrible lack of extensibility that caused the problem and not so much the Payment Page. In any event, I appreciate you posting this. I will need to add line items, but this is tons of work I don’t have to do so I appreciate that.

Leave a Comment

Your email address will not be published. Required fields are marked *