Prepare the mutation input
When creating a carrierBillingInvoice
there are several fields that are required for the invoice to be created successfully. These are listed below:
Required fields
amount
: The total amount due for the invoice.currencyCode
: The currency the amounts for the invoice are represented in.lineItems
amount
: The amount due for an invoice line. The amounts for each of thelineItems
must match theamount
for the invoice.chargeType
: This is a value that represents the type of charge for the invoice line. These will typically beSHIPPING
.trackingNumber
: The tracking number associated with the invoice line.
payorAccountNumber
: The account number of the Zonos customer you are creating the invoice for.referenceNumber
: The reference number for the invoice.
Manage invoices via the API
The following mutations can be used to create new, void pending, or query a list of invoices.
Once you have a list of all charges that need to be invoiced to a customer, use the following mutation to create that invoice.
Mutation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
mutation {
carrierBillingInvoiceCreate(
input: [
{
amount: 60
currencyCode: USD
payorAccountNumber: "123456"
referenceNumber: "13"
status: PENDING
metadata: [{ key: "testkey", value: "testvalue" }]
lineItems: [
{
amount: 30
chargeType: SHIPPING
currencyCode: USD
trackingNumber: "12345"
}
{
amount: 30
chargeType: SHIPPING
currencyCode: USD
trackingNumber: "6789"
}
]
}
]
) {
id
organizationId
amount
status
metadata {
key
value
}
lineItems {
id
description
amount
currencyCode
trackingNumber
}
}
}
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"data": {
"carrierBillingInvoiceCreate": [
{
"id": "cbi_bc4c59c1-6fed-4408-8dad-5df2fd3ad813",
"organizationId": "organization_e54e9553-4e1f-4bad-ab55-6ab53b8ba2cc",
"amount": 60,
"status": "PENDING",
"metadata": [
{
"key": "testkey",
"value": "testvalue"
}
],
"lineItems": [
{
"id": "cbi_line_item_fd0abe87-28d5-4075-b7a8-68125141ade0",
"description": "SHIPPING Charge",
"amount": 30,
"currencyCode": "USD",
"trackingNumber": "12345"
},
{
"id": "cbi_line_item_156db74c-48c6-4251-beb9-6fe10a2bd6d0",
"description": "SHIPPING Charge",
"amount": 30,
"currencyCode": "USD",
"trackingNumber": "6789"
}
]
}
]
}
}
Invoice shipping charges
Generate shipping invoices for Zonos customers.GraphQL
COMING SOON
If a customer has signed up for a shipping account that is offered through Zonos, you can create invoices for shipping charges via the API. You can aggregrate charges and create invoices on any cadence you choose. Using that information, Zonos will then invoice those customers on your behalf.