weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 osCommerce Bitcoin Payment Module March 03, 2012, 08:35:22 AM

Last edit: March 17, 2012, 02:53:12 AM by weex #1



https://github.com/weex/oscommerce-bitcoin



Part of the python script monitors bitcoind and restarts it if it doesn't answer.



Feel free to comment or make suggestions or ask questions or dismiss this entirely or code something better or hack another bitcoin service or ...



Update You can now see a working demo store using this module at This is a work in progress but the goal will be automated Bitcoin payment processing using just oscommerce, bitcoind running locally, and a bit of python. In regards to whether it's wise to store BTC locally, the python script will offload BTC to the shopkeeper's address of choice not long after it's confirmed.Part of the python script monitors bitcoind and restarts it if it doesn't answer.Feel free to comment or make suggestions or ask questions or dismiss this entirely or code something better or hack another bitcoin service or ...You can now see a working demo store using this module at http://owneo.com

weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 Re: osCommerce Bitcoin Payment Module March 04, 2012, 09:40:43 AM #2



This project now works with the following features and was tested against osCommerce v2.3.1



* Bitcoind and monitor.py can be run on a server other than the osCommerce hosting server

* Creates a unique payment address for each order

* Updates order to Delivered when payment is received (# of confirmations is configurable)

* Forwards Bitcoins to forwarding address once the local bitcoind has more than a threshold amount

* Python script monitors bitcoind and will restart it if it becomes unresponsive



Todo:



* Update readme and write an installation guide with tips on configuring osCommerce with the BTC currency

* Include BTCUSD exchange rate update in python script

* Include a watchdog script to make sure monitor.py is running via cronjob.



It's been fun testing with 0 confirmations and seeing the order status update all by itself.

An update on current status..and this is exciting! Did you know there are 12,700 live osCommerce webstores?This project now works with the following features and was tested against osCommerce v2.3.1* Bitcoind and monitor.py can be run on a server other than the osCommerce hosting server* Creates a unique payment address for each order* Updates order to Delivered when payment is received (# of confirmations is configurable)* Forwards Bitcoins to forwarding address once the local bitcoind has more than a threshold amount* Python script monitors bitcoind and will restart it if it becomes unresponsiveTodo:* Update readme and write an installation guide with tips on configuring osCommerce with the BTC currency* Include BTCUSD exchange rate update in python script* Include a watchdog script to make sure monitor.py is running via cronjob.It's been fun testing with 0 confirmations and seeing the order status update all by itself.

weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 Re: osCommerce Bitcoin Payment Module March 04, 2012, 08:47:59 PM #4 This is fixed. I tested it by uninstalling the module and reinstalling it.



When I removed it in the half-installed state you encountered, it appeared to have removed another payment module. If you know more about how osCommerce determines if a module is installed, you might want to edit the sql directly. I'm thinking it's just removing the MODULE_PAYMENT_BITCOIN_ records from the configuration table.



Thanks for testing, create an issue at github if you run into any other problems.



-weex

weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 Re: osCommerce Bitcoin Payment Module March 05, 2012, 12:10:21 AM #7 Quote from: Grix on March 04, 2012, 10:48:21 PM Thank you for fixing the bug.



I'd like to use this on my website, but I am inexperienced with bitcoin servers.. I host my website on a webserver, so I can't run bitcoind and the python script there, right? Can I run bitcoind and the python script on my home computer that I turn off every night, or does it have to be online 24/7? Do I have to forward any ports?



Alternatively, are there any free or very cheap VPS's that I can use for this purpose?



The python script and bitcoind will require shell access which is more likely to be available in a VPS or dedicated server. You should be able to get cheap VPS for $10-20 a month to try it out.



Starting out I would recommend bitcoind and the python script (monitor.py) be running 24x7 on the webserver. Running it only part time will not work and running it on your home computer will require a stable internet connection and the bitcoin RPC port to be opened on your firewall. Like I said, a cheap vps with everything running there is best.



Then you can set a FORWARDING_ADDRESS and the script can forward any funds to your home or company wallet.

The python script and bitcoind will require shell access which is more likely to be available in a VPS or dedicated server. You should be able to get cheap VPS for $10-20 a month to try it out.Starting out I would recommend bitcoind and the python script (monitor.py) be running 24x7 on the webserver. Running it only part time will not work and running it on your home computer will require a stable internet connection and the bitcoin RPC port to be opened on your firewall. Like I said, a cheap vps with everything running there is best.Then you can set a FORWARDING_ADDRESS and the script can forward any funds to your home or company wallet.

Daily Anarchist



Offline



Activity: 614

Merit: 500









Hero MemberActivity: 614Merit: 500 Re: osCommerce Bitcoin Payment Module March 05, 2012, 02:43:46 AM #8



http://addons.oscommerce.com/info/8170



One of my forum members wrote it specifically for me. My oscommerce store section uses it and it works great. It generates a new address for each purchase. There's already a pretty nice oscommerce Bitcoin payment module available here:One of my forum members wrote it specifically for me. My oscommerce store section uses it and it works great. It generates a new address for each purchase. Discover anarcho-capitalism today!

weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 Re: osCommerce Bitcoin Payment Module March 05, 2012, 03:16:01 AM #9 Quote from: Daily Anarchist on March 05, 2012, 02:43:46 AM



http://addons.oscommerce.com/info/8170



One of my forum members wrote it specifically for me. My oscommerce store section uses it and it works great. It generates a new address for each purchase.

There's already a pretty nice oscommerce Bitcoin payment module available here:One of my forum members wrote it specifically for me. My oscommerce store section uses it and it works great. It generates a new address for each purchase.

If it weren't for that module, I wouldn't have worked on this. It was a great starting point since the author appears to have known a lot more about oscommerce than I. If it weren't for that module, I wouldn't have worked on this. It was a great starting point since the author appears to have known a lot more about oscommerce than I.

weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 Re: osCommerce Bitcoin Payment Module March 05, 2012, 05:18:19 AM #11 The module I started with asked bitcoind for a new address and associated it with an account name given by the buyer's email address and the osCommerce session id with which the purchase was made. At that point it was up to the store owner to monitor those addresses and update the order status. Maybe you had something more that wasn't released as part of that module?



The additions I made automate this process. The python script monitor.py periodically looks at the osCommerce database to find orders with order status Pending and that used the Bitcoin Payment module. It then queries bitcoind to see if enough funds have been sent to the addresses associated with Pending orders. If enough were sent it takes the next step.



That step is to call another part of this module called the bpn.php script. This script was derived from a Paypal IPN script (IPN is where Paypal can tell osCommerce at some later time that payment has been made, cleared, etc). When called with the notification key and an order id, it will fire off an email to the buyer and set the order status to Delivered.



I'm actually not sure what is the best order status to change to but it's a simple change to make in the bpn.php script for anyone who wants to customize it.

Daily Anarchist



Offline



Activity: 614

Merit: 500









Hero MemberActivity: 614Merit: 500 Re: osCommerce Bitcoin Payment Module March 05, 2012, 05:40:27 AM #12 That sounds really badass. I'm looking forward to the update. Will it require the phoenix mod be installed underneath yours? Will yours include all of the phoenix mod? Will I have to delete the phoenix mod to get yours to work?



Right now when people order it puts them in pending status. It's a pain in the ass though because I have to log into my server every day and see if anybody has sent the coins, usually not. Most people order and then never send, I think it's because they ordered not knowing that I only accept Bitcoin as payment, and they're like "huh?"



When somebody does pay I put them in "processing" and send them a thank you email. After I've stuck the envelope in the mail I change it to delivered. Discover anarcho-capitalism today!

weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 Re: osCommerce Bitcoin Payment Module March 05, 2012, 07:21:52 AM #14



* Exchange rate updated periodically from mtgox with fallback to bitcoinexchangerate.org

* Payment recieved sets order status to Processing instead of Delivered



https://github.com/weex/oscommerce-bitcoin The module has been updated with the following:* Exchange rate updated periodically from mtgox with fallback to bitcoinexchangerate.org* Payment recieved sets order status to Processing instead of Delivered

weex



Offline



Activity: 1104

Merit: 1000









LegendaryActivity: 1104Merit: 1000 Re: osCommerce Bitcoin Payment Module March 05, 2012, 04:48:17 PM

Last edit: March 05, 2012, 05:03:29 PM by weex #16 Quote from: Grix on March 05, 2012, 03:49:43 PM When do you expect this to be finished/good enough for long term reliable use?

That's a good question and I suppose it's ready for someone running a test store or someone with php/python/mysql experience. I've been testing it as I go and it is based in part on some code that has seen long term use. I'll setup a test store in the next couple days so people can try it out.



To get this ball rolling, I'll start a bounty of 2 BTC for the first person other than myself who gets a store running. Contribute if you'd like:

1D3NrskpzB5Ydzs2RByDavbqqenbksgNoB (



Thanks,



weex That's a good question and I suppose it's ready for someone running a test store or someone with php/python/mysql experience. I've been testing it as I go and it is based in part on some code that has seen long term use. I'll setup a test store in the next couple days so people can try it out.To get this ball rolling, I'll start a bounty of 2 BTC for the first person other than myself who gets a store running. Contribute if you'd like:1D3NrskpzB5Ydzs2RByDavbqqenbksgNoB ( Bounty thread Thanks,weex