Accounts Payable Automation
Use Case Overview
Key Model(s) and Fields | Supported Applications |
---|---|
Bills billNumber vendorId memo phoneNumbers balance | NetSuite, QuickBooks, Microsoft Dynamics Business Central |
Vendors vendorName taxNumber addresses | NetSuite, QuickBooks, Microsoft Dynamics Business Central |
Payments totalAmount vendorId trackingCategoryIds | NetSuite, QuickBooks, Microsoft Dynamics Business Central |
This is a bi-directional integration. In this example, you can GET, POST, and PUT/PATCH target resources to help users automate the AP workflow.
How to build this use case with Alloy's Unified API
1. Create a Connection
To get started, you'll need to first implement Alloy's Unified API and create a connection. A connection represents each time an end user links an app to Alloy's Unified API. See Getting Started in our Unified API Quickstart.
If you’ve already done this, read on!
2. Get a list of vendors
The first step is to get a list of vendors to associate bills with from your user’s ERP or accounting platform. You can do this with Alloy’s GET List Vendors
endpoint, with a request that looks like this:
curl --request GET \
--url 'https://embedded.runalloy.com/2024-03/one/accounting/vendors?credentialId=CREDENTIAL_ID' \
--header 'Authorization: bearer YOUR_API_KEY' \
--header 'accept: application/json'
Which will return something like the following response:
{
"vendors": [
{
"id": "00000000-0000-0000-0000-00000000",
"remoteId": "41",
"vendorName": "Hicks Hardware",
"email": null,
"taxNumber": null,
"vendorStatus": "ACTIVE",
"currency": "USD",
"companyId": null,
"addresses": [
{
"zipCode": "94303",
"street1": "42 Main St.",
"state": "CA",
"city": "Middlefield",
"addressType": "Billing",
"countrySubdivision": "CA"
}
],
"phoneNumbers": [
{
"phoneNumberType": "Primary",
"phoneNumber": "(650) 554-1973"
},
{
"phoneNumberType": "Mobile",
"phoneNumber": "(650) 445-6666"
}
],
"remoteCreatedAt": "2023-11-19T17:00:17.000Z",
"remoteUpdatedAt": "2023-11-19T17:00:17.000Z",
"remoteDeleted": false,
"createdAt": "2024-02-22T11:17:53.264Z",
"updatedAt": "2024-02-22T13:54:03.445Z"
},
{
"id": "00000001-0001-0001-0001-00000001",
"remoteId": "42",
"vendorName": "Crown Tech Solutions",
"email": "support@crown-tech.com",
"taxNumber": "CTS123456",
"vendorStatus": "ACTIVE",
"currency": "USD",
"companyId": "CTS",
"addresses": [
{
"zipCode": "10001",
"street1": "156 8th Ave",
"state": "NY",
"city": "New York",
"addressType": "Billing",
"countrySubdivision": "NY"
}
],
"phoneNumbers": [
{
"phoneNumberType": "Primary",
"phoneNumber": "(212) 123-4567"
}
],
"remoteCreatedAt": "2023-11-19T17:00:17.000Z",
"remoteUpdatedAt": "2023-11-19T17:00:17.000Z",
"remoteDeleted": false,
"createdAt": "2024-02-22T11:17:53.264Z",
"updatedAt": "2024-02-22T13:54:03.445Z"
},
{
"id": "00000002-0002-0002-0002-00000002",
"remoteId": "43",
"vendorName": "Sunnydale Supplies",
"email": "info@sunnydalesupplies.com",
"taxNumber": "SSN998877",
"vendorStatus": "PENDING",
"currency": "USD",
"companyId": "SDS",
"addresses": [
{
"zipCode": "30301",
"street1": "255 Peachtree St NE",
"state": "GA",
"city": "Atlanta",
"addressType": "Shipping",
"countrySubdivision": "GA"
}
],
"phoneNumbers": [
{
"phoneNumberType": "Primary",
"phoneNumber": "(404) 123-4567"
},
{
"phoneNumberType": "Fax",
"phoneNumber": "(404) 765-4321"
}
],
"remoteCreatedAt": "2023-11-19T17:00:17.000Z",
"remoteUpdatedAt": "2023-11-19T17:00:17.000Z",
"remoteDeleted": false,
"createdAt": "2024-02-22T11:17:53.264Z",
"updatedAt": "2024-02-22T13:54:03.445Z"
}
]
}
You’ll note that each vendor has a distinct vendorId — keep tabs on this as we’ll use it in the next step.
3. Associate Bills with Vendors
After retrieving the list of vendors, the next step is to associate these vendors with their respective bills. Using Alloy’s GET List Bills
endpoint, you can fetch bills from your user’s ERP or accounting platform and match them with the vendor information from the previous step.
Alloy’s Unified API allows you to filter by any field in our common model for Bills, such as billNumber
, totalAmount
, trackingCategories
, lineItems
, and more. To associate these bills with specific vendors, you can use the vendorId
as a filter in your API request.
Here's what that request should look like:
curl --request GET \
--url 'https://embedded.runalloy.com/2024-03/one/accounting/bills?credentialId=CREDENTIAL_ID&vendorId=[VENDOR_ID]' \
--header 'Authorization: bearer YOUR_API_KEY' \
--header 'accept: application/json'
Replace [VENDOR_ID]
with the actual vendorId
you are targeting. This method allows you to filter and retrieve bills that are specifically related to each vendor listed in your initial query.Your users can then manage and pay their bills directly in your application.
4. Write payments to your user's accounting platform
The next step is to write payments that users complete in your application to their ERP or accounting platform. You can do this using our POST Create Payment
endpoint, which will allow you to create a new record that includes vendorId
, accountId
, totalAmount
etc.
Your request will be structured like this:
curl --request POST \
--url https://embedded.runalloy.com/2024-03/one/accounting/payments?credentialId=CREDENTIAL_ID \
--header 'Authorization: bearer YOUR_API_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"customerId": "123",
"transactionDate": "2023-12-05",
"accountId": "{accountId}",
"currency": "USD",
"totalAmount": 1012.27
}
'
Alloy will then create the payment record in your user’s ERP/accounting platform and reconcile it against the original bill.
5. (Optional) Write bills created in your application to a user’s Accounting platform
Let’s say you want to dynamically create bills in your Accounting platform whenever an event occurs in your application. You can create bill records using the POST Create Bill
endpoint, which will allow you to create a bill with the corresponding billNumber
, vendorId
etc.
That request would look like this:
curl --request POST \
--url https://embedded.runalloy.com/2024-03/one/accounting/bills?credentialId=CREDENTIAL_ID \
--header 'Authorization: bearer YOUR_API_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"vendorId": "abc123",
"lineItems": [
{
"description": "bill for services rendered",
"totalAmount": "2237.91",
"accountId": "account_id"
}
],
"dueDate": "2023-12-31",
"currency": "USD"
}
Help users automate accounts payable
By automating the accounts payable workflow, you can help your users eliminate manual effort, close their books faster, and increase share of wallet as a result.