Invoice

Create

POST

Request

This endpoint expects an object.
creatorEntityId
stringRequired
ID of entity who created this invoice.
amount
doubleOptional
Total amount of invoice in major units. If the entered amount has more decimal places than the currency supports, trailing decimals will be truncated.
approvers
list of objectsOptional
Set approvers for this invoice.
creatorUserId
stringOptional
ID of entity user who created this invoice.
currency
enumOptional
Currency code for the amount. Defaults to USD.
deductionDate
datetimeOptional
Date when funds will be deducted from payer's account.
document
stringOptional
Base64 encoded image or PDF of invoice document. PNG, JPG, and PDF are supported. 10MB max. If the invoice already has a document, this will add a new document to the invoice.
dueDate
datetimeOptional
Due date of invoice.
foreignId
stringOptional
The ID used to identify this invoice in your system. This ID must be unique within each creatorEntity in your system, e.g. two invoices with the same creatorEntity may not have the same foreign ID.
invoiceDate
datetimeOptional
Date the invoice was issued.
invoiceNumber
stringOptional
lineItems
list of objectsOptional
metadata
map from strings to stringsOptional
Metadata associated with this invoice. You can specify up to 10 keys, with key names up to 40 characters long and values up to 200 characters long.
noteToSelf
stringOptional
Note to self or memo on invoice.
payerId
stringOptional
paymentDestinationId
stringOptional
ID of payment destination for this invoice. If not provided, will attempt to use the default payment destination for the vendor when creating an invoice if a default payment destination exists for the vendor.
paymentDestinationOptions
unionOptional
Options for the payment destination. Depending on the payment destination, this may include things such as check delivery method.
paymentSourceId
stringOptional
ID of payment source for this invoice. If not provided, will attempt to use the default payment source for the payer when creating an invoice if a default payment source exists for the payer.
serviceEndDate
datetimeOptional
serviceStartDate
datetimeOptional
settlementDate
datetimeOptional
Date of funds settlement.
status
enumOptional
vendorId
stringOptional
uploadedImage
stringOptionalDeprecated
DEPRECATED. Use document field instead.

Response

This endpoint returns an object
id
string
status
enum
paymentDestinationConfirmed
boolean
True if the payment destination has been confirmed by the vendor. False if the payment destination has been set (for example, a check to an address) but has not been confirmed by the vendor.
hasDocuments
boolean
True if the invoice has documents attached.
hasSourceEmail
boolean
True if the invoice was created by an incoming email.
approvers
list of objects
approvalPolicy
list of objects
metadata
map from strings to strings
Metadata associated with this invoice.
createdAt
datetime
updatedAt
datetime
amount
doubleOptional
Total amount of invoice in major units
currency
enumOptional
Currency code for the amount. Defaults to USD.
invoiceDate
datetimeOptional
Date the invoice was issued.
deductionDate
datetimeOptional
Date when funds will be deducted from payer's account.
settlementDate
datetimeOptional
Date of funds settlement.
dueDate
datetimeOptional
Due date of invoice.
invoiceNumber
stringOptional
noteToSelf
stringOptional
serviceStartDate
datetimeOptional
serviceEndDate
datetimeOptional
payerId
stringOptional
payer
objectOptional
paymentSource
unionOptional
paymentSourceId
stringOptional
vendorId
stringOptional
vendor
objectOptional
paymentDestination
unionOptional
paymentDestinationId
stringOptional
paymentDestinationOptions
unionOptional
comments
list of objectsOptional
lineItems
list of objectsOptional
foreignId
stringOptional
The ID used to identify this invoice in your system. This ID must be unique within each creatorEntity in your system, e.g. two invoices with the same creatorEntity may not have the same foreign ID.
creatorUser
objectOptional
Entity user who created this invoice.
failureType
enumOptional
If the invoice failed to be paid, this field will be populated with the type of failure.
Allowed values: SOURCE_PAYMENT_ERRORDESTINATION_PAYMENT_ERRORREJECTED_HIGH_RISKINSUFFICIENT_FUNDSPROCESSING_ERROR
processedAt
datetimeOptional
fees
objectOptional
Fees associated with this invoice.
POST
1curl -X POST https://api.mercoa.com/invoice \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "creatorEntityId": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
6 "amount": 100,
7 "creatorUserId": "user_e24fc81c-c5ee-47e8-af42-4fe29d895506",
8 "currency": "USD",
9 "dueDate": "2021-01-31T00:00:00Z",
10 "invoiceDate": "2021-01-01T00:00:00Z",
11 "invoiceNumber": "INV-123",
12 "lineItems": [
13 {
14 "amount": 100,
15 "description": "Product A",
16 "currency": "USD",
17 "name": "Product A",
18 "quantity": 1,
19 "unitPrice": 100,
20 "serviceStartDate": "2021-01-01T00:00:00Z",
21 "serviceEndDate": "2021-01-31T00:00:00Z",
22 "metadata": {
23 "key1": "value1",
24 "key2": "value2"
25 },
26 "glAccountId": "600394"
27 }
28 ],
29 "noteToSelf": "For the month of January",
30 "payerId": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
31 "paymentDestinationId": "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18",
32 "paymentDestinationOptions": {
33 "type": "check",
34 "delivery": "MAIL"
35 },
36 "paymentSourceId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769",
37 "status": "NEW",
38 "vendorId": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"
39}'
200Successful
1{
2 "id": "inv_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9",
3 "status": "PAID",
4 "paymentDestinationConfirmed": true,
5 "hasDocuments": true,
6 "hasSourceEmail": true,
7 "approvers": [
8 {
9 "approvalPolicyId": "apvl_5ce50275-1789-42ea-bc60-bb7e6d03635c",
10 "approvalSlotId": "inap_9bb311c9-7c15-4c9e-8148-63814e0abec6",
11 "action": "APPROVE",
12 "eligibleRoles": [
13 "admin"
14 ],
15 "eligibleUserIds": [
16 "user_e24fc81c-c5ee-47e8-af42-4fe29d895506"
17 ],
18 "date": "2021-01-01T00:00:00Z",
19 "assignedUserId": "user_e24fc81c-c5ee-47e8-af42-4fe29d895506"
20 }
21 ],
22 "approvalPolicy": [
23 {
24 "id": "apvl_8545a84e-a45f-41bf-bdf1-33b42a55812c",
25 "trigger": [
26 {
27 "type": "amount",
28 "amount": 100,
29 "currency": "USD"
30 }
31 ],
32 "rule": {
33 "type": "approver",
34 "identifierList": {
35 "type": "rolesList",
36 "value": [
37 "Admin",
38 "Controller"
39 ]
40 },
41 "numApprovers": 2
42 },
43 "upstreamPolicyId": "root"
44 }
45 ],
46 "metadata": {
47 "key1": "value1",
48 "key2": "value2"
49 },
50 "createdAt": "2021-01-01T00:00:00Z",
51 "updatedAt": "2021-01-01T00:00:00Z",
52 "amount": 100,
53 "currency": "USD",
54 "invoiceDate": "2021-01-01T00:00:00Z",
55 "deductionDate": "2021-01-01T00:00:00Z",
56 "settlementDate": "2021-01-03T00:00:00Z",
57 "dueDate": "2021-01-31T00:00:00Z",
58 "invoiceNumber": "INV-123",
59 "noteToSelf": "For the month of January",
60 "serviceStartDate": "2021-01-01T00:00:00Z",
61 "serviceEndDate": "2021-01-31T00:00:00Z",
62 "payerId": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
63 "payer": {
64 "acceptedTos": true,
65 "accountType": "business",
66 "createdAt": "2024-01-01T00:00:00Z",
67 "email": "customer@acme.com",
68 "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
69 "isCustomer": true,
70 "isNetworkPayee": false,
71 "isNetworkPayor": false,
72 "isPayee": false,
73 "isPayor": true,
74 "name": "Acme Inc.",
75 "profile": {
76 "business": {
77 "legalBusinessName": "Acme Inc.",
78 "taxIDProvided": true,
79 "email": "customer@acme.com",
80 "businessType": "llc",
81 "phone": {
82 "countryCode": "1",
83 "number": "4155551234"
84 },
85 "address": {
86 "addressLine1": "123 Main St",
87 "city": "San Francisco",
88 "stateOrProvince": "CA",
89 "postalCode": "94105",
90 "addressLine2": "Unit 1",
91 "country": "US"
92 },
93 "ownersProvided": true
94 }
95 },
96 "status": "verified",
97 "updatedAt": "2024-01-02T00:00:00Z",
98 "counterpartyType": [
99 "ENTITY"
100 ],
101 "foreignId": "MY-DB-ID-12345",
102 "paymentMethods": [
103 {
104 "type": "bankAccount",
105 "accountName": "My Checking Account",
106 "accountNumber": "99988767623",
107 "accountType": "CHECKING",
108 "bankName": "Chase",
109 "createdAt": "2021-01-01T00:00:00Z",
110 "id": "pm_4794d597-70dc-4fec-b6ec-c5988e759769",
111 "isDefaultDestination": true,
112 "isDefaultSource": true,
113 "routingNumber": "12345678",
114 "status": "VERIFIED",
115 "supportedCurrencies": [
116 "USD"
117 ],
118 "updatedAt": "2021-01-01T00:00:00Z"
119 }
120 ]
121 },
122 "paymentSource": {
123 "type": "bankAccount",
124 "accountName": "My Checking Account",
125 "accountNumber": "99988767623",
126 "accountType": "CHECKING",
127 "bankName": "Chase",
128 "createdAt": "2021-01-01T00:00:00Z",
129 "id": "pm_4794d597-70dc-4fec-b6ec-c5988e759769",
130 "isDefaultDestination": true,
131 "isDefaultSource": true,
132 "routingNumber": "12345678",
133 "status": "VERIFIED",
134 "supportedCurrencies": [
135 "USD"
136 ],
137 "updatedAt": "2021-01-01T00:00:00Z"
138 },
139 "paymentSourceId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769",
140 "vendorId": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
141 "vendor": {
142 "acceptedTos": false,
143 "accountType": "business",
144 "createdAt": "2024-01-01T00:00:00Z",
145 "email": "vendor@bigboxstore.com",
146 "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
147 "isCustomer": false,
148 "isNetworkPayee": false,
149 "isNetworkPayor": false,
150 "isPayee": true,
151 "isPayor": false,
152 "name": "Big Box Store",
153 "profile": {
154 "business": {
155 "legalBusinessName": "Big Box Store",
156 "taxIDProvided": false,
157 "email": "vendor@bigboxstore.com",
158 "businessType": "publicCorporation",
159 "ownersProvided": false
160 }
161 },
162 "status": "unverified",
163 "updatedAt": "2024-01-02T00:00:00Z",
164 "counterpartyType": [
165 "ENTITY"
166 ],
167 "foreignId": "MY-DB-ID-90909",
168 "paymentMethods": [
169 {
170 "type": "bankAccount",
171 "accountName": "Vendor Checking Account",
172 "accountNumber": "55934059697648",
173 "accountType": "CHECKING",
174 "bankName": "Chase",
175 "createdAt": "2021-01-01T00:00:00Z",
176 "id": "pm_7610541f-4619-4033-8620-cfccfb811293",
177 "isDefaultDestination": true,
178 "isDefaultSource": true,
179 "routingNumber": "66554433",
180 "status": "NEW",
181 "supportedCurrencies": [
182 "USD"
183 ],
184 "updatedAt": "2021-01-01T00:00:00Z"
185 }
186 ]
187 },
188 "paymentDestination": {
189 "type": "check",
190 "addressLine1": "123 Main St",
191 "city": "New York",
192 "country": "US",
193 "createdAt": "2021-01-01T00:00:00Z",
194 "id": "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18",
195 "isDefaultDestination": true,
196 "isDefaultSource": false,
197 "payToTheOrderOf": "John Doe",
198 "postalCode": "10001",
199 "stateOrProvince": "NY",
200 "supportedCurrencies": [
201 "USD"
202 ],
203 "updatedAt": "2021-01-01T00:00:00Z",
204 "addressLine2": "Apt 1"
205 },
206 "paymentDestinationId": "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18",
207 "paymentDestinationOptions": {
208 "type": "check",
209 "delivery": "MAIL"
210 },
211 "comments": [
212 {
213 "id": "ic_b3525b66-da94-4525-9f31-426bcf657128",
214 "text": "This is an approval comment",
215 "createdAt": "2021-01-01T00:00:00Z",
216 "updatedAt": "2021-01-01T00:00:00Z",
217 "user": {
218 "id": "user_ec3aafc8-ea86-408a-a6c1-545497badbbb",
219 "roles": [
220 "admin",
221 "approver"
222 ],
223 "createdAt": "2024-01-01T00:00:00Z",
224 "updatedAt": "2024-01-01T00:00:00Z",
225 "foreignId": "MY-DB-ID-12345",
226 "email": "john.doe@acme.com",
227 "name": "John Doe"
228 },
229 "associatedApprovalAction": {
230 "userId": "user_e24fc81c-c5ee-47e8-af42-4fe29d895506",
231 "action": "APPROVE"
232 }
233 }
234 ],
235 "lineItems": [
236 {
237 "id": "inli_26672f38-eb9a-48f1-a7a0-f1b855e38cd7",
238 "currency": "USD",
239 "createdAt": "2021-01-01T00:00:00Z",
240 "updatedAt": "2021-01-01T00:00:00Z",
241 "amount": 100,
242 "description": "Product A",
243 "name": "Product A",
244 "quantity": 1,
245 "unitPrice": 100,
246 "serviceStartDate": "2021-01-01T00:00:00Z",
247 "serviceEndDate": "2021-01-31T00:00:00Z",
248 "metadata": {
249 "key1": "value1",
250 "key2": "value2"
251 },
252 "glAccountId": "600394"
253 }
254 ],
255 "foreignId": "YOUR-DATABASE-ID",
256 "creatorUser": {
257 "id": "user_ec3aafc8-ea86-408a-a6c1-545497badbbb",
258 "roles": [
259 "admin",
260 "approver"
261 ],
262 "createdAt": "2024-01-01T00:00:00Z",
263 "updatedAt": "2024-01-01T00:00:00Z",
264 "foreignId": "MY-DB-ID-12345",
265 "email": "john.doe@acme.com",
266 "name": "John Doe"
267 },
268 "processedAt": "2021-01-01T00:00:00Z"
269}