Integrating with Shopify to Retrieve Invoices as PDFs

I'm currently exploring the possibility of building an Shopify App in a specific manner, and I'd love some guidance or insights from the community. Here's the scenario: I'm working on a project where I need to retrieve the invoices for each order placed on a Shopify store. However, I don't just want the invoice data; I need the actual invoices in the same format that the customers receive them, ideally as PDF files. These PDFs would then be stored in the storage of my cloud provider, where they'll be accessible for further processing using an AI solution. I basically need all the information you would normally expect on an: invoice, price, quantity, product codes, serial number, warranty, insurance. All this information is important for our application. I've looked into Shopify's API documentation, and while it seems comprehensive, I couldn't find a straightforward method for retrieving the invoices as PDFs. I know I can fetch order data using the Order API, but this doesn't seem to include the actual invoice files. So my questions are: Is it possible to retrieve the invoices for Shopify orders in the form of PDF files through the API or any other method? If direct retrieval isn't possible, are there any workarounds or third-party solutions that could help achieve this? Has anyone tackled a similar integration before, and if so, what approach did you take? Any insights, suggestions, or pointers would be greatly appreciated. Thanks in advance for your help!

Comment (1)

Jese Leos

August 19, 2024

Verified user

You can set up a webhook that sends you a JSON when an Order is paid, and with that JSON you can automatically create a PDF. You can use a library like this to convert a json into a PDF. https://pdfkit.org/

You’ll be in good company