m2m.ma
Ready to install

Connect your site to m2m.ma

Every paid order on your site can create its invoice automatically.

Connect your site to your invoicing

If you sell online, each order gives rise to an invoice, and copying them out one by one soon takes too long. m2m.ma offers two ready-to-install connectors and an API for other tools. Once the connection is in place, an order paid on your site can create its invoice automatically, once only, even if your site sends the same request again.

Choose the right method

Start from the tool you use today. If your shop runs on WooCommerce or Drupal Commerce, the connector is the shortest route. For anything else, your developer can use the API description, available to download.

  • WordPress and WooCommerce: a plugin to upload, with settings in WooCommerce, the ICE entered at the time of the order and the PDF accessible from the order
  • Drupal Commerce: a module for Drupal 10 and 11, which creates the invoice as soon as the order is paid
  • Any other tool: PrestaShop, Joomla, Magento, your CRM or your custom-built site, through the API called from your server

Setting up in three stages

First create a key in m2m.ma, by going to More, Settings, then E-commerce API. It is displayed only once: copy it somewhere safe. Next, upload the connector to your site and paste the key into its settings. Finally, place a test order and check the result in the Income section.

A key can be read or write, and can be revoked at any time without affecting the others. It must stay on your server and never appear in your visitors' browser. If you use the API, the order identifier prevents duplicates from being created, and the export or free zone scheme can be specified per order.

What happens next

An invoice created this way follows the same path as one created by hand. It can stay as a draft to be reviewed, or be validated and sent to the customer. Once validated, it receives its number, goes into your accounts and enters your VAT calculation.

Before rolling it out across the board, check with your accountant that the VAT rates and required details for your products are correct. For a technical question about your integration, write to info@m2m.ma stating your shop's platform.

Ready to install

How it works

  1. 1

    Create a key

    In m2m.ma: More, Settings, E-commerce API.

  2. 2

    Install the connector

    Upload the file to your site, then paste the key into its settings.

  3. 3

    Receive an order

    On payment, the invoice is created once and can go out to the customer.

Ready to install

Example API call

curl -X POST https://my.m2m.ma/api/v1/invoices \
  -H "Authorization: Bearer VOTRE_CLE_API" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "commande-1042",
    "customer": { "name": "Client SARL", "email": "client@exemple.ma", "ice": "000000000000000" },
    "lines": [{ "description": "Produit", "quantity": 2, "unit_price": 199.90, "vat_rate": 20 }],
    "validate": true,
    "send_email": true
  }'

Get started with m2m.ma

Try it free for 15 days, starting with your first invoice.