Invoice Tutorial

In this example we'll go through all of the steps and give examples on what you'll need to do to implement invoice creation and management. Once you've read through this guide you'll know everything that is required by us for you to use our invoice system.

Let's assume you operate a business and would like to use our platform to create and send professional invoices to your customers.

You have a customer registered on your site called John Doe. He is a recurring customer on your site, and his customer ID in your system is Customer:US:123456. You want to create an invoice for services rendered worth 100 USD. Let's assume the invoice created in your system has an ID of Invoice:INV-ABC123-2025.

Once you have the details collected on your end, you can then create the invoice in our system. This example will guide you through the details you need to set and what calls you need to make.

Authentication

All API calls on Money Graph are authenticated. API requests made without authorization will fail with the status code 401: Unauthorized.

  • Log in to your Money Graph dashboard
  • Navigate to Settings
  • Select API keys from API & Webhook section to view and copy your keys

Don't take any chances

If you think your keys may have been compromised (for instance, you accidentally committed them to Git), you should immediately generate new ones using the Generate new keys button on the Settings> API & Webhook page on your dashboard. This will invalidate all existing keys and give you a new set, and you can then update your app to use the new ones.

Understanding Entities (Customers)

The entity represents who you are creating the invoice for or on behalf of. It is also called the customer. There are two types of entities:

  • Individual - For personal customers. Requires basic personal information.
  • Company - For business customers. When the entity_type is company, you must provide a value for the company_name of the entity.

The entity type must be specified when creating the entity.

Invoice Headers and Signatures

To create professional-looking invoices, you can customize the appearance with headers and signatures:

  • Invoice Header - Invoice headers appear at the top of the invoice. Contains things like the name of the business sending the invoice, business logo and address information.
  • Invoice Signature - Invoice signature appears at the bottom of the invoice. Contains the signature image to append to the invoice.

When creating the invoice, you may or may not specify invoice header or signature but for good user experience, it's required you do so.

Image Quality Best Practice

It's advised you upload high quality images of the logo and signature image to your own server and then you provide the URL when creating the aforementioned resources.

Email Notifications

When an invoice is created, you can specify up to 5 notification emails. These are like BCC for emails. Notifications will be sent to these emails when the invoice is paid by the entity.

Creating an Entity (Customer)

First step is setting up the customer details. Generally you'll need to send us the following information for every customer and we will return a customer id:

  • entity_type (individual or company)
  • name
  • email
  • phone
  • address information
  • company_name (required if entity_type is company)

{
    "entity_type": "company",
    "first_name": "Jon",
    "last_name": "Doe",
    "email": "[email protected]",
    "phone": "9051194087",
    "country": "NG",
    "address": "NO 2 East lane example street",
    "city": "Benin",
    "state": "ED",
    "postal_code": "300282",
    "company_name": "EaglesTech Enterprise"
}

Creating Invoice Header

Next, set up your invoice header. Create an invoice header with your business branding:

  • business name
  • business logo URL
  • business address
  • contact information

{
    "email": "[email protected]",
    "phone": "+14185438090",
    "country": "US",
    "company_name": "ABC Corporation",
    "address": "NO 2 Eastgate lands, Westmidlands",
    "city": "Baltimore",
    "state": "MD",
    "postal_code": "21201",
    "website": "",
    "image_size": 20,
    "image_url": "https://cdn.pixabay.com/photo/2015/06/30/11/33/porsche-826385_1280.jpg"
}

Creating Invoice Signature

Set up your invoice signature to appear at the bottom of invoices. Create an invoice signature:

  • signature name
  • signature image URL
  • title/position

{
    "title": "Third Signature",
    "image_size": 23,
    "image_url": "https://cdn.pixabay.com/photo/2020/11/03/15/32/man-5710164_1280.jpg"
}

Creating the Invoice

Finally, tie everything together by creating the invoice. Create an invoice with the customer, items, and notification emails:


{
    "currency": "usd",
    "discount_type": "fixed",
    "discount_value": 0.5,
    "tax_type": "percentage",
    "tax_value": 25,
    "items": [
        {
            "description": "Honey beans",
            "quantity": 2,
            "amount": 4500
        },
        {
            "description": "Sliced Bread",
            "quantity": 2,
            "amount": 1500
        }
    ],
    "title": "INV-ABC123-20255",
    "customer": "89a394dd-9571-4a3a-833c-5e880084d4c9",
    "due_date": "2025-10-20",
    "emails": [
        {"email": "[email protected]"},
        {"email": "[email protected]"},
        {"email": "[email protected]"},
        {"email": "[email protected]"}
    ],
    "header": "cc496f0c-05ac-4a1e-bb9f-fb878278b5a9",
    "signature": "2f5378ea-2291-4f34-b531-a73211d8649c",
    "invoice_customer_signature": true,
    "memo": "Pay for clothes"
}

Updating an Invoice

You can update an invoice before it's paid. Update an invoice by providing the invoice ID and the fields you want to change. All fields are optional when updating.

Webhook Notifications

Once the invoice is created and sent to the customer, our system will send notifications to the specified email addresses when the invoice is paid. You can also configure webhook endpoints in your dashboard to receive real-time notifications about invoice status changes, payments, and other important events.