Jump to content

Paymeant gateway for OneBIT ~ say paid


Xify Hosting

Recommended Posts

<?php

function template_config() {
   $configarray = array(
    "FriendlyName" => array("Type" => "System", "Value"=>"OneBIT"),
    "username" => array("FriendlyName" => "Login ID", "Type" => "text", "Size" => "20", ),
    "transmethod" => array("FriendlyName" => "Transaction Method", "Type" => "dropdown", "Options" => "Option1,Value2,Method3", ),
    "instructions" => array("FriendlyName" => "Payment Instructions", "Type" => "textarea", "Rows" => "5", "Description" => "Do this then do that etc...", ),
    "testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to test", ),
   );
return $configarray;
}

function template_link($params) {

# Gateway Specific Variables
$gatewayusername = $params['username'];
$gatewaytestmode = $params['testmode'];

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

# Client Variables
$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'];

# System Variables
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];
$pay = str_replace(".", "", "$amount");
$txidm = md5($invoiceid);

# Enter your code submit to the gateway...

$code = '<form action="https://www.onebip.com/otms/" method="post" target="onebip">
<input type="hidden" name="command" value="standard_pay" />
<input type="hidden" name="username" value="nukezilla@hotmail.co.uk" />
<input type="hidden" name="description" value="'.$description.'" />
<input type="hidden" name="item_code" value="'.$invoiceid.'" />
<input type="hidden" name="price" value="'.$pay.'" />
<input type="hidden" name="currency" value="'.$currency.'" />


<input type="hidden" name="country" value="GB" />
<input type="hidden" name="lang" value="en" />
<input type="hidden" name="return_url"
value="http://lunohost.com/order/viewinvoice.php?id='.$invoiceid.'" />
<input type="hidden" name="notify_url"
value="http://lunohost.com/order/modules/gateways/callback/callback.php" />
<input type="hidden" name="remote_txid" value="'.$txidm.'"  />
<input type="hidden" name="custom[your_variable1]" value="yourvalue1" />
<input type="hidden" name="custom[your_variable2]" value="yourvalue2" />
<input type="hidden" name="custom[foo]" value="bar" />
<input type="hidden" name="customer_email" value="'.$email.'" />
<input type="hidden" name="customer_firstname" value="'.$firstname.'"  />
<input type="hidden" name="customer_lastname" value="'.$lastname.'" />
<input type="hidden" name="customer_cell" value="'.$phone.'"/>
<input type="hidden" name="customer_country" value="'.$country.'"/>
<input type="hidden" name="logo_url" value="http://lunohost.com/image/logo.png" />
<input type="hidden" name="debug" value="true" />
<input type="image" name="submit"
src="http://www.onebip.com/tools/bts/btn04.gif" alt="Pay with Onebip" border="0"
/>
</form>';

return $code;
}

function template_capture($params) {

   # Gateway Specific Variables
$gatewayusername = $params['username'];
$gatewaytestmode = $params['testmode'];

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

   # Client Variables
$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'];

# Card Details
$cardtype = $params['cardtype'];
$cardnumber = $params['cardnum'];
$cardexpiry = $params['cardexp']; # Format: MMYY
$cardstart = $params['cardstart']; # Format: MMYY
$cardissuenum = $params['cardissuenum'];

# Perform Transaction Here & Generate $results Array, eg:
$results = array();
$results["status"] = "success";
   $results["transid"] = "12345";

# Return Results
if ($results["status"]=="success") {
	return array("status"=>"success","transid"=>$results["transid"],"rawdata"=>$results);
} elseif ($gatewayresult=="declined") {
       return array("status"=>"declined","rawdata"=>$results);
   } else {
	return array("status"=>"error","rawdata"=>$results);
}

}

function template_refund($params) {

   # Gateway Specific Variables
$gatewayusername = $params['username'];
$gatewaytestmode = $params['testmode'];

   # Invoice Variables
$transid = $params['transid']; # Transaction ID of Original Payment
$amount = $params['amount']; # Format: ##.##
   $currency = $params['currency']; # Currency Code

   # Client Variables
$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'];

# Perform Refund Here & Generate $results Array, eg:
$results = array();
$results["status"] = "success";
   $results["transid"] = "12345";

# Return Results
if ($results["status"]=="success") {
	return array("status"=>"success","transid"=>$results["transid"],"rawdata"=>$results);
} elseif ($gatewayresult=="declined") {
       return array("status"=>"declined","rawdata"=>$results);
   } else {
	return array("status"=>"error","rawdata"=>$results);
}

}

?>

 

here the code i'm using so far. I just cant make it say PAID on the invoice :S.. any idea. Hopefully i can then release this for free or one of payment of $5 once all completed

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