Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2631572
Improved documentation
ionux Mar 6, 2014
2887aa7
Update README.md
ionux Mar 6, 2014
dfe3d0a
Fixed reference to broken image link
ionux Mar 6, 2014
055f791
Added company, copyright & license information
ionux Mar 6, 2014
88cc8d5
Added company, copyright & license information
ionux Mar 6, 2014
e4d6cb7
Update README.md
ionux Mar 6, 2014
23d8481
Merge pull request #1 from ionux/master
Mar 6, 2014
1e919f6
Added new HTTP header for version tracking
ionux Mar 31, 2014
6ead65a
Updated version info
ionux Mar 31, 2014
7b3f47e
Merge pull request #2 from ionux/master
Mar 31, 2014
9e03530
Fix to use server error handling
ionux May 16, 2014
f41cc02
Fix to use server error handling
ionux May 16, 2014
6161e85
Merge pull request #3 from ionux/master
ionux May 16, 2014
a13efbd
Updated htaccess with more filetypes
ionux May 16, 2014
c718115
Update .htaccess
ionux May 16, 2014
700afb4
Merge pull request #4 from ionux/master
ionux May 16, 2014
3a006e6
Simply redirects to home page
ionux May 16, 2014
2e4a715
Merge pull request #5 from ionux/master
ionux May 16, 2014
94c360e
Security Patch
Oct 10, 2014
f43f12e
Merge pull request #7 from sambohler/master
JoshuaEstes Oct 10, 2014
6603e8f
Updated copyright notice year
ionux Feb 10, 2015
7511238
Merge pull request #1 from bitpay/master
ionux Feb 20, 2015
a3472a2
Create GUIDE.md
ionux Feb 20, 2015
c43bff1
Removed install/config info and added to GUIDE
ionux Feb 20, 2015
214896e
Fixed plugin name - oops!
ionux Feb 20, 2015
184610f
Merge pull request #8 from ionux/master
ionux Feb 20, 2015
a64cd3e
Update README.md
kleetus Nov 6, 2015
0049f3e
Update README.md
kleetus Nov 18, 2015
8eed2d1
Update GUIDE.md
kleetus Nov 18, 2015
76708d1
Update Support Links
jameswalpole Feb 19, 2016
066f4b9
Merge pull request #9 from jameswalpole/patch-1
kleetus Feb 19, 2016
6d2534b
Update README.md
bitjson Mar 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions GUIDE.md
Original file line number Diff line number Diff line change
@@ -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

39 changes: 0 additions & 39 deletions README

This file was deleted.

61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

8 changes: 5 additions & 3 deletions bitpay/.htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<Files log.txt>
Deny from all
</Files>
<Files ~ "^.*\.(LOG|log|back|bak|bk|lock|lck|LCK|txt|text|backup|pem|PEM|TXT)">
Order allow,deny
Deny from all
Satisfy All
</Files>
32 changes: 29 additions & 3 deletions bitpay/bp_lib.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
<?php

/**
* ©2011,2012,2013,2014 BITPAY, INC.
*
* 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.
*
*/

require_once 'bp_options.php';

function bpCurl($url, $apiKey, $post = false) {
Expand All @@ -19,6 +36,7 @@ function bpCurl($url, $apiKey, $post = false) {
'Content-Type: application/json',
"Content-Length: $length",
"Authorization: Basic $uname",
'X-BitPay-Plugin-Info: ecwid033114',
);

curl_setopt($curl, CURLOPT_PORT, 443);
Expand Down Expand Up @@ -108,7 +126,12 @@ function bpVerifyNotification($apiKey = false) {
return array('error' => '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')
Expand All @@ -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;
}


?>
?>
19 changes: 18 additions & 1 deletion bitpay/bp_options.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
<?php

/**
* ©2011,2012,2013,2014 BITPAY, INC.
*
* 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.
*
*/

global $bpOptions;

// do not edit this file
Expand Down Expand Up @@ -27,4 +44,4 @@

$bpOptions['transactionSpeed'] = 'low';

?>
?>
14 changes: 2 additions & 12 deletions bitpay/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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));
}

Expand All @@ -73,4 +63,4 @@ function deleteOldInvs() {
closedir($handle);
}
}
?>
?>
3 changes: 3 additions & 0 deletions bitpay/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
ob_start();
header('Location: ' . $_SERVER['SERVER_NAME']);
5 changes: 2 additions & 3 deletions bitpay/redirect2bitpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

$invoice = bpCreateInvoice(NULL, $_POST['x_amount'], $posData, $options);
if (isset($invoice['error'])) {
debuglog($options);
debuglog($invoice);
debuglog('Error creating invoice');
print 'Error creating invoice';
die;
}
Expand All @@ -44,4 +43,4 @@
// redirect to bitpay
header('Location: '.$invoice['url']);

?>
?>