Gente,
Les dejo el módulo de lopago.com para WHMCS para que puedan incorporarlo a su servicio de hosting dándole la posibilidad a sus clientes de pagar con diferentes medios de pago.
Quiero agradecer a HV Grafica por el testing y a OportHost.com por haber facilitado un código de ejemplo. :D
<?php
/**
* User: lopago.com
* Date: 10/02/12
* Time: 17:42
* Credits: Lopago.com & HV Grafica
* Based on: OportHost.com code
* Notes: Copiar este archivo en WHMCS_DOCUMENT_ROOT/modules/gateways/
*/
$GATEWAYMODULE["lopagocomname"] = "lopagocom";
$GATEWAYMODULE["lopagocomvisiblename"] = "Lopago.com";
$GATEWAYMODULE["lopagocomtype"] = "Invoices";
function lopagocom_activate()
{
defineGatewayField("lopagocom", "text", "account_id", "", "Tu cuenta de lopago.com", "", "Ej.: <strong>[email protected]</strong>");
defineGatewayField("lopagocom", "text", "item_currency", "", "Moneda", "1", "Pesos=ARS Dolares=USD");
defineGatewayField("lopagocom", "text", "success_url", "", "URL Exito", "", "Ej. http://www.dominio.com/exito.html");
defineGatewayField("lopagocom", "text", "error_url", " ", "URL Fracaso", "", "Ej. http://www.dominio.com/fracaso.html");
defineGatewayField("lopagocom", "yesno", "testmode", "", "Test Mode", "", "");
}
function lopagocom_link($params)
{
# Gateway Specific Variables
$gatewayaccount = $params['account_id'];
$gatewaycurrency = $params['item_currency'];
$gatewaysuccessurl = $params['success_url'];
$gatewayerrorurl = $params['error_url'];
$gatewaytestmode = $params['testmode'];
# Invoice Variables
$invoiceid = $params['invoiceid'];
$description = $params["description"];
$amount = $params['amount'];
$duedate = $params['duedate'];
# 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']['phone'];
# System Variables
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];
# End of Variables
$code = '
<form action="https://lopago.com/api" method="post">
<!-- Tu cuenta de lopago.com donde recibirás el dinero -->
<input type="hidden" name="account_id" value="' . $gatewayaccount . '" />
<!-- Producto que quieres cobrar -->
<input type="hidden" name="item_code" value="' . $invoiceid .'" />
<input type="hidden" name="item_name" value="Pago por FACTURA Nro. ' . $invoiceid . '" />
<input type="hidden" name="item_price" value="' . $amount .'" />
<input type="hidden" name="item_currency" value="' . $gatewaycurrency . '" />
<input type="hidden" name="success_url" value="http://' . $gatewaysuccessurl . '>
<input type="hidden" name="error_url" value="http://' . $gatewayerrorurl . '">
<input type="hidden" name="email" value="' . $email . '">
<!-- Botón de compra. También puede ser un <button> o <input type="submit"> -->
<input type="image" src="https://lopago.com/botones/comprar_ahora.gif" border="0" alt="Comprar Ahora">
</form>';
return $code;
}
?>
Espero que les sirva y cualquier modificación y mejora que le puedan hacer al código bienvenida sea.
Les dejamos un saludo!
lopago.com