Skip to content

Commit 4bb6265

Browse files
authored
Merge pull request #1238 from ndeet/woocommerce-refunds-update
WooCommerce docs update
2 parents ba9cb01 + 29d37ef commit 4bb6265

4 files changed

+50
-42
lines changed

docs/WooCommerce.md

+50-42
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ If you do not have a store yet, follow [this step by step article](https://web.a
1515
This guide refers to the BTCPay for WooCommerce V2 plugin. You can find instructions for the now unmaintained legacy plugin (based on BitPay API) [here](https://github.com/btcpayserver/btcpayserver-doc/blob/cba96292ceea9483711ab53c479a98357383f857/docs/WooCommerce.md).
1616
:::
1717

18+
[[toc]]
19+
1820
![BTCPay - WooCommerce Infographic](./img/infographics/BTCPayInfographic.png "BTCPay - WooCommerce Infographic")
1921

2022
To integrate BTCPay Server into an existing WooCommerce store, follow the steps below and/or watch this video:
@@ -80,9 +82,9 @@ You can either click on the notifications link saying "**please configure the pl
8082

8183
3. If you are not logged in to your BTCPay Server instance, do so now. (optional)
8284
![BTCPay WordPress V2: Login to BTCPay Server](./img/woocommerce/btcpayWooLmode1.jpg)
83-
4. For each listed permission click on "select specific stores..." (If you only have one store it will get autoselected).
85+
4. Select the store you want to connect to (if you only have one store it will get autoselected).
8486
![BTCPay WordPress V2: Select store](./img/woocommerce/btcpay-wc-2--05-api-auth-select-store.png)
85-
5. Click [Authorize app]
87+
5. All required permissions are prefilled already, you just need to click [Authorize app]
8688
![BTCPay WordPress V2: Click on authorize app](./img/woocommerce/btcpay-wc-2--06-api-auth-authorize-button.png)
8789
7. You will get redirected to your WooCommerce store and the API key and Store ID will be prefilled.
8890
![BTCPay WordPress V2: Redirected back to plugin settings](./img/woocommerce/btcpay-wc-2--07-api-auth-after-redirect-prefilled.png)
@@ -95,22 +97,22 @@ Continue with "3. Testing the checkout" below.
9597

9698
If you can't use the wizard mentioned in the previous section you can also generate the API key manually.
9799

98-
1. Click on *[Account]* -> *Manage Account* on the bottom left
100+
1. Click on *[Account]* -> *Manage Account* on the bottom left
99101
![BTCPay WordPress V2: Manage Account](./img/woocommerce/btcpayWooLmode2.jpg)
100-
2. Go to the tab *"API Keys"*
101-
3. Click *[Generate Key]* to select permissions.
102+
2. Go to the tab *"API Keys"*
103+
3. Click *[Generate Key]* to select permissions.
102104
![BTCPay WordPress V2: API Keys overview](./img/woocommerce/btcpayWooLmode3.jpg)
103-
4. Click on the *"Select specific stores"* link for the following permissions: `View invoices`, `Create invoice`, `Modify invoices`, `Modify stores webhooks`, `View your stores`
104-
![BTCPay WordPress V2: API Keys Permissions](./img/woocommerce/btcpayWooLmode4.jpg)
105-
5. Click on *[Generate API Key]*
106-
![BTCPay WordPress V2: API Keys Save](./img/woocommerce/btcpayWooLmode5.jpg)
107-
6. Copy the generated API Key to your WordPress *BTCPay Settings* form
108-
![BTCPay WordPress V2: Copy API Key](./img/woocommerce/btcpayWooLmode6.jpg)
109-
7. Copy the store ID to your WordPress *BTCPay Settings* form
110-
![BTCPay WordPress V2: Copy Store ID](./img/woocommerce/btcpayWooLmode7.jpg)
111-
8. On the BTCPay Settings form make sure *BTPCay Server URL*, *BTCPay Server API Key* and *Store ID* are set and click *[Save]*
112-
9. Make sure you see the notification "*BTCPay Server: Successfully registered a new webhook on BTCPay Server*"
113-
![BTCPay WordPress V2: Save BTCPay Settings form](./img/woocommerce/btcpay-wc-2--15-man-api--btcpay-settings-save.png)
105+
4. Click on the *"Select specific stores"* link for the following permissions: `View invoices`, `Create invoice`, `Modify invoices`, `Modify stores webhooks`, `View your stores`, `Create non-approved pull payments` (used for refunds)
106+
![BTCPay WordPress V2: API Keys Permissions](./img/woocommerce/btcpayWooLmode4.jpg)
107+
5. Click on *[Generate API Key]*
108+
![BTCPay WordPress V2: API Keys Save](./img/woocommerce/btcpayWooLmode5.jpg)
109+
6. Copy the generated API Key to your WordPress *BTCPay Settings* form
110+
![BTCPay WordPress V2: Copy API Key](./img/woocommerce/btcpayWooLmode6.jpg)
111+
7. Copy the store ID to your WordPress *BTCPay Settings* form
112+
![BTCPay WordPress V2: Copy Store ID](./img/woocommerce/btcpayWooLmode7.jpg)
113+
8. On the BTCPay Settings form make sure *BTPCay Server URL*, *BTCPay Server API Key* and *Store ID* are set and click *[Save]*
114+
9. Make sure you see the notification "*BTCPay Server: Successfully registered a new webhook on BTCPay Server*"
115+
![BTCPay WordPress V2: Save BTCPay Settings form](./img/woocommerce/btcpay-wc-2--15-man-api--btcpay-settings-save.png)
114116

115117
## 3. Testing the checkout
116118

@@ -126,27 +128,27 @@ The final video guides you through the steps of setting a gap limit in your Elec
126128

127129
Can be found at *WooCommerce -> Settings -> Tab [BTCPay Settings]*
128130

129-
**BTCPay Server URL**
131+
**BTCPay Server URL**
130132

131133
URL to your BTCPay Server instance, including protocol e.g. `https://btcpay.yourdomain.com`.
132134

133-
**BTCPay API Key**
135+
**BTCPay API Key**
134136

135137
Your API Key. (Was auto-generated in the steps before).
136138

137-
**Store ID**
139+
**Store ID**
138140

139141
The store ID of your BTCPay Server store. Can be found on the store settings page.
140142

141-
**Default Customer Message**
143+
**Default Customer Message**
142144

143145
Here you can customize the customer message shown after selecting BTCPay payment gateway on checkout. This can be overwritten on the payment gateway settings for each gateway if you use the "Separate payment gateways" option.
144146

145-
**Invoice pass to "Settled" state after**
147+
**Invoice pass to "Settled" state after**
146148

147149
Set after how many confirmations a payment is considered fully paid and settled. Defaults to what is configured on BTCPay store settings.
148150

149-
**BTCPay Order Statuses**
151+
**BTCPay Order Statuses**
150152

151153
Depending on your business model and store settings, you may want to configure your order statuses.
152154
You can set BTCPay to trigger certain order status in WooCommerce automatically.
@@ -168,15 +170,15 @@ Another example, if a merchant wants to send an email notifying the customer tha
168170

169171
It takes some time to find a perfect formula, so users should test things out before going live.
170172

171-
**Separate Payment Gateways**
173+
**Separate Payment Gateways**
172174

173-
If this option is enabled the plugin will generate one separate payment gateway per supported payment method on BTCPay Server. E.g. if you have BTC, LightningNetwork and maybe Liquid Assets enabled on your BTCPay Server store, then you will have a separate gateway available for each. This allows many new use cases like discount per gateway or country based restrictions. More details [here](./FAQ/Integrations/#how-to-configure-additional-token-support).
175+
If this option is enabled the plugin will generate one separate payment gateway per supported payment method on BTCPay Server. E.g. if you have BTC, LightningNetwork and maybe Liquid Assets enabled on your BTCPay Server store, then you will have a separate gateway available for each. This allows many new use cases like discount per gateway or country based restrictions. More details [here](./FAQ/Integrations/#how-to-configure-additional-token-support).
174176

175-
**Send customer data to BTCPayServer**
177+
**Send customer data to BTCPayServer**
176178

177179
By default *no* customer data beside email is sent to BTCPay Server. If you want to send customer address data to BTCPay Server you can enable it here.
178180

179-
**Debug Log**
181+
**Debug Log**
180182

181183
This option is helpful in case you have a problem and need more information on what is going on. The logs can be then found under WooCommerce -> Status -> Log. Make sure you disable this again after debugging as it will fill up your filesystem with logs.
182184

@@ -187,10 +189,10 @@ Depending on wheter you have above mentioned "Separate Payment Gateways" enabled
187189

188190
On all payment gateways you can set the following options:
189191

190-
**Title**
192+
**Title**
191193
The shown payment gateway text on the checkout page. Defaults to "BTCPay (Bitcoin, Lightning Network, ...)".
192194

193-
**Customer Message**
195+
**Customer Message**
194196

195197
Here you can customize message shown after selecting BTCPay payment gateway.
196198

@@ -214,19 +216,19 @@ Additional options only available for the separate payment gateways (if that fea
214216

215217
By default type "payment" is selected. But if you have Liquid Assets with your own issued asset/token (e.g. used as voucher) you can select "promotion" here. Those are processed differently than normal payment tokens. Details can be found [here](./FAQ/Integrations/#how-to-configure-additional-token-support#promotional-tokens-100-discount)
216218

217-
# Troubleshooting
219+
## Troubleshooting
218220

219-
## Error: Call to undefined function BTCPayServer\Http\curl_init()
220-
Please make sure your PHP version supports the cURL extension (as written in the requirements above). You can install it on Debian/Ubuntu by running the command `sudo apt install php-curl`.
221+
### Error: Call to undefined function BTCPayServer\Http\curl_init()
222+
Please make sure your PHP version supports the cURL extension (as written in the requirements above). You can install it on Debian/Ubuntu by running the command `sudo apt install php-curl`.
221223

222-
## The order states do not update although the invoice has been paid
224+
### The order states do not update although the invoice has been paid
223225
Please check first if the webhook is created under the BTCPay Server store settings. If there is no webhook created you can visit on your WooCommerce store BTCPay Settings tab under WooCommerce settings and hit the save button. This will create the webhook.
224226

225-
You may also check the details of your invoice if there were any errors on sending the webhook request. Some hosting providers, firewall setups or WordPress security plugins (like Wordfence) block POST requests to your WordPress site which lead to a http status of "403 Forbidden" or "503 Service Unavailable".
227+
You may also check the details of your invoice if there were any errors on sending the webhook request. Some hosting providers, firewall setups or WordPress security plugins (like Wordfence) block POST requests to your WordPress site which lead to a http status of "403 Forbidden" or "503 Service Unavailable".
226228

227229
You can check and verify yourself if there is something blocking requests to your site in one of these two ways:
228230

229-
**Check using a command line (Linux or MacOS):**
231+
**Check using a command line (Linux or MacOS):**
230232
(replace EXAMPLE.COM with your WordPress site URL)
231233

232234
```
@@ -239,14 +241,14 @@ On the response, if you see that line "HTTP/1.1 500" or "HTTP/2 500" and the mes
239241
```
240242
.... snip ....
241243
* We are completely uploaded and fine
242-
< HTTP/2 500
244+
< HTTP/2 500
243245
< server: nginx
244246
< date: Sun, 05 Jun 2022 16:55:08 GMT
245247
< content-type: application/json; charset=UTF-8
246248
< x-powered-by: PHP/8.1.6
247249
< expires: Wed, 11 Jan 1984 05:00:00 GMT
248250
< cache-control: no-cache, must-revalidate, max-age=0
249-
<
251+
<
250252
* Connection #0 to host example.com left intact
251253
{"code":"wp_die","message":"Webhook request validation failed.","data":{"status":500},"additional_errors":[]}
252254
```
@@ -265,9 +267,9 @@ On the other side, if you see that line "HTTP/1.1 403 Forbidden" or "HTTP/2 403"
265267
< Content-Length: 26
266268
```
267269

268-
**Check using an online service (if you do not have a command line available:**
270+
**Check using an online service (if you do not have a command line available:**
269271

270-
- Go to [https://reqbin.com/post-online](https://reqbin.com/post-online)
272+
- Go to [https://reqbin.com/post-online](https://reqbin.com/post-online)
271273
- Enter your domain: `https://EXAMPLE.COM/?wc-api=btcpaygf_default`
272274
(replace EXAMPLE.COM with your WordPress site URL)
273275
- Make sure "POST" is selected
@@ -278,23 +280,29 @@ On the other side, if you see that line "HTTP/1.1 403 Forbidden" or "HTTP/2 403"
278280

279281
If you see "Status 403 (Forbidden)" then POST requests to your site are blocked for some reason. You should ask your hosting provider or make sure no firewall or plugin is blocking the requests.
280282

281-
## I get an error during checkout but not sure what the problem is.
283+
### I get an error during checkout but not sure what the problem is.
282284

283285
In your BTCPay Settings in your admin dashboard: *WooCommerce -> Settings: Tab [BTCPay Settings]* you can enable debug mode by setting the checkbox on that option.
284286

285-
You can now find more detailed Logs when you click the [View Logs] button or you go to *WooCommerce -> Status: Tab [Logs]* and select the most recent btcpay logs.
287+
You can now find more detailed Logs when you click the [View Logs] button or you go to *WooCommerce -> Status: Tab [Logs]* and select the most recent btcpay logs.
286288

287289
:::warning Warning
288290
Please make sure that you disable the debugging mode again after you finished investigating, otherwise your site performance may be impacted and also write lots of logging data in your filesystem for no reason.
289-
:::
291+
:::
290292

291293
Additionally you can also look into your webservers error logs if you find any error that is related to BTCPay plugin.
292294

293-
## I have troubles with using the plugin or some other related questions
295+
### I have troubles with using the plugin or some other related questions
294296

295297
Feel free to join our support channel over at [https://chat.btcpayserver.org/](https://chat.btcpayserver.org/) if you need help or have any further questions.
296298

299+
### Create a new API key
300+
301+
If you have been using the WooCommerce V2 plugin prior to version 2.0.0, your API key won't have the required permissions to issue refunds via pull-payments. If you want to use that feature, you can create a new API key (editing an API key is not currently supported). You can use the above described [2.1 Connect using API key wizard](#21-connect-using-the-api-key-wizard--recommended-) or the [manual API key generation](#22-connect-by-manually-creating-the-api-key-and-permissions). The configured webhook will continue to work, and no change is needed.
302+
303+
### I messed around with the webhook, how to fix
297304

305+
Suppose you accidentally changed the WooCommerce webhook, and it is not working anymore. In that case, you can quickly force a re-creation of it when you delete the API key on BTCPay Server and then go to the BTCPay Server Settings (on your WordPress site) and hit save again. You should see a message that the webhook was successfully created.
298306

299307
## Deploying WooCommerce from BTCPay Server
300308

Loading
Loading
76.1 KB
Loading

0 commit comments

Comments
 (0)