Code Monkey home page Code Monkey logo

monerowhmcs's Introduction

MoneroWHMCS

A WHMCS Payment Gateway for accepting Monero

Dependencies

This plugin is rather simple but there are a few things that need to be set up beforehand.

  • A web server! Ideally with the most recent versions of PHP and mysql

  • The Monero wallet-cli and Monero wallet-rpc tools found here

  • WHMCS This Monero plugin is a payment gateway for WHMCS

Step 1: Activating the plugin

  • Downloading: First of all, you will need to download the plugin. If you wish, you can also download the latest source code from GitHub. This can be done with the command git clone https://github.com/monero-integrations/monerowhmcs.git or can be downloaded as a zip file from the GitHub web page.

  • Put the plugin in the correct directory: You will need to copy monero.php and the folder named monero from this repo/unzipped release into the WHMCS Payment Gateways directory. This can be found at whmcspath/modules/gateways/

  • Activate the plugin from the WHMCS admin panel: Once you login to the admin panel in WHMCS, click on "Setup -> Payments -> Payment Gateways". Click on "All Payment Gateways". Then click on the "Monero" gateway to activate it.

  • Enter a Module Secret Key. This can be any random text and is used to verify payments.

  • Enter the values for Wallet RPC Host, Wallet RPC Port, Username, and Password (these are from monero-wallet-rpc below). Optionally enter a percentage discount for all invoices paid via Monero.

  • Optionally install the addon module to disable WHMCS fraud checking when using Monero. You will need to copy the folder addons/moneroenable/ from this repo/unzipped release into the WHMCS Addons directory. This can be found at whmcspath/addons/.

  • Activate the Monero Enabler addon from the WHMCS admin panel: Click on "Setup -> Addon Modules". Find "Monero Enabler" and click on "Activate". Click "Configure" and choose the Monero Payment Gateway in the drop down list. Check the box for "Enable checking for payment method by module" and click "Save Changes".

Step 2: Get a Monero daemon to connect to

Option 1: Running a full node yourself

To do this: start the Monero daemon on your server and leave it running in the background. This can be accomplished by running ./monerod inside your Monero downloads folder. The first time that you start your node, the Monero daemon will download and sync the entire Monero blockchain. This can take several hours and is best done on a machine with at least 4GB of ram, an SSD hard drive (with at least 15GB of free space), and a high speed internet connection.

Option 2: Connecting to a remote node

The easiest way to find a remote node to connect to is to visit moneroworld.com and use one of the nodes offered. It is probably easiest to use node.moneroworld.com:18089 which will automatically connect you to a random node.

Step 3: Setup your Monero wallet-rpc

  • Setup a Monero wallet using the monero-wallet-cli tool. If you do not know how to do this you can learn about it at getmonero.org

  • Start the Wallet RPC and leave it running in the background. This can be accomplished by running ./monero-wallet-rpc --rpc-bind-port 18082 --rpc-login username:password --log-level 2 --wallet-file /path/walletfile where "username:password" is the username and password that you want to use, separated by a colon and "/path/walletfile" is your actual wallet file. If you wish to use a remote node you can add the --daemon-address flag followed by the address of the node. --daemon-address node.moneroworld.com:18089 for example.

Info on server authentication

It is recommended that you specify a username/password with your wallet rpc. This can be done by starting your wallet rpc with monero-wallet-rpc --rpc-bind-port 18082 --rpc-login username:password --wallet-file /path/walletfile where "username:password" is the username and password that you want to use, separated by a colon. Alternatively, you can use the --restricted-rpc flag with the wallet rpc like so ./monero-wallet-rpc --testnet --rpc-bind-port 18082 --restricted-rpc --wallet-file wallet/path.

Donating Me

XMR Address : 44krVcL6TPkANjpFwS2GWvg1kJhTrN7y9heVeQiDJ3rP8iGbCd5GeA4f3c2NKYHC1R4mCgnW7dsUUUae2m9GiNBGT4T8s2X

monerowhmcs's People

Contributors

enricodias avatar meramsey avatar quickbasic avatar rex4539 avatar serhack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

monerowhmcs's Issues

Links broken when WHMCS in sub directory

I run WHMCS in a /billing sub directory. This breaks a few links within the code. Simply adding a "system url path" variable before the links resolves it.

Also, there is an additional "/" in the link to createinvoice.php , simply removing it cleans up the url display (it still works without this fix obv).

Other than that I just tested this code as working on the latest WHMCS.

Two questions, is there a timeout on the invoice display at all? ...and how does this set up handle multiple people trying to pay at once? Is there no conflicts when 4-5 people try to pay an invoice at once for example?

Anyway, thanks a lot for writing this code!

Feature idea: Auto Sweep to external XMR Address

It looks like there is a setting for saving an XMR address here: https://github.com/monero-integrations/monerowhmcs/blob/master/modules/gateways/monero.php#L20

Curious if the intention of this was for future use to have something auto withdraw from merchant wallet to external wallet(cold/offline)?

I also see what looks to be a transfer function which has not been used as of yet but seems like it could be used?
https://github.com/monero-integrations/monerowhmcs/blob/master/modules/gateways/monero/library.php#L325-L333

If so it seems like we should be able to just do a sweep_all periodically if that address is defined
https://www.getmonero.org/resources/developer-guides/wallet-rpc.html#sweep_all

via

  • an optional cron hook
  • upon Invoice paid it sweeps( obviously it would only get previously confirmed unlocked stuff) but would be set and forget without users needing to setup a custom cron.
  • aftercronjob hook: https://developers.whmcs.com/hooks-reference/cron/#aftercronjob would just work like magic every 5 mins i think which is the default recommend cron action.

Figured I'd ask before maybe giving it a stab

Problem installation on whmcs 8.7.3 rel1

Hello
I have WHMCS version 8.7.3
During installation of the module, immediately after searching and clicking on the Activation button, it takes you to a page with all Payment Gateways installed, but Monero is not in the list (((((
I really want to use your modul, but it seems that it needs some very small modifications for the latest version of WHMCS.
Please fix it. And I’m ready to donate a little :)

Request have return error

Hello,

I just want to test this module but looks like is not working for me.. I have configured with multiple remote hosts from this page : https://moneroworld.com/#nodes and non of these are working for me, I did a telnet and works..

RuntimeException: Request have return error: Method not found;
Request: {"jsonrpc":"2.0","method":"make_integrated_address","params":{"payment_id":"4bb9494c6124abd9"},"id":1}; Check the daemon hostname and daemon port settings in the Monero Pyament Gateway WHMCS config. in /home/lifetimehosting/public_html/my/modules/gateways/monero/library.php:169
Stack trace:
#0 /home/lifetimehosting/public_html/my/modules/gateways/monero/library.php(120): Monero_rpc->validate(true, 'Request have re...')
#1 /home/lifetimehosting/public_html/my/modules/gateways/monero/library.php(231): Monero_rpc->request('make_integrated...', Array)
#2 /home/lifetimehosting/public_html/my/modules/gateways/monero/library.php(292): Monero_rpc->_run('make_integrated...', Array)
#3 /home/lifetimehosting/public_html/my/modules/gateways/monero/createinvoice.php(39): Monero_rpc->make_integrated_address('4bb9494c6124abd...')
#4 {main}

Thanks

RuntimeException: Syntax error: in [...]modules/gateways/monero/library.php:169

Oops!
Something went wrong and we couldn't process your request.
Please go back to the previous page and try again.

If the problem persists, please contact us.

« Back to Homepage

For additional assistance, please reference the WHMCS TroubleShooting Guide »

RuntimeException: Syntax error: in 
[...]/modules/gateways/monero/library.php:169
Stack trace:
#0 [...]/modules/gateways/monero/library.php(105): Monero_rpc->validate(true, 'Syntax error: ')
#1 [...]/modules/gateways/monero/library.php(231): Monero_rpc->request('make_integrated...', Array)
#2 [...]/modules/gateways/monero/library.php(292): Monero_rpc->_run('make_integrated...', Array)
#3 [...]/modules/gateways/monero/createinvoice.php(39): Monero_rpc->make_integrated_address('XXXXXXXXXXXXXXXXXXXX...')
#4 {main}

In the monero rpc i have the following log:

2019-01-06 11:50:53.342 [RPC0]  DEBUG   wallet.rpc      src/wallet/wallet_rpc_server.h:66       HTTP [y.y.y.y] POST /x.x.x.x:80/json_rpc
2019-01-06 11:50:53.342 [RPC0]  TRACE   net.http        contrib/epee/include/net/http_protocol_handler.inl:589  HTTP_RESPONSE_HEAD: << 
HTTP/1.1 404 Not found
Server: Epee-based
Content-Length: 0
Content-Type: text/plain
Last-Modified: Sun, 06 Jan 2019 11:50:53 GMT
Accept-Ranges: bytes

The css and js and the media aren't relative to the whmcs path

They can be manually fixed by editing them out, but there probably is a better way to get the whmcs complete path. The current setup assumes whmcs is at the top level domain. The redirect from createinvoice.php as well: window.location.href = '/viewinvoice.php?id=$invoice_id';

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.