Jump to content

Offline payment gateway module


Eduardo G.

Recommended Posts

Hi all, I've been reading doc name "WHMCS Gateway Module Documentation", but it's designed to connect to an external API.

In my case, I want to process payments offline, so user selects that payment and I make the rest with my bank.

How do I make an offline gateway module? Any sample?

 

Thanks in advance. Cheers

Link to comment
Share on other sites

You can just activate the Bank Transfer gateway in Setup > Payment Gateways. You can fill in your payment details and manually add the transaction to the order.

Thanks, m00, but I already have Bank Transfer gateway enabled, but that's a different payment.

With a bank transfer, client needs my bank account and makes a transfer to me

With a bank payment request, I need my client's bank account to automatically receive the payment.

 

Anyway, my question is more technical: i need to build a gateay module which doesn't make use of an external API, but must be a fully functional module so that orders can be checked out and processed correctly.

 

Any clues?

Link to comment
Share on other sites

Sorry, didn't get the question right then. ;-)

 

What you could try is creating a module which posts to another page, and let that page just save the bank account number (or other information) in the description, or just let it mail the information to you. Just a little sample:

 

/modules/gateways/bankoffline.php

<?php
if(isset($_POST['account']) AND is_numeric($_POST['account']) AND isset($_POST['invoice']) AND isset($_POST['client']))
{
require("../../dbconnect.php");

// Check the logged in user with the posted user
if($_SESSION['uid'] == $_POST['client'])
{
	// Check if the invoice is from the user
	$result = mysql_query("SELECT id FROM tblinvoices WHERE userid='".$_POST['client']."' AND id = '".$_POST['invoice']."';");

	if(mysql_numrows($result) == 1)
	{
		/*
			Put in a script like updating the invoice description with the details, or just a PHP-mail script.
		*/
		echo "<script type=\"text/javascript\">
		<!--
		alert('Bank account number saved (or something)...');
		window.location = \"../../clientarea.php\"
		//-->
		</script>";
	}
}
die();
}

function bankoffline_config()
{
   $configarray = array(
    "FriendlyName" => array("Type" => "System", "Value"=>"Bank (offline)"),
   );
return $configarray;
}

function bankoffline_link($params) 
{
$code = '<form method="post"" action="/modules/gateways/bankoffline.php">
	<input type="input" name="account" value="Fill in your bank account" onclick="this.value=\'\'" />
	<input type="hidden" name="invoice" value="'.$params['invoiceid'].'" />
	<input type="hidden" name="client" value="'.$params['clientdetails']['id'].'" />
	<input type="submit" value="Request payment" />
</form>';

return $code;
}
?>

 

(Not the most beautiful script, but it gives you a little impression)

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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