Skip to content
Last updated

Sync invoices

Prerequisite

The user must have connected their Accounting Software with Adfin to enable this flow.

This is completed in their Adfin Console


Get catalog items

Before creating invoices that can flow through to your Accounting system, you first must get the product IDs, and TaxRateIds for those items.

Image description

Get Tax Rate Catalog

Get tax Rates
  curl -i -X GET \
  'https://api.adfin.com/api/catalogs/tax_rates \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Returns a list of tax rate IDs. These are the IDs that can be matched to the accounting system.

Get Product Catalog

Get products
  curl -i -X GET \
  'https://api.adfin.com/api/catalogs/items \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Returns a list of product IDs. These are the IDs that can be matched to the accounting system.

Create invoice

After getting the catalog items, you can now use them to create an invoice that will flow through to your accounting software.

Image description

Using Line Items, Tax Rates, and Account Codes

In order to enable this flow in a clean way for the client, consider the following points.

  1. Line items should be created with Adfin UUIDs
  2. Tax Rate IDs should be set with Adfin UUIDs
  3. AccountCodeIds should be set with Adfin UUIDs

Example request

  ... // partial example of how to codify items, products, and tax rates
  "items": [
    [
      {
        "description": "Monthly Pro Plan Subscription",
        "unitAmount": 5000,
        "quantity": 1,
        "taxRateId": "06085f94-14cf-4e3e-b62d-2ec37812bb09", //Tax Rate ID 1
        "accountCodeId": "5dee7017-bb98-4b65-9014-320120be808e ", //Account Code Id
        "productId": "5dee7017-bb98-4b65-9014-320120be808e" //Product ID for subscription
      },
      {
        "description": "Additional Fee",
        "unitAmount": 2000,
        "quantity": 1,
        "taxRateId": "c83c61e6-05fd-494c-a2f6-ba819701769f", //Tax Rate ID 2 for the additional fee
        "accountCodeId": "5dee7017-bb98-4b65-9014-320120be808e", // Same account code for the sales invoice
        "productId": "10f55620-b220-46b3-b99d-510747026b6d" //Product ID for Additional Fee
      }
    ]
  ],
... // rest of request

External Data responses

...
"externalData": [
  {
    "id": "cac7645b-9d6e-46d5-b026-1e154c8c85f6",
    "description": "Monthly invoice",
    "quantity": 1,
    "unitAmount": 200,
    "taxRate": 0,
    "taxAmount": 0,
      "totalAmount": 150,
      "taxDetails": {
        "id": "c12a773d-1f12-4340-bec6-59e59833ff38",
          "rate": 0
        },
      "accountDetails": {
        "id": "6c0e3f13-95f5-4140-9d83-0bf345bf2371 ",
        "code": "01",
      },
      "productDetails": {
        "id": "6c0e3f13-95f5-4140-9d83-0bf345bf2371 ",
        "code": "Product Code 123"
      }
...