Quantcast
Channel: WHMCS Community Forums
Viewing all articles
Browse latest Browse all 13458

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

$
0
0
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:

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.

Viewing all articles
Browse latest Browse all 13458

Trending Articles