Difference between revisions of "Page Templates:Creating a Payment Template"
From Whirlwind eCommerce Wiki
(One intermediate revision by the same user not shown) | |||
Line 19: | Line 19: | ||
$payArr = $orderCompleteArray['payments'][0]; | $payArr = $orderCompleteArray['payments'][0]; | ||
− | // lets get the pay types for the select | + | // lets get the pay types, expiration date options for the select fields |
− | $ | + | $payTypeOptionString = eV::orderPayTypeOptions($payArr['payType']); |
− | $ | + | $expDateOptionString = eV::orderExpDateOptions($payArr['expDate']); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
// output message if passed | // output message if passed | ||
Line 56: | Line 34: | ||
echo "<br>Select Card Type: "; | echo "<br>Select Card Type: "; | ||
// output pay types | // output pay types | ||
− | // use the string generated at the begging of the script when calling the | + | // use the string generated at the begging of the script when calling the orderPayTypeOptions request |
echo "<select name=\"payType\">$payTypeOptionString</select>"; | echo "<select name=\"payType\">$payTypeOptionString</select>"; | ||
Line 66: | Line 44: | ||
− | echo "<br>Card Number: " | + | echo "<br>Card Number: "; |
// note the value here is empty - we dont want to pass the card number back to the browser | // note the value here is empty - we dont want to pass the card number back to the browser | ||
echo "<input name=\"accountNumber\" size=18 maxlength=16 value=\"\" class=\"form-field\" type=\"text\" />"; | echo "<input name=\"accountNumber\" size=18 maxlength=16 value=\"\" class=\"form-field\" type=\"text\" />"; | ||
Line 72: | Line 50: | ||
echo "<br>Expiration Date: "; | echo "<br>Expiration Date: "; | ||
// output expiration date options | // output expiration date options | ||
− | // use the string generated at the begginging of the script when calling the | + | // use the string generated at the begginging of the script when calling the orderExpDateOptions request |
echo "<select name=\"expDate\">$expDateOptionString</select>"; | echo "<select name=\"expDate\">$expDateOptionString</select>"; | ||
Line 90: | Line 68: | ||
<input type=\"hidden\" name=\"redirectFailure\" value=\"index.php?fa=ORDER.checkoutPayment\"> | <input type=\"hidden\" name=\"redirectFailure\" value=\"index.php?fa=ORDER.checkoutPayment\"> | ||
<input type=\"hidden\" name=\"paymentId\" value=\"" . $payArr['paymentId']. "\"> | <input type=\"hidden\" name=\"paymentId\" value=\"" . $payArr['paymentId']. "\"> | ||
− | <input type=\"hidden\" name=\"sale_addressId\" value=\"" . $payArr['sale_addressId']. "\">" | + | <input type=\"hidden\" name=\"sale_addressId\" value=\"" . $payArr['sale_addressId']. "\">"; |
// form post button | // form post button |
Latest revision as of 12:54, 23 October 2008
|
The payment template is a form for the user to enter their payment information
After creating the template, setup a page for it. Place the pageId of this new page in Settings > eCommerce tab: "Payment Page Id"
Sample content is below:
// get order data, including payment info $orderCompleteArray = eV::orderGetCompleteArray(); // shortcut order info $orderArr = $orderCompleteArray['order']; // short cut payment info // system made to support multiple payments // but at this time we can only process one payment per order $payArr = $orderCompleteArray['payments'][0]; // lets get the pay types, expiration date options for the select fields $payTypeOptionString = eV::orderPayTypeOptions($payArr['payType']); $expDateOptionString = eV::orderExpDateOptions($payArr['expDate']); // output message if passed // this is typically used to inform the visitor of invalid payment information submitted or declined credit card if(!empty($message)) echo "<font color=\"red\">$message</font>"; // start form // note use of securedsiteurl to ensure SSL connection submitted echo "<form action=\"" . $iProducts['securedSiteUrl']. "/index.php\" method=\"post\" name=\"checkoutPaymentForm\">"; echo "<br>Select Card Type: "; // output pay types // use the string generated at the begging of the script when calling the orderPayTypeOptions request echo "<select name=\"payType\">$payTypeOptionString</select>"; echo "<br>First Name: "; echo "<input name=\"firstName\" value=\"" . $payArr['firstName'] . "\" type=\"text\" />"; echo "<br>Last Name: "; echo "<input name=\"lastName\" value=\"" . $payArr['lastName'] . "\" type=\"text\" />"; echo "<br>Card Number: "; // note the value here is empty - we dont want to pass the card number back to the browser echo "<input name=\"accountNumber\" size=18 maxlength=16 value=\"\" class=\"form-field\" type=\"text\" />"; echo "<br>Expiration Date: "; // output expiration date options // use the string generated at the begginging of the script when calling the orderExpDateOptions request echo "<select name=\"expDate\">$expDateOptionString</select>"; echo "<br>Card Security Code: "; // like the card number, we dont want t pass this back to the browser echo "<input name=\"cvv\" type=\"text\" value=\"\" size=\"5\" />"; // required hidden fields tell the system where to go and what to do when submitted // redirect failure and success tell the system where to go after the payment info is submitted // paymentId is passed to tell the system which payment to post this submission to // the payment supports the payType, accountNumber, cvv and expDate fields // sale_addressId is passed to tell the system which address to post this submission to // the address supports the firstName, lastName fields in addition to street1, street2, city, state, zipCode, country, phone1, phone2, fax echo "<input type=\"hidden\" name=\"fa\" value=\"ORDER.paymentPost\"> <input type=\"hidden\" name=\"redirectSuccess\" value=\"index.php?fa=ORDER.checkoutConfirmation\"> <input type=\"hidden\" name=\"redirectFailure\" value=\"index.php?fa=ORDER.checkoutPayment\"> <input type=\"hidden\" name=\"paymentId\" value=\"" . $payArr['paymentId']. "\"> <input type=\"hidden\" name=\"sale_addressId\" value=\"" . $payArr['sale_addressId']. "\">"; // form post button echo "<input type=\"submit\" value=\"Post Payment\">"; // close out the form echo "</form>";