ERP invoices and delivery notes in the PrestaShop customer account
Sending invoices and delivery notes one by one by email takes time, and the customer can never find them when they need them. We explain how to have the ERP place them in the customer's store account, what to decide first and how to protect them.
In many stores, especially those that sell to businesses, the documentation for each order does not come out of PrestaShop. The invoice is issued by the ERP, the delivery note is generated by the warehouse, and the quality certificate or technical data sheet is kept by someone in a shared folder. Then someone in admin sends them by email one by one.
And a few months later, the customer writes: “Could you resend me the March invoice?”. This article is about breaking that cycle by making each document appear on its own in the customer's account in the store.
Why the customer account and not email
- The customer finds it when they need it, without writing to you. A whole year of invoices, in one list.
- It does not depend on the spam filter or on the customer's accounts mailbox changing hands.
- You have a record of what was published and, if you want, of who downloaded it and when.
- The data does not travel as an attachment through other people's mailboxes.
What is more, if the customer is a company with several people buying, they all know where the documentation is.
What to decide before connecting anything
Which document types
Group them into a few sections the customer understands: invoices (including corrective invoices, the Spanish facturas rectificativas that amend an issued invoice), delivery notes or delivery reports, and documents (contracts, certificates, customised manuals). More sections confuse; a single one mixes everything up.
How the customer is identified
The ERP and the store have to agree on who is who. The simplest option is the account's email address, but it has pitfalls: the customer who buys with one email and has another in the ERP, or the company that uses a generic address. Before you start, cross-check your customers' emails in the ERP against those in the store and correct the differences. If the ERP also stores a customer reference, have it travel with the document.
What happens to customers who do not have an account yet
A distributor may invoice a customer who has not yet registered in the store. Decide whether those documents are discarded, kept on hold or reviewed by hand when the customer signs up.
Which metadata goes with the file
A bare PDF is hard to search. What helps is for it to arrive with a description, the document date (not just the upload date), a number or reference and, where applicable, the customer reference.
How the connection is usually made
The usual pattern is that the ERP, every time it generates a document, sends an HTTP request to an address in the store with the file and its data. The store saves it and links it to the account. It is one-way (from the ERP to the store) and easy to program from almost any business management software, with a task that runs when the document is issued or a batch process at the end of the day.
Security: what cannot fail
An invoice contains a name, address, NIF (Spanish tax ID) and amounts. Publishing it wrongly is a personal data breach. Check:
- That the upload address requires a key and that this key is not anywhere public or in a website's code.
- That only the expected formats are accepted and the file's real type is checked, not just its extension. An “invoice.pdf” that is actually a script must not end up in a folder served by the website.
- That each document can only be downloaded by its owner, while logged in. A direct URL to the file that works without a session, or one where changing a number shows someone else's invoice, is the most serious mistake possible here.
- That files are not stored in a folder that can be listed from the browser.
- That a record is kept of each upload and its result, to spot failures or odd attempts.
A phased roll-out
There is no need to publish all the documentation at once. What works best for a distributor selling to businesses is to go step by step:
- New invoices. Start only with invoices issued from a given date. It is the most requested document and the one that saves the most emails.
- Review during the first weeks. Turn on prior approval: each document comes into the store, someone checks that it is going to the right account and publishes it. When you see there are no assignment errors, remove the approval step.
- Delivery notes. Useful above all if your customers need to check deliveries or if you work with partial deliveries.
- History. If you want, upload invoices from earlier periods afterwards in a batch process, letting customers know they are now available.
- Special documents. Certificates, safety data sheets, contracts: whatever makes sense for your sector.
Once it is up and running, tell your customers on the invoice itself or in the order confirmation email: “All your invoices are in your account”. If they do not know, they will keep asking for them by email.
Common mistakes
- Two invoices for the same sale visible in the account: PrestaShop's native one and the ERP's. Choose which one the customer sees.
- Uploads that fail silently because the customer's email does not match. Check the log during the first weeks.
- Documents uploaded to the wrong account because of an email shared by two companies. Approving before publishing, at least at the start, avoids scares.
- Section names in only one language in a store with several.
How to handle it in PrestaShop
The module for attaching invoices and documentation to the customer account (RKR ERP Upload) gives your ERP a key-protected URL to upload PDFs by HTTP POST, stating the customer's email, the document type (invoices, delivery notes or documents, each one can be enabled separately and has its own name in each language) and, optionally, a description, document date, reference and customer reference. It checks the extension and the real file type, stores documents organised by type, year and month, and only lets their owner download them while logged in. It can accept documents for emails not yet registered and link them when the customer signs up, pending your approval; it has a list for approving, withdrawing or uploading documents by hand, and logs every ERP call and, if you enable it, every download. It is compatible with PrestaShop 1.7.8 up to 9.