1.Introduction
This is the manual for the integration between Magento and WeFact.
The integration is working for these versions of Magento: FAQ - Magento versions. The integration is a basic integration. Magento has many options in the standard version that the integration does not support. In particular, these are:
- Reading shipping addresses. We do have an option for this, but it needs to be programmed on the Magento webshop side.
- Reading payment costs. We do have an option for this, but it needs to be programmed on the Magento webshop side.
- Adding discounts excl. VAT. The integration does not support this.
- Adding credit amounts - adjustments - in credit invoices. The integration cannot process this because the VAT information is missing.
- In some situations, the VAT of free items cannot be determined correctly.
- In some situations, the VAT percentage does not come through correctly from the Magento webshop. This often happens with smaller amounts and/or large quantities. Magento webshops pass on amounts in 2 decimals, not 4. This causes rounding differences. These invoices will have to be entered manually in WeFact.
- We will supplement this list if we notice that more items are missing.
This integration does not replace the work of an accountant. It saves time because you no longer have to retype documents. The accountant is still needed for advice, expertise, and control.
Tip: Other customers using this integration found the tips in the FAQ for Magento and in the FAQ for WeFact.
Read more Introduction .... Read less Introduction ....Installing the integration starts with signing up for a trial period, via our integrations page. After registration, you will receive an email containing an installation URL and login details. With this installation URL, you start the installation of the integration.
The installation is complete when both connection dots are green, and the settings in the Configuration tab have been entered and saved.
There is a trial period of 30 days.
If you want to install another integration, you can do so in the same way. Make sure you are logged out of the integration dashboard and preferably start the new installation in an incognito browser.
At the end of the trial or subscription period, the integration will not be automatically renewed. You will receive an offer for a one-year subscription or renewal by email at the end of this period. You can confirm the renewal by using the payment link in that email. Do you want to terminate the integration in the meantime? Please send us an email with the request and the license key. We can only stop integrations for you as of the current date, not on a future date.
Are you switching to another web shop/accounting system and do you want to re-establish a connection? In this faq we explain how to do this.
We advise you to deactivate the OAuth keys of the integration in your Magento webshop when uninstalling the integration.
2.How the integration works
Invoices are retrieved from the Magento webshop once per hour. This integration processes Magento invoices, not Magento orders. The integration works for both Magento 1.9 and Magento 2.x webshops, starting from Magento 2.1. Therefore, we do not support Magento 2.0.
Read more How the integration works .... Read less How the integration works ....
At the start of processing an invoice, we perform a number of checks on the Magento invoice:
- It is checked whether the total of the Magento invoice is equal to the sum of the amounts in the invoice lines.
- If the invoice is an ICP invoice, the VAT number is checked.
- It is checked whether a corresponding VAT code exists in WeFact for the VAT in each line.
- It is checked whether the invoice has not already been processed.
Processing a Magento invoice to WeFact takes place in three steps:
- It is checked if the customer already exists in WeFact. If not, the customer is created. Matching is based on the email address.
- If product synchronisation is enabled, missing products will be created in WeFact.
- The WeFact invoice is created and processed.
After the invoice has been forwarded and a success message from WeFact has been received, the invoice is marked as completed. The Magento invoice appears in the Report tab on the dashboard.
If WeFact returns an error while processing the invoice, the invoice appears in the Errors tab on the dashboard. Via the yellow button More info more information about the problem can be found. Via the red button Report problem can the invoice with all necessary information easily be submitted to us after you have tried to resolve the problem yourself. If the problem is solved, in some cases the invoices can be processed again with the blue Process button.
Data
Information about the data that is processed can be found in the section Day-to-day: To WeFact later in the manual.
3.Required: Magento keys - only Magento 1.x
This step is only necessary for Magento 1.x. If you have a Magento 2.x webshop, you can skip this chapter!
3.1 Install extension
Installing and configuring the extension for Magento 1.x consists of the following steps:
First, check if your Magento webshop environment allows the use of the REST API. This check consists of the following steps. We use www.jouwwebwinkel.nl as the URL of your webshop.
(i) Is the REST API accessible? You can test this with the url http://www.jouwwebwinkel.nl/api/rest/products. Do you see a 403 appear on your screen? Fine. But …
(ii) … do you see a 404-screen?
Then the URL is redirected to an error page. This could be a problem with the .htaccess file. The line RewriteRule ^api/rest api.php?type=rest [QSA,L] must be present in this file. If not, you need to add it.
The problem could also be caused by a setting in the Apache web server. See this link for more information: http://magento.stackexchange.com/questions/29936/rest-api-returns-404.
(iii) Does the username you used to create the OAUTH keys have admin rights? That is actually necessary, otherwise the data cannot be retrieved from the webshop.
(iv) Do you use php-fpm fastcgi in the hosting environment? In that case, the authorization keys may not be transmitted correctly. This link contains more information: http://www.magentogeek.com/magento-rest-api-solution-for-400-bad-request/. This applies, among other things, to webshops hosted at byte.nl - shared hosting. They have a good explanation to solve this.
(v) In all cases: Contact us if you can't figure it out. We sometimes see details in our log files that might help you resolve the problems.
1. Turn off caching in your webshop. You can do this via System > Cache Management. After installing the extension, you can turn caching back on.
2. Install extension. Unzip the file and install the files under your Magento root. You can see from the structure of the zip file where to place which files. No files will be overwritten.
3. Define the REST Role. You first define a so-called Role that can read the invoice details, including tax rates and payment methods, from your webshop. To do this, go to System > Web Services > REST Roles. To use the extension, you need to create a Role of type Administrator. You create this by clicking Add Admin Role. If you already have one, you can reuse that Role.
On the left side of the screen is a screen titled Role Information. Click on the sub-menu link Role API Resources. You will see the option REST API Calls to read invoices appear. Check all the boxes under this option and save the details.
You have now configured the integration to have the right to read the invoices, tax rates, and payment methods entities from Magento, but you have not yet specified which data it is allowed to retrieve per entity.
4. Assign the fields that can be read. Go to System > Web Services > REST Attributes. Open the User Type Admin. Here, you will see the option REST API Calls to read invoices appear again. Check all options again and save the details.
5. Link the administrator to the REST role. Finally, you need to assign the administrator to the REST role. Go to System > Permissions > Users. Click on the administrator of the webshop. Go to REST Role, the bottom option in the menu on the left. Assign the administrator of the webshop to the Administrator REST Role.
3.2 Magento consumerkey and consumersecret
The steps for creating a Magento consumer key and consumer secret are as follows:
1. Log in as admin to your Magento 1.x webshop.
2. Go to System > Web Services > REST OAuth Consumers.
3. Click Add new to create the Magento keys. The key and secret are already filled in. Enter the name for the connection and the callback URL yourself. The value of the callback URL must be: https://interface.cloudinvoice.company/api/v1/servlet/magento/callback.php
4. Enter your administrator password. Click Save. You will enter the key and secret from this screen in a later chapter in the Consumerkey and Consumersecret fields of the connection settings screen.
4.Required: Magento after version 2.1
Magento webshops up to and including version 2.4.3 should follow the steps below to establish a connection with the webshop. For Magento webshops from version 2.4.4 onwards, we recommend creating an integration as explained below, but without a callback. If you contact us afterwards, we will ensure that you can enter the client ID / client secret / access token and token secret to establish the connection with the Magento webshop.
Please note: This is a standard integration without customization options. This means that the integration does not support all extensions in the webshop. It can also be difficult to connect the webshop due to a specific hosting configuration, for example, because of a modified .htaccess file, complex redirects, or a firewall. If you encounter these problems, it is often necessary to engage a Magento expert.
Installing and configuring the extension for Magento 2.x consists of the following steps:
1. Configuration. There are two Magento tabs you need to fill in. For the first one, we come up with a recognizable name and enter the Callback URL (https://interface.cloudinvoice.company/api/v1/servlet/magento2/callback.php?cikey=YOURLICENSEKEY), the Identity link URL (https://interface.cloudinvoice.company/api/v1/view/cloudinvoice/authenticate.php), and your password. YOURLICENSEKEY must be replaced with the license key from the email. It is always smart to save in between (top right). After that, we move on to the second tab, API.
You are now going to assign the permissions: which data from the webshop is the integration allowed to use? The image explicitly indicates which resources you need to check. Then click SAVE in the top right.
2. Activating the extension. You are now going to activate the extension. First, click on ACTIVATE.
You must grant permission to do so using the ALLOW button in the top right of the next screen.
And now you finally understand why Magento 2 is called 'Magento 2': two windows open! On the first window (so outside your Magento store):
In this separate window, enter your webshop domain name and the connection key you received by email upon registration. If you then click the Consent to connect button, you will see the activation take place in the other screen (of your Magento store).
The extension is now fully activated. To be sure, you can check the status of your integration on the Integration screen within your Magento webshop. The status should now be ACTIVE.
You have now completed the preparations in your Magento 2.x store.
5.Required: WeFact API key
- Log in to WeFact
- Go to Settings > API
- Check the box to enable the API
- Add the IP addresses. The IP addresses are 85.10.150.5 and 85.10.143.192. (Note: until recently, these were 188.241.148.36 and 141.138.138.112. The addresses in the image below are therefore not our current IP addresses)
- Copy the generated API key. You will need this key in the next section, Installation.
6.Installation
Installing the integration starts with signing up for a trial period, via our integrations page. After registering, you'll receive an email with an installation URL and login details. Use this installation URL to start the integration installation.
Activating the integration consists of three steps:
1. Establishing the connection with the Magento webshop. For Magento 2.x webshops, you have already done this in the previous step. For Magento 1.9 webshops, you need to fill in additional details here.
2. Establishing the connection with WeFact. This authorizes the integration to write transactions to your WeFact administration and read information.
3. Configuring additional data, such as the VAT settings. Please note: The integration uses the amounts from the webshop to calculate the VAT percentages. Ensure that rounding differences do not cause problems with the VAT percentages.
Authentication Magento webshop:
This step only needs to be performed for Magento 1.9 webshops. For Magento 2.x webshops, the authentication has already been done in the previous step. Authenticating the Magento 1.9 webshop is done as follows:
- First you fill in the admin URL of the webshop with the consumerkey and consumersecret from the previous step.
- Then you click the yellow Connect button to give the integration the correct authorization. Only after performing these two steps is a valid connection with the Magento webshop established. You can see this because the indicator will be green.
The connection with WeFact is established via an API key that you create within your WeFact account. For the API key, you indicate which IP addresses have access to the API key. This is an extra security measure that, in principle, only needs to be filled in once.
Only if we move servers will the IP addresses need to be updated. Should this become relevant in the future, you will receive information about this in a timely manner.
The integration can provide an invoice layout to the WeFact invoice. You can select the desired invoice layout from the list of available layouts.
When configuring the VAT rates, a link is created between the VAT rates in webshop and the VAT codes and revenue accounts in WeFact. You can always make changes by clicking the blue 'Edit' button and selecting an option from the drop-down menus.
By default, all EU countries are shown in the list. You only need to configure the countries you sell to, and - if applicable - ICP and International. The integration shows the standard VAT rates for Europe. You can adjust the VAT percentage with which you sell - left column. For example: By default, sales to Germany are set to 21%, but if you sell in the webshop with 19%, you can adjust that in the left column. Intra-Community (ICP) and international deliveries
The Intra-Community supplies / ICP option is intended for business-to-business deliveries within the EU. These sales are invoiced with 0% VAT. A VAT number from the customer is required. The International option applies to deliveries outside the EU. For these sales, the integration expects 0% VAT; otherwise, the sales cannot be processed. Separate VAT codes and general ledger accounts can be configured for both ICP and international deliveries.
Once the VAT settings have been configured and saved, you will always see the selected VAT rates. If you want to start over, you can use the grey 'Remove VAT settings' button. Your current settings will then be deleted and you can begin again.
You can create a link here between the payment methods in the webshop and a fixed debtor in your WeFact administration. Invoices with a payment method from the list will then always be posted to this debtor. In that case, no new debtors will be created.
Note: It is not possible to set fixed debtors for ICP invoices. For an ICP invoice, a valid VAT number must be transmitted. Therefore, a debtor will always be created in WeFact for an ICP invoice.
7.Day-to-day: From Magento
In this section, we show how we retrieve the invoices from the webshop.
Once an invoice has been processed, it cannot be processed again. An invoice that is modified in the webshop after it has been processed will not be adjusted in WeFact.
VAT numbers For business orders within the EU, outside the Netherlands, a VAT number is mandatory. The integration checks for this and also verifies that the VAT number is a valid VAT number.
VAT calculation: The integration always uses the prices in the [base_] fields, such as [base_grand_total] and [base_row_total].
The VAT amount in the invoice lines is determined as follows:
VAT amount = ['base_row_total_incl_tax'] - ['base_row_total']
The VAT percentage is determined as follows:
VAT amount/ ['base_row_total']
If the amount excl. VAT is 0, the VAT percentage defaults to 21%. Unfortunately, this cannot be adjusted.
Based on the VAT percentage, the VAT code and the general ledger account in WeFact are determined. We notice that some Magento webshops make their own corrections to the VAT in their invoices. The VAT then does not exactly match the VAT of the products. This results in incorrect VAT percentages, such as 8% instead of 9% and 22% instead of 21%. The integration cannot correct this and will give an error message if 8% and 22% do not appear in the webshop's VAT settings. We generally see this problem occur when using small amounts. Unfortunately, the integration does not have an adequate solution for this.
Field-level specification invoices
| Below is a specification at the field level for retrieving invoices from Magento 2.x webshops. | |
| Name field | Values from Magento order |
| Factor for multiplying amounts | In the Magento credit invoices, the amounts are listed as positive amounts. This is because debit invoices and credit invoices are separate entities. In Magento, you therefore have two types of invoices, debit and credit, and both types have a positive amount. Therefore, the integration uses a factor = 1 for debit invoices and a factor = -1 for credit invoices. |
| Invoice-identifier | [entity_id] Please note, to keep those IDs unique between debit and credit invoices, the integration places a 1 before the invoice ID of the credit invoice. This is why you see a multiplication by the factor. |
| Invoice number | [increment_id] from the Magento invoice |
| Orderid | [order_id] |
| Order number | [increment_id] from the Magento order. If it is configured for the merchant that the order number is leading, then for the order number a C_ is placed. |
| Affiliate number |
Is determined based on the underlying order
|
| Order-identifier | This is determined based on the URL in the field [order] |
| Invoice date | [created_at] |
| ICP indication |
An invoice is an ICP invoice if:
|
| International indication |
An invoice is an international invoice if:
|
| Payment method |
The payment method is determined as follows based on the field [paymethod]:
|
| Paymentmethod-id | [paymethod_id] |
| Total amounts incl or excl VAT | The amounts in the order can be incl. or excl. VAT. This is determined by the field [taxes_included]. This value is important for determining the Total incl and the Total excl, see below. |
| Total incl | [base_grand_total]. The base_ part ensures that the amount is taken in the webshop's base currency. |
| Total VAT | [base_tax_amount] |
| Total excl | Total incl VAT - Total VAT |
| Shopping cart values | These values are read via [base_subtotal] and [base_subtotal_inc_tax] |
| Name field | Values from Magento order |
| Name product | [name], special characters are removed as much as possible |
| Amount | [qty] |
| Amount incl VAT | [base_row_total_incl_tax]; for the unit amount we divide by the quantity |
| Amount excl VAT | [base_row_total]; for the unit amount we divide by the quantity |
| VAT Amount with discount | [base_row_total_incl_tax] - [base_row_total]; for the unit amount we divide by the quantity |
| VAT percentage |
The VAT percentage is tricky with Magento invoices because the Magento API provides these prices in 2 decimals, which quickly results in a percentage of 20%, 22%, 8% or 10% for small amounts. There is a workaround, but that requires programming work on the side of the Magento webshop.
|
| Discount | [base_discount_amount] for the discount amount incl VAT. For the discount excl VAT [base_discount_amount] - [base_discount_tax_compensation_amount]. |
| Line prices incl and excl discount | These are calculated from the discount and the unit prices. The unit prices are multiplied by the quantity. |
| The shipping costs are added as a separate invoice line | The amounts are determined based on [total_shipping], [shipping_tax_percentage] and [invoice_row_taxes_included] as in other lines. This line is only added for an amount other than 0. |
| The payment costs are added as a separate invoice line | The amounts are determined based on [paymethod_costs], [extra_payment_option_price] and [invoice_row_taxes_included] as in other lines. This line is only added for an amount other than 0. |
| The surcharges are added as separate lines to the invoice | The amounts are determined based on [extra_costs], [credit_point_discount], [invoice_row_taxes_included] as in other lines. The amount is only added for an amount other than 0. This leads to a maximum of 2 extra lines. |
| Accounts and VAT codes from WeFact | These are determined based on the settings in the integration, the delivery country of the invoice and the VAT percentages. The type for invoice lines is turnover / revenue, for the shipping costs line shipping / shipping costs and payment costs payment / payment costs. |
8.Day-to-day: To WeFact
A invoice from the Magento webshop is processed to WeFact as a WeFact invoice. The draft invoice option is default and is used most often; the processed invoice option can be requested from us.
The synchronization of data between Magento and WeFact is as follows:
Even if the WeFact invoice created by the integration has the status sent, that does not mean that WeFact the invoice by email has sent. The status sent can also mean that the invoice was sent manually. If you want the invoice to be sent automatically by email, please contact us via webcare@webwinkelfacturen.nl. We adjust your contract settings so that the integration - after the WeFact invoice has been created - sends an additional command to WeFact to send the invoice to the customer by email.
When processing customer information, it is first checked whether the customer has been processed before. If so, this WeFact debtor is used as the debtor for the WeFact transaction. If the customer is not yet known, they are added to WeFact. Matching is based on email address.
Please note: The integration only creates debtors. The integration does not modify debtors.
We can add products to WeFact. This is disabled by default; please contact us if you would like to enable it. If enabled, the integration first checks whether the products from the invoice already exist in WeFact. The integration then adds missing products to the accounting system. If a product already exists in WeFact, it will not be added again. The integration automatically creates the following products in WeFact: Shipping costs, Payment costs, Surcharge, Discount, and Additional costs.
WeFact only accepts SKUs consisting of numbers/letters, without special characters.
When creating invoices, the integration uses the VAT percentage as it is in the of Magento. Even if there is a different VAT percentage in the product of WeFact.
The integration creates the invoice in WeFact, but will not automatically send the invoice to the debtor. It is possible to set an invoice layout. This can be done via the dashboard https://uwkoppeling.webwinkelfacturen.nl, tab Configuration.
Field-level specification WeFact
| Name | Example | Note |
| xml | ||
| VatCalcMethod | incl | This means that the invoice in WeFact will display amounts including VAT. This cannot be changed. WeFact has indicated that invoices are correctly submitted in this way. |
| Debtor | 906 | WeFact debtorID |
| Date | 2023-03-01 21:25:08 | Invoicedate |
| InvoiceCode | Empty, upon request invoice number or order number | |
| Description | 000000906/000000345 | invoice number or order number |
| Term | 14 | Not editable |
| Status | 0 | Selecting status 4 - Processed is possible. |
| Invoice profile | As set on the dashboard. | |
| InvoiceLines | ||
| Number | 1 | Amount |
| Description | 3-in-1 Magazine Bundle | Description |
| PriceExcl | 20.65 | Unit price excl VAT. |
| TaxCode | V21 | VAT code |
| ReferenceNumber | 000000906 | order number |
| Cost center | It is possible to have the revenue posted to a default cost center. | |
| Shipping address - via CustomFields. The name fields - such as [verzend_bedrijf] - cannot be adjusted. | ||
| [shipping_company] | BV Sponiza IT | Company name |
| [shipping_firstname] | Soumaya | First name |
| [shipping_lastname] | van Spanje | Last name |
| [shipping_address] | Stationstraat 12 | Shipping address |
| [shipping_zipcode] | 1000 AA | Zipcode shipping address |
| [shipping_city] | Amsterdam | City shipping address |
| [shipping_country] | The Netherlands | Country shipping address |
| Name | Example | Note |
| CompanyName | [company] | Company name |
| Initials | [firstname] | first name |
| Surname | [lastname] | If [lastname] is not provided, we will fill in NN. |
| Taxnumber | [VATnr] | VATnumber |
| Address | [address] | If a house number is provided then: [adres][housenr] |
| Zipcode | [zipcode] | Zip code |
| City | [city] | City |
| Country | [isocountry] | Country |
| emailaddress | [email] | |
| Phonenumber | [telnr] |
| Name | Example | Note |
| productcode | [articlekey] | |
| productname | [name] | |
| productkeyphrase | [description] | |
| price excl | [unitpriceexcl] | Unit price excl VAT. |
| taxcode | VAT code | As set on the dashboard. |
| CostCentre | [defaultcostcenter] | If this is present, we will display it. |
9.Support
Read more Support .... Read less Support ....
Explanation tabs dashboard
On the Dashboard >> Report you can see which invoices from your Magento webshop, and when, have been transferred to WeFact.What if invoices are missing in WeFact
If invoices are missing in WeFact we recommend following the steps below:- Log in to the dashboard: https://uwkoppeling.webwinkelfacturen.nl. The username and password are included in the registration email.
- Go to the Errors tab and check if invoice is there. You may need to adjust the search period if the
invoice is from a previous month. If you find invoice in this overview:
- Check the error code and verify whether you can resolve it yourself.
- If yes resolve the issue and click the blue Process button to resubmit the invoice.
- If not use the red Report problem button to create a ticket with us.
- Note if there are multiple errors, please create only 1 or 2 tickets. We will automatically see the other issues.
- Go to the Report tab and see if invoice is listed there. If so, you'll often see an identifier for WeFact (in the purple section of the overview) that you can use to search for invoice.
- Go to the Open tab and check if invoice is there.
- If you cannot resolve the issue, you can always create a ticket via the green Ask us button.
