Jump to content

Unable to Post Client Variables in Third-Party Gateway Module. Bug or Documentation Typo?


avans

Recommended Posts

We've created a third-party gateway module which seems to be working well, except for 1 thing....

 

For some reason, WHMCS is not providing any of the “Client Variables” to the submit form. Other variables DO get passed successfully (such as invoice ID and amount).

 

According to the gateway module template and this page we seem to have the correct variables.

 

Here is the module code:

 

<?php

function hosted_config() {
   $configarray = array(
    "FriendlyName" => array("Type" => "System", "Value"=>"Hosted"),
    "accountId" => array("FriendlyName" => "Account ID", "Type" => "text", "Size" => "20", ),
    "token" => array("FriendlyName" => "Payment Page Token", "Type" => "text", "Size" => "20", ),        
    "testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to run test transactions only", ),
   );
return $configarray;
}

function helcimhosted_link($params) {

# Gateway Specific Variables
$gatewayaccountid = $params['accountId'];
$gatewaytoken = $params['token'];
$gatewaytestmode = $params['testmode'] == 'Yes' ? 1 : 0;

# Invoice Variables
$invoiceid = $params['invoiceid'];
$description = $params["description"];
   $amount = $params['amount']; # Format: ##.##
   $currency = $params['currency']; # Currency Code

# Client Variables
$clientid = $params['clientdetails']['id'];
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phonenumber'];



# Enter your code submit to the gateway...

$code = '<form action="https://gateway.HOSTED.com/hosted/" method="post">
<input type="hidden" name="merchantId" value="'.$gatewayaccountid.'" />
<input type="hidden" name="token" value="'.$gatewaytoken.'" />
<input type="hidden" name="testmode" value="'.$gatewaytestmode.'" />
<input type="hidden" name="customerId" value="'.$clientid.'" />
<input type="hidden" name="orderId" value="'.$invoiceid.'" />
<input type="hidden" name="amount" value="'.$amount.'" />
<input type="hidden" name="billingName" value="'.$firstname.' '.$lastname.'" />
<input type="hidden" name="billingAddress" value="'.$address1.' '.$address2.'" />
<input type="hidden" name="billingCity" value="'.$city.'" />
<input type="hidden" name="billingProvince" value="'.$state.'" />
<input type="hidden" name="billingPostalCode" value="'.$postcode.'" />
<input type="hidden" name="billingCountry" value="'.$country.'" />
<input type="hidden" name="billingPhoneNumber" value="'.$phone.'" />
<input type="hidden" name="billingEmailAddress" value="'.$email.'" />
<input type="submit" value="Pay Now" />
</form>';

return $code;
}
?>

 

What am I doing wrong?? Or is it a typo in the documentation?? Any help is appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated