Skip to content

invoiceahoy/medusa-plugin-invoiceahoy

Repository files navigation

InvoiceAhoy

Create invoices for Medusa orders.

Website | Documentation

Features

  • Automatically create compliant PDF & HTML invoices from Medusa orders.
  • Invoices are accessible from the Backend portal.
  • The plugin is in active development. If you have any feature requests, please open an issue.

Prerequisites


How to Install

1. Run the following command in the directory of the Medusa backend:

npm install medusa-plugin-invoiceahoy

2. Set the following environment variables in .env:

INVOICEAHOY_API_KEY=<YOUR_INVOICEAHOY_API_KEY>

3. In medusa-config.js add the following at the end of the plugins array:

const plugins = [
  // ...
  {
      resolve: `medusa-plugin-invoiceahoy`,
      options: {
          logo_url: "https://invoiceahoy.com/ia_logo.svg",  // the logo to add to the invoice
          api_key: process.env.INVOICEAHOY_API_KEY, // required
          send: {
              enabled: true, // whether to send the invoice to the customer
              subject: "Thanks for your order ({{order_number}})", // the subject of the email
              from: "My Store", // the name of the sender
              cc: ["[email protected]"], // cc emails
          }
      },
  },
]

Test the Plugin

1. Run the following command in the directory of the Medusa backend to run the backend:

npm run start

2. Place an order using a storefront or the Store APIs. If using the Manual Payment option, visit the Backend Portal and manually capture the payment.

3. Verify that the invoice was created by checking your InvoiceAhoy account or the Order in Medusa Backend Portal.


Events

When an invoice is created, the "invoice.created" event is published with the invoice details. This can be used to retrieve the invoice artifacts (pdf / html) and deliver it to the customer in a downstream service.

Other channels