Mondu Home Page

Create

The invoice can be created only if the state of order is set to **confirmed**. This happens when the order was successfully created in Mondu system and the buyer authorized the financing attempt through an interaction with Mondu Widget.

The Create Invoice Request should be triggered when the state of order in your System is set to "shipped". It can happen either in the Shop System or in ERP.

📘

Invoice Documents

While the API has a mandatory invoice_url field, you can also upload invoice PDFs directly with the create invoice call. In this case, you can fill the invoice_url field with any FQDN.

In case you make the invoices available via URL, make sure to apply good practices for capability URLs.

How to Upload Invoice PDFs

The Mondu API requires you to make the invoice PDF available whenever you create an invoice. The PDF can either be accessible via URL, or can be uploaded directly with the create invoice request. Here's a code example in python on how to do it:

import requests

API_KEY = "your-api-key"
order_uuid = "65c6927b-9943-4601-929d-eda55cc302f3"  # Mondu order uuid
endpoint = "https://api.demo.mondu.ai/api/v1/orders/"  # prod: https://api.mondu.ai/api/v1/orders/

url = endpoint + order_uuid + "/invoices"
file = {
    "file": ("invoice.pdf", open("invoice.pdf", "rb"), "application/pdf")
}  # make sure to have the invoice as 'invoice.pdf' in the same folder as this script
payload = {
    "source": "api",
    "external_reference_id": "inv-01",  # invoice ID
    "invoice_url": "https://test.com",  # dummy value because URL is mandatory
    "gross_amount_cents": 126600,  # invoice amount in cents
}
headers = {"accept": "application/json", "Api-Token": API_KEY}
response = requests.post(url, files=file, data=payload, headers=headers)
if response.status_code == 201:
    print("File uploaded successfully")
    print(response.text)
else:
    print("File upload failed")
    print(response.text)
    print(response)

Important Invoice States in Mondu system

StateDescription
createdInvoice created
lateWasn't paid on time by the buyer
CanceledCanceled by the merchant
CompletePaid by the buyer

What should be implemented next?

Create Credit Note
In case the buyer returned the products, trigger Create Credit Note Request.

Cancel Invoice
In case of invoice cancellation, trigger Cancel Invoice Request.

API Reference

Language
Authorization
Header
Click Try It! to start a request and see the response here!