Package: bitpay-client
New usage: from bitpay_client import BitPay.API©2014 BITPAY, INC.Permission is hereby granted to any person obtaining a copy of thissoftware and associated documentation for use and/or modification inassociation with the bitpay.com service.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANYCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.Bitcoin Python payment library using the bitpay.com service.Installation------------Varies depending on what python webserver framework you are using(SimpleHTTPServer, Flask, Bottle, Django, etc.). Most of the calls willrun as-is from a script, but bpVerifyNotification will require updatingdepending on your framework. You can integrate these functions into yourcustom shopping cart implementation.Configuration-------------Note: Python 2.7 and its built in libraries are required for use of thiscode library.1. Create an API key at bitpay.com by clicking My Account > API AccessKeys > Add New API Key.2. In the bp\_options.py file, configure the options specific to yourimplementation.Usage-----1. In your shopping cart code, call bpCreateInvoice() with theappropriate orderID, price, posData and options.2. The library will attempt to POST the new invoice information via curlto the BitPay network. If successful, you will receive an invoice inthe return response. Any errors in this process will return an arraywith a single element: 'error' and the exception msg.3. You may use the bpLog function manually to log any information youwould like to track or automatically by setting the useLogging optionto true in the bp\_options file. The log file could potentially getvery large, depending on usage, so monitor closely or only use duringdebugging.4. Responses from the BitPay network are JSON. You can use the newdecodeResponse() function to convert these to an associative array,if needed.Troubleshooting---------------The official BitPay API documentation should always be your firstreference for development: https://bitpay.com/downloads/bitpayApi.pdf1. Verify that your "notificationURL" for the invoice is "https://"(not "http://")2. Ensure a valid SSL certificate is installed on your server. Alsoensure your root CA cert is updated. If your CA cert is not current,you will see curl SSL verification errors.3. Verify that your callback handler at the "notificationURL" isproperly receiving POSTs. You can verify this by POSTing your ownmessages to the server from a tool like Chrome Postman.4. Verify that the POST data received is properly parsed and that thelogic that updates the order status on the merchants web server iscorrect.5. Verify that the merchants web server is not blocking POSTs fromservers it may not recognize. Double check this on the firewall aswell, if one is being used.6. Use the logging functionality to log errors during development. Ifyou contact BitPay support, they will ask to see the log file to helpdiagnose any problems.7. Check the version of this Python library agains the officialrepository to ensure you are using the latest version. Your issuemight have been addressed in a newer version of the library.8. If all else fails, send an email describing your issue *in detail* tosupport@bitpay.com9. To manually test the library, update the options file with your APIkey and do the following:.. raw:: html<pre>$ python>>> import bp_lib>>> bp_lib.bpCreateInvoice(123, 1, 'fish')</pre>After a brief pause, you should get a JSON response that lookssomething like:.. raw:: html<pre>{'status': 'new', 'invoiceTime': 1393950046292, 'currentTime': 1393950046520, 'url': 'https://bitpay.com/invoice?id=aASDF2jh4ashkASDfh234', 'price': 1, 'btcPrice': '1.0000', 'currency': 'BTC', 'posData': '{"posData": "fish", "hash": "ASDfkjha452345ASDFaaskjhasdlfkflkajsdf"}', 'expirationTime': 1393950946292, 'id': 'aASDF2jh4ashkASDfh234'}</pre>Change Log----------Version 1.1 - Added new HTTP header for version trackingVersion 1 - Initial version