Skip to content

Latest commit

 

History

History
82 lines (56 loc) · 2.35 KB

File metadata and controls

82 lines (56 loc) · 2.35 KB

Medusa v2 Example: Invoice Generator

This directory holds the code for the Generate Invoices Tutorial.

You can either:

Prerequisites

Installation

  1. Clone the repository and change to the invoice-generator directory:
git clone https://github.com/medusajs/examples.git
cd examples/invoice-generator

2. Rename the .env.template file to .env.

3. If necessary, change the PostgreSQL username, password, and host in the DATABASE_URL environment variable.

4. Install dependencies:

yarn # or npm install

5. Setup and seed the database:

npx medusa db:setup
yarn seed # or npm run seed

6. Start the Medusa application:

yarn dev # or npm run dev

Copy into Existing Medusa Application

If you have an existing Medusa application, copy the content of the following directories:

  1. src/admin
  2. src/api
  3. src/modules/invoice-generator
  4. src/subscribers
  5. src/workflows

Then, add the module to your medusa-config.ts file:

import { defineConfig } from "@medusajs/framework/utils"

export default defineConfig({
  modules: [
    {
      resolve: "./src/modules/invoice-generator",
    },
  ],
})

Features

  • Automatic Invoice Generation: PDF invoices are automatically generated when orders are placed
  • Email Delivery: Invoices are automatically emailed to customers (If a Notification Module Provider is installed for emails).
  • Admin Dashboard: Manage invoice configurations, and download invoices.
  • Store Customizations: API routes to download invoices from the storefront.

More Resources