Last active
September 16, 2015 23:40
-
-
Save darwingr/658bb250e6881859e148 to your computer and use it in GitHub Desktop.
Initial testing with e-xact's public templates for processing payments for registrations on March 12, 2015
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<title> | |
Hosted Checkout: Sample PHP Payment Form | |
</title> | |
<style type="text/css"> | |
label { | |
display: block; | |
margin: 5px 0px; | |
color: #AAA; | |
} | |
input { | |
display: block; | |
} | |
input[type=submit] { | |
margin-top: 20px; | |
} | |
</style> | |
<h1> | |
Hosted Checkout: Sample PHP Payment Form | |
</h1> | |
<form action="https://rpm.demo.e-xact.com/payment" method="POST"> | |
<?php | |
$x_login = "X"; // Take from Payment Page ID in Payment Pages interface | |
$transaction_key = "X"; // Take from Payment Pages configuration interface | |
$x_amount = "3.50"; | |
$x_currency_code = "CAD"; // Needs to agree with the currency of the payment page | |
srand(time()); // initialize random generator for x_fp_sequence | |
$x_fp_sequence = rand(1000, 100000) + 123456; | |
$x_fp_timestamp = time(); // needs to be in UTC. Make sure webserver produces UTC | |
$x_ship_to_first_name = "Bruce"; | |
$x_ship_to_ship_to_last_name = "Wayne"; | |
$x_invoice_num = "11111"; | |
$x_po_num = "22222"; | |
$x_reference_3 = "33333"; | |
// The values that contribute to x_fp_hash | |
$hmac_data = $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount . "^" . $x_currency_code; | |
$x_fp_hash = hash_hmac('MD5', $hmac_data, $transaction_key); | |
echo ('<input name="x_login" value="' . $x_login . '" type="hidden" />' ); | |
echo ('<input name="x_invoice_num" value="' . $x_invoice_num . '" type="hidden" />'); | |
echo ('<input name="x_po_num" value="' . $x_po_num . '" type="hidden" />'); | |
echo ('<input name="x_reference_3" value="' . $x_reference_3 . '" type="hidden" />'); | |
echo ('<input name="x_amount" value="' . $x_amount . '" type="hidden" />' ); | |
echo ('<input name="x_fp_sequence" value="' . $x_fp_sequence . '" type="hidden" />' ); | |
echo ('<input name="x_fp_timestamp" value="' . $x_fp_timestamp . '" type="hidden" />' ); | |
echo ('<input name="x_fp_hash" value="' . $x_fp_hash . '" type="hidden" />' ); | |
echo ('<input name="x_currency_code" value="' . $x_currency_code . '" type="hidden" />'); | |
echo ('<input name="x_ship_to_first_name" value="' . $x_ship_to_first_name . '" type="hidden" />'); | |
echo ('<input name="x_ship_to_last_name" value="' . $x_ship_to_last_name . '" type="hidden" />'); | |
?> | |
<input name="x_show_form" value="PAYMENT_FORM" type="hidden" /> | |
<input name="x_test_request" value="TRUE" type="hidden" /> | |
<input value="Pay with Hosted Checkout" type="submit" /> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<title> | |
Hosted Checkout: Sample PHP Payment Form | |
</title> | |
<style type="text/css"> | |
label { | |
display: block; | |
margin: 5px 0px; | |
color: #AAA; | |
} | |
input { | |
display: block; | |
} | |
input[type=submit] { | |
margin-top: 20px; | |
} | |
</style> | |
<h1> | |
Hosted Checkout: Sample PHP Payment Form | |
</h1> | |
<form action="https://rpm.demo.e-xact.com/payment" method="POST"> | |
<input name="x_login" value="" type="hidden" /> | |
<input name="x_amount" value="*/totalowed/*" type="hidden" /> | |
<input name="x_fp_sequence" value="" type="hidden" /> | |
<input name="x_fp_timestamp" value="" type="hidden" /> | |
<input name="x_fp_hash" value="" size="50" type="hidden" /> | |
<input name="x_fp_currency" value="CAD" type="hidden" /> | |
<input name="x_show_form" value="PAYMENT_FORM" type="hidden" /> | |
<input name="x_test_request" value="TRUE" type="hidden" /> | |
<input value="Pay with Hosted Checkout" type="submit" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment