diff --git a/GUIDE.md b/GUIDE.md
new file mode 100644
index 0000000..bf8852b
--- /dev/null
+++ b/GUIDE.md
@@ -0,0 +1,48 @@
+# Using the BitPay plugin for ECWID
+
+## Prerequisites
+
+* Last Version Tested: 13.0.1629
+
+You must have a BitPay merchant account to use this plugin. It's free to [sign-up for a BitPay merchant account](https://bitpay.com/start).
+
+
+## Installation & Configuration
+
+**In config.php:**
+
+- Set $storeURL to the URL of your store's homepage.
+- Set $storeID to your ecwid store ID found in the bottom-right of the Ecwid control panel.
+- Set $bitpayURL to the URL of the bitpay/ folder which you extracted from this plugin.
+- Set $apiKey to the key you created at bitpay.com in the "My Account > API Access Keys" section.
+- Adjust $speed if desired.
+
+**In your Ecwid control panel:**
+
+- Click System Settings > Payment, then click Authorize. Rename this to "Bitpay" or whatever you'd prefer.
+- Change Payment Processor to Credit Card: Authorize.net SIM
+- Click Account Details
+- API Login ID: choose something random here and copy it to config.php's $login variable.
+- Transaction Key: choose something random
+- MD5 Hash value: choose something random here and copy it to config.php's $hashValue variable.
+- Transaction Type: Authorize and Capture.
+- Click Advanced Settings.
+- Type in the url to bitpay/redirect2bitpay.php on your server.
+- Click Save
+- Click Save
+- Click Design > CSS Themes
+- Either click "New CSS Theme" or edit your own theme.
+- Add this to the text area of your custom theme:
+```css
+ /* bitpay checkout image */
+ img.defaultCCImage {
+ padding: 25px 263px 0px 0px;
+ background: url('https://en.bitcoin.it/w/images/en/2/29/BC_Logo_.png');
+ background-size:auto;
+ background-repeat:no-repeat;
+ width:0px;
+ height: 0px;
+ }
+```
+- Click Save
+
diff --git a/README b/README
deleted file mode 100644
index 24f33ff..0000000
--- a/README
+++ /dev/null
@@ -1,39 +0,0 @@
-Bitpay plugin for Ecwid
-
-Instructions:
-In config.php:
- Set $storeURL to the URL of your store's homepage.
- Set $storeID to your ecwid store ID found in the bottom-right of the Ecwid control panel.
- Set $bitpayURL to the URL of the bitpay/ folder which you extracted from this plugin.
- Set $apiKey to the key you created at bitpay.com in the "My Account > API Access Keys" section.
- Adjust $speed if desired.
-
-In your Ecwid control panel:
- Click System Settings > Payment, then click Authorize. Rename this to "Bitpay" or whatever you'd prefer.
- Change Payment Processor to Credit Card: Authorize.net SIM
- Click Account Details
- API Login ID: choose something random here and copy it to config.php's $login variable.
- Transaction Key: choose something random
- MD5 Hash value: choose something random here and copy it to config.php's $hashValue variable.
- Transaction Type: Authorize and Capture.
- Click Advanced Settings.
- Type in the url to bitpay/redirect2bitpay.php on your server.
- Click Save
- Click Save
-
- Click Design > CSS Themes
- Either click "New CSS Theme" or edit your own theme.
- Add this to the text area of your custom theme:
- /* bitpay checkout image */
- img.defaultCCImage {
- padding: 25px 263px 0px 0px;
- background: url('http://fde.minethings.com/ecwid/bitpay/bitcoin25.png');
- background-size:auto;
- background-repeat:no-repeat;
- width:0px;
- height: 0px;
- }
- Click Save
-
-Bitpay plugin version 1.0
-Tested against Ecwid version 13.0.1629
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5655d7c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,61 @@
+# Notice
+
+This is a Community-supported project.
+
+If you are interested in becoming a maintainer of this project, please contact us at integrations@bitpay.com. Developers at BitPay will attempt to work with new maintainers to ensure the project remains viable for the foreseeable future.
+
+# Description
+
+Bitcoin payment plugin for Ecwid using the bitpay.com service.
+
+
+## Quick Start Guide
+
+* Last Version Tested: 13.0.1629
+
+To get up and running with our plugin quickly, see the GUIDE here: https://github.com/bitpay/ecwid-plugin/blob/master/GUIDE.md
+
+
+## Troubleshooting
+
+The official BitPay API documentation should always be your first reference for development: https://bitpay.com/downloads/bitpayApi.pdf
+
+- Verify that your "notificationURL" for the invoice is "https://" (not "http://")
+- Ensure a valid SSL certificate is installed on your server. Also ensure your root CA cert is updated. If your CA cert is not current, you will see curl SSL verification errors.
+- Verify that your callback handler at the "notificationURL" is properly receiving POSTs. You can verify this by POSTing your own messages to the server from a tool like Chrome Postman.
+- Verify that the POST data received is properly parsed and that the logic that updates the order status on the merchants web server is correct.
+- Verify that the merchants web server is not blocking POSTs from servers it may not recognize. Double check this on the firewall as well, if one is being used.
+- Use the logging functionality to log errors during development. If you contact BitPay support, they will ask to see the log file to help diagnose any problems.
+- Check the version of this plugin against the official repository to ensure you are using the latest version. Your issue might have been addressed in a newer version of the library.
+
+## Support
+
+**BitPay Support:**
+
+* [GitHub Issues](https://github.com/bitpay/ecwid-plugin/issues)
+ * Open an issue if you are having issues with this plugin.
+* [Support](https://help.bitpay.com/)
+ * BitPay merchant support documentation
+
+**Ecwid Support**
+
+* [Homepage](https://www.ecwid.com/)
+* [Documentation](https://help.ecwid.com/)
+* [Support](https://help.ecwid.com/customer/portal/emails/new)
+
+## Version History
+
+- Bitpay plugin version 1.0
+- Tested against Ecwid version 13.0.1629
+- Added new HTTP header for version tracking
+
+## License
+
+©2011-2015 BITPAY, INC.
+
+The MIT License (MIT)
+
+Permission is hereby granted to any person obtaining a copy of this software and associated documentation for use and/or modification in association with the bitpay.com service.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/bitpay/.htaccess b/bitpay/.htaccess
index 8dfe378..745b75e 100644
--- a/bitpay/.htaccess
+++ b/bitpay/.htaccess
@@ -1,3 +1,5 @@
-
- Deny from all
-
\ No newline at end of file
+
+ Order allow,deny
+ Deny from all
+ Satisfy All
+
diff --git a/bitpay/bp_lib.php b/bitpay/bp_lib.php
index f1a7e95..dee7491 100644
--- a/bitpay/bp_lib.php
+++ b/bitpay/bp_lib.php
@@ -1,5 +1,22 @@
'authentication failed (bad hash)');
$json['posData'] = $posData['posData'];
- return $json;
+ if (!array_key_exists('id', $json))
+ {
+ return 'Cannot find invoice ID';
+ }
+
+ return bpGetInvoice($json['id'], $apiKey);
}
// $options can include ('apiKey')
@@ -122,10 +145,13 @@ function bpGetInvoice($invoiceId, $apiKey=false) {
return array('error' => $response);
//decode posData
$response['posData'] = json_decode($response['posData'], true);
- $response['posData'] = $response['posData']['posData'];
+ if($bpOptions['verifyPos'])
+ {
+ $response['posData'] = $response['posData']['posData'];
+ }
return $response;
}
-?>
\ No newline at end of file
+?>
diff --git a/bitpay/bp_options.php b/bitpay/bp_options.php
index d614bd4..09d2913 100644
--- a/bitpay/bp_options.php
+++ b/bitpay/bp_options.php
@@ -1,5 +1,22 @@
\ No newline at end of file
+?>
diff --git a/bitpay/functions.php b/bitpay/functions.php
index 54d0e70..4d4516e 100644
--- a/bitpay/functions.php
+++ b/bitpay/functions.php
@@ -2,14 +2,7 @@
function debuglog($contents)
{
- $file = 'log.txt';
- file_put_contents($file, date('m-d H:i:s').": ", FILE_APPEND);
- if (is_array($contents))
- file_put_contents($file, var_export($contents, true)."\n", FILE_APPEND);
- else if (is_object($contents))
- file_put_contents($file, json_encode($contents)."\n", FILE_APPEND);
- else
- file_put_contents($file, $contents."\n", FILE_APPEND);
+ error_log($contents);
}
function postToEcwid($notice)
@@ -46,9 +39,6 @@ function postToEcwid($notice)
$response = curl_exec($ch);
if ($response === false){
debuglog('request to ecwid.com failed');
- debuglog($url);
- debuglog($notice);
- debuglog($datatopost);
debuglog(curl_error($ch));
}
@@ -73,4 +63,4 @@ function deleteOldInvs() {
closedir($handle);
}
}
-?>
\ No newline at end of file
+?>
diff --git a/bitpay/index.php b/bitpay/index.php
new file mode 100644
index 0000000..34a6d15
--- /dev/null
+++ b/bitpay/index.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
+?>