+ Start a Discussion
Vamshi KrishnaVamshi Krishna 

Conversion of PHP code into APEX


I have and PHP code for integrating with Pay Pal Payflow. Anyone who can give me its APEX alternative or convert the code into apex. Iwill be thankful.


<?php
session_start();
global $environment;
$environment = "sandbox";

require_once('PayflowNVPAPI.php');

echo '<p>Payflow direct credit card processing - basic demo</p>';
if(empty($_POST)) {

?>
<form method="post">
  Manager:
  <br/>Partner: <input type="text" name="PARTNER" value="PayPal"/>
  <br/>Vendor: <input type="text" name="VENDOR" value="goofy2000us"/>
  <br/>User: <input type="text" name="USER" value="PayFlowPro"/>
  <br/>Password: <input type="text" name="PWD" value="test1234"/>
  <br/>
  <br/>Amount:<input type="text" name="AMT" value="1.23"/>
  <br/>Credit card:<input type="text" name="CREDITCARD" value="5105105105105100"/>
  <br/>Expiration date: <input type="text" name="EXPDATE" value="1220"/>
  <br/>Card security code: <input type="text" name="CVV2" value="123"/>
  <br/>CURRENCY: <input type="text" name="CURRENCY" value="USD"/>
  <br/>First name: <input type="text" name="BILLTOFIRSTNAME" value="John"/>
  <br/>Last name: <input type="text" name="BILLTOLASTNAME" value="Doe"/>
  <br/>Address: <input type="text" name="BILLTOSTREET" value="123 Main St."/>
  <br/>City: <input type="text" name="BILLTOCITY" value="San Jose"/>
  <br/>State: <input type="text" name="BILLTOSTATE" value="CA"/>
  <br/>Zip: <input type="text" name="BILLTOZIP" value="95101"/>
  <br/>Country: <input type="text" name="BILLTOCOUNTRY" value="US"/>
  <br/>Silent Tran: <input type="text" name="SILENTTRAN" value="TRUE"/>
  <br/>Secure ID: <input type="text" name="createsecuretoken" value="Y"/>
  <br/><input type="submit" value="Pay Now"/>
</form>
<?php

} else {
  $request = array(
    "PARTNER" => $_POST['PARTNER'],
    "VENDOR" => $_POST['VENDOR'],
    "USER" => $_POST['USER'],
    "PWD" => $_POST['PWD'], 
    "TENDER" => "C",
    "TRXTYPE" => "A",
    "CURRENCY" => $_POST['CURRENCY'],
    "AMT" => $_POST['AMT'],

    "ACCT" => $_POST['CREDITCARD'],
    "EXPDATE" => $_POST['EXPDATE'],
    "CVV2" => $_POST['CVV2'],

    "BILLTOFIRSTNAME" => $_POST['BILLTOFIRSTNAME'],
    "BILLTOLASTNAME" => $_POST['BILLTOLASTNAME'],
    "BILLTOSTREET" => $_POST['BILLTOSTREET'],
    "BILLTOCITY" => $_POST['BILLTOCITY'],
    "BILLTOSTATE" => $_POST['BILLTOSTATE'],
    "BILLTOZIP" => $_POST['BILLTOZIP'],
    "BILLTOCOUNTRY" => $_POST['BILLTOCOUNTRY'],

  );

  //Run request and get the response
  $response = run_payflow_call($request);

  pre($request, "Request");
  pre($response, "Response");
}