Open2b versione 7.2

invoices

invoices.find

Returns the invoices that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.invoices.find', request, function(response) { … });
HTTP POST
/api/v8/commerce.invoices.find
{
  "conditions" : { // returns the invoices with this …
    "ids" : [ 662705500, … ], // … with these identifiers - int(1…)
    "type" : "Proforma", // … of this invoice type, can be "Proforma", "Invoice", "ShippingInvoice" or "CreditNote"
    "status" : [ "Sent", … ], // … with any of these statuses, a status can be "Open", "Sent", "Disputed", "Archived" or "Cancelled" - string
    "isPaidFor" : true, // … paid for or not paid for - bool
    "fromNumber" : "7890", // … a number greater or equal to this - string(1…32)
    "toNumber" : "8152", // … a number lower or equal to this - string(1…32)
    "fromCreationTime" : "2020-09-01 12:00:00", // … creation time equal or next to this - datetime
    "toCreationTime" : "2020-12-31 23:59:59", // … creation time equal or previous to this - datetime
    "fromUpdateTime" : "2020-09-01 12:00:00", // … last update time equal or next to this - datetime
    "toUpdateTime" : "2020-12-31 23:59:59", // … last update time equal or previous to this - datetime
    "fromIssueDate" : "2020-05-01 12:00:00", // … issue date equal or next to this - date
    "toIssueDate" : "2020-12-31 23:59:59", // … issue date equal or previous to this - date
    "fromDueDate" : "2020-05-01 12:00:00", // … due date equal or next to this - date
    "toDueDate" : "2020-12-31 23:59:59", // … due date equal or previous to this - date
    "customer" : 4907, // … of this customer (id) - int(1…)
    "address" : "Baker Street", // … this exact phrase in the address - string(1…30)
    "labels" : [ 1, 3, … ], // … with these labels - int(1…64)
    "after" : 662705500 // … with identifier after this value - int(0…)
  },
  "fields" : [ "number", "status", … ], // returns only these fields - string
  "order" : [ "number" ], // sort order of returned invoices, can contain "id", "-id", "type", "-type", "number", "-number",
                          // "status", "-status", "creationTime", "-creationTime", "updateTime", "-updateTime",
                          // "issueDate", "-issueDate", "dueDate", "-dueDate", "total", "-total", "taxedTotal",
                          // "-taxedTotal", "isPaidFor", "-isPaidFor", "customerName" and "-customerName" - string
  "limit" : 10, // maximum number of invoices to return - int(1…)
  "first" : 0 // index of the first invoice to return - int(0…)
}

Response

{
  "status" : "ok",
  "invoices" : [ {
    "id" : 662705500, // identifier - int(1…)
    "type" : "Proforma", // type, can be "Proforma", "Invoice", "ShippingInvoice" or "CreditNote"
    "number" : "2020/3918", // number - string(0…32)
    "status" : "Open", // status, can be "Open", "Sent", "Disputed", "Archived" or "Cancelled" - string
    "creationTime" : "2020-08-28 09:41:47", // creation time - datetime
    "updateTime" : "2020-09-01 16:08:11", // last update time - datetime
    "issueDate" : "2020-08-28", // issue date - date
    "dueDate" : "2020-09-28", // due date (can be null) - date
    "shippingTime" : "2020-09-02 10:22:54", // shipping time, only for shipping invoices (can be null) - datetime
    "referenceType" : "Order", // reference type, can be "Order", "Quote", "Invoice", "ShippingInvoice", "Proforma", "CreditNote", "Receipt" or "PackingSlip" (can be null) - string
    "referenceNumber" : "2020/30991", // reference number - string(0…32)
    "token" : "ef8e4e68d0713f374bdb0ed727d18560", // token - string(32)
    "customer" : 37091, // customer (id) (can be null) - int(1…)
    "rounding" : { // rounding
      "mode" : "HalfUp", // mode, can be "Down", "HalfDown", "HalfEven" or "HalfUp" - string
      "rule" : "PerItem" // rule, can be "PerItem", "PerLine" or "Total" - string
    },
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "taxArea" : 7, // tax area (id) used for tax calculations - int(1…)
    "items" : [ { // items
      "id" : 2716394, // identifier - int(1…)
      "sku" : "A927TP", // SKU - string(0…40)
      "name" : "Shirt", // name - string(0…255)
      "quantity" : 3.00, // quantity - decimal[8,2](0…)
      "price" : 56.330, // price (excluded taxes) - decimal[10,3]
      "totalPrice" : 168.99, // total price (excluded taxes) - decimal[10,2]
      "weight" : 0.450, // weight - decimal[8,3](0…)
      "taxCode" : "VAT", // tax code - string(0…32)
      "taxRate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxAmount" : 112.66, // tax amount - decimal[10,2]
      "requests" : "..." // customer requests - string(0…255)
    }, … ],
    "prediscountSubtotal" : 69.54, // prediscount subtotal - decimal[10,2]
    "taxedPrediscountSubtotal" : 110.89, // prediscount subtotal, taxes included - decimal[10,2]
    "discounts" : [ { // discounts, up to 5
      "type" : "PercentOff", // type, can be "PercentOff" or "AmountOff" - string
      "value" : 20.000 // value, must be greater than zero and if percentage must be less than or equal to 100 - decimal[8,3](0…)
    }, {
      "type" : "AmountOff",
      "value" : 10.450
    }, … ],
    "discountsIncludeTaxes" : false, // indicates if discounts include taxes - bool
    "subtotal" : 69.54, // subtotal - decimal[10,2]
    "taxedSubtotal" : 110.89, // subtotal, taxes included - decimal[10,2]
    "shippingMethod" : { // shipping method (can be null)
      "id" : 14, // identifier (can be null) - int(1…)
      "name" : "FedEx", // name - string(0…80)
      "cost" : 8.572, // cost - decimal[8,3](0…)
      "taxCode" : "TVA", // tax code - string(0…32)
      "taxRate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxAmount" : 1.63 // amount of tax - decimal[8,2](0…)
    },
    "paymentMethod" : { // payment method (can be null)
      "id" : 3, // identifier (can be null) - int(1…)
      "name" : "Credit Card", // name - string(1…80)
      "cost" : 1.200, // cost (fee) - decimal[8,3](0…)
      "taxCode" : "TVA", // tax code - string(0…32)
      "taxRate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxAmount" : 0.23 // amount of tax - decimal[8,2](0…)
    },
    "taxes" : [ { // taxes for each tax class
      "code" : "VAT", // tax class code - string(0…32)
      "name" : "Generic", // tax class name - string(0…60)
      "rate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxableTotal" : 89.23, // taxable total - decimal[10,2]
      "amount" : 31.25 // tax amount - decimal[10,2]
    }, … ],
    "taxAmount" : 31.25, // tax amount - decimal[10,2]
    "total" : 89.23, // total - decimal[10,2]
    "taxedTotal" : 120.48, // total, taxes included - decimal[10,2]
    "isPaidFor" : true, // indicates if it is paid for - bool
    "quantity" : 7.00, // total number of items quantity - decimal[10,2](0…)
    "weight" : 1.351, // total weight of items - decimal[8,3](0…)
    "customerName" : "Investigations Inc", // customer's name ( last and first name or company name ) - string(1…100)
    "invoiceRecipient" : "AB7TR6K", // electronic invoice recipient code or PEC email address - string(0…256)
    "billingAddress" : { // billing address
      "firstName" : "Sherlock", // first name - string(1…25)
      "lastName" : "Holmes", // last name - string(1…25)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(3…120)
    },
    "shippingAddress" : { // shipping address (can be null)
      "name" : "John", // recipient name - string(1…100)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // province, state or county - string(0…3)
      "country" : "GB" // country (ISO code) - string(2)
    },
    "sellerAddress" : { // seller address
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(0…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(0…25)
      "postalCode" : "NW1 6XE", // postal code - string(0…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(0…2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(0…120)
    },
    "numberOfPackages" : 1, // number of packages, only for shipping invoices (can be null) - int(1…100)
    "porto" : "Franco", // porto, only for shipping invoices, can be "Franco" or "Assegnato" (can be null) - string
    "goodsAppearance" : "Five cardboard boxes", // goods appearance, only for shipping invoices (can be null) - string(0…255)
    "trackingNumber" : "rt-5pl7f-fg", // tracking number, only for shipping invoices (can be null) - string(0…64)
    "transportReason" : "Order shipment", // transport reason, only for shipping invoices (can be null) - string(0…255)
    "terms" : "" // terms and conditions - string(0…65535)
  }, … ]
}

invoices.get

Returns an invoice given its identifier.

Request

Admin SDK
Admin.api('commerce.invoices.get', request, function(response) { … });
HTTP POST
/api/v8/commerce.invoices.get
{
  "id" : 662705500, // identifier (required) - int(1…)
  "fields" : [ "number", "status", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "invoice" : { // (can be null)
    "id" : 662705500, // identifier - int(1…)
    "type" : "Proforma", // type, can be "Proforma", "Invoice", "ShippingInvoice" or "CreditNote"
    "number" : "2020/3918", // number - string(0…32)
    "status" : "Open", // status, can be "Open", "Sent", "Disputed", "Archived" or "Cancelled" - string
    "creationTime" : "2020-08-28 09:41:47", // creation time - datetime
    "updateTime" : "2020-09-01 16:08:11", // last update time - datetime
    "issueDate" : "2020-08-28", // issue date - date
    "dueDate" : "2020-09-28", // due date (can be null) - date
    "shippingTime" : "2020-09-02 10:22:54", // shipping time, only for shipping invoices (can be null) - datetime
    "referenceType" : "Order", // reference type, can be "Order", "Quote", "Invoice", "ShippingInvoice", "Proforma", "CreditNote", "Receipt" or "PackingSlip" (can be null) - string
    "referenceNumber" : "2020/30991", // reference number - string(0…32)
    "token" : "ef8e4e68d0713f374bdb0ed727d18560", // token - string(32)
    "customer" : 37091, // customer (id) (can be null) - int(1…)
    "rounding" : { // rounding
      "mode" : "HalfUp", // mode, can be "Down", "HalfDown", "HalfEven" or "HalfUp" - string
      "rule" : "PerItem" // rule, can be "PerItem", "PerLine" or "Total" - string
    },
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "taxArea" : 7, // tax area (id) used for tax calculations - int(1…)
    "items" : [ { // items
      "id" : 2716394, // identifier - int(1…)
      "sku" : "A927TP", // SKU - string(0…40)
      "name" : "Shirt", // name - string(0…255)
      "quantity" : 3.00, // quantity - decimal[8,2](0…)
      "price" : 56.330, // price (excluded taxes) - decimal[10,3]
      "totalPrice" : 168.99, // total price (excluded taxes) - decimal[10,2]
      "weight" : 0.450, // weight - decimal[8,3](0…)
      "taxCode" : "VAT", // tax code - string(0…32)
      "taxRate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxAmount" : 112.66, // tax amount - decimal[10,2]
      "requests" : "..." // customer requests - string(0…255)
    }, … ],
    "prediscountSubtotal" : 69.54, // prediscount subtotal - decimal[10,2]
    "taxedPrediscountSubtotal" : 110.89, // prediscount subtotal, taxes included - decimal[10,2]
    "discounts" : [ { // discounts, up to 5
      "type" : "PercentOff", // type, can be "PercentOff" or "AmountOff" - string
      "value" : 20.000 // value, must be greater than zero and if percentage must be less than or equal to 100 - decimal[8,3](0…)
    }, {
      "type" : "AmountOff",
      "value" : 10.450
    }, … ],
    "discountsIncludeTaxes" : false, // indicates if discounts include taxes - bool
    "subtotal" : 69.54, // subtotal - decimal[10,2]
    "taxedSubtotal" : 110.89, // subtotal, taxes included - decimal[10,2]
    "shippingMethod" : { // shipping method (can be null)
      "id" : 14, // identifier (can be null) - int(1…)
      "name" : "FedEx", // name - string(0…80)
      "cost" : 8.572, // cost - decimal[8,3](0…)
      "taxCode" : "TVA", // tax code - string(0…32)
      "taxRate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxAmount" : 1.63 // amount of tax - decimal[8,2](0…)
    },
    "paymentMethod" : { // payment method (can be null)
      "id" : 3, // identifier (can be null) - int(1…)
      "name" : "Credit Card", // name - string(1…80)
      "cost" : 1.200, // cost (fee) - decimal[8,3](0…)
      "taxCode" : "TVA", // tax code - string(0…32)
      "taxRate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxAmount" : 0.23 // amount of tax - decimal[8,2](0…)
    },
    "taxes" : [ { // taxes for each tax class
      "code" : "VAT", // tax class code - string(0…32)
      "name" : "Generic", // tax class name - string(0…60)
      "rate" : 19.00, // percent tax - decimal[4,2](0…)
      "taxableTotal" : 89.23, // taxable total - decimal[10,2]
      "amount" : 31.25 // tax amount - decimal[10,2]
    }, … ],
    "taxAmount" : 31.25, // tax amount - decimal[10,2]
    "total" : 89.23, // total - decimal[10,2]
    "taxedTotal" : 120.48, // total, taxes included - decimal[10,2]
    "isPaidFor" : true, // indicates if it is paid for - bool
    "quantity" : 7.00, // total number of items quantity - decimal[10,2](0…)
    "weight" : 1.351, // total weight of items - decimal[8,3](0…)
    "customerName" : "Investigations Inc", // customer's name ( last and first name or company name ) - string(1…100)
    "invoiceRecipient" : "AB7TR6K", // electronic invoice recipient code or PEC email address - string(0…256)
    "billingAddress" : { // billing address
      "firstName" : "Sherlock", // first name - string(1…25)
      "lastName" : "Holmes", // last name - string(1…25)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(3…120)
    },
    "shippingAddress" : { // shipping address (can be null)
      "name" : "John", // recipient name - string(1…100)
      "street1" : "221b Baker Street", // street, first row - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(1…25)
      "postalCode" : "NW1 6XE", // postal code - string(1…20)
      "stateProv" : "LND", // province, state or county - string(0…3)
      "country" : "GB" // country (ISO code) - string(2)
    },
    "sellerAddress" : { // seller address
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(0…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(0…25)
      "postalCode" : "NW1 6XE", // postal code - string(0…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(0…2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(0…120)
    },
    "numberOfPackages" : 1, // number of packages, only for shipping invoices (can be null) - int(1…100)
    "porto" : "Franco", // porto, only for shipping invoices, can be "Franco" or "Assegnato" (can be null) - string
    "goodsAppearance" : "Five cardboard boxes", // goods appearance, only for shipping invoices (can be null) - string(0…255)
    "trackingNumber" : "rt-5pl7f-fg", // tracking number, only for shipping invoices (can be null) - string(0…64)
    "transportReason" : "Order shipment", // transport reason, only for shipping invoices (can be null) - string(0…255)
    "terms" : "" // terms and conditions - string(0…65535)
  }
}

invoices.count

Number of invoices that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.invoices.find', request, function(response) { … });
HTTP POST
/api/v8/commerce.invoices.find
{
  "conditions" : { // counts the invoices …
    "ids" : [ 662705500, … ], // … with these identifiers - int(1…)
    "type" : "Proforma", // … of this invoice type, can be "Proforma", "Invoice", "ShippingInvoice" or "CreditNote"
    "status" : [ "Sent", … ], // … with any of these statuses, a status can be "Open", "Sent", "Disputed", "Archived" or "Cancelled" - string
    "isPaidFor" : true, // … paid for or not paid for - bool
    "fromNumber" : "7890", // … a number greater or equal to this - string(1…32)
    "toNumber" : "8152", // … a number lower or equal to this - string(1…32)
    "fromCreationTime" : "2020-09-01 12:00:00", // … creation time equal or next to this - datetime
    "toCreationTime" : "2020-12-31 23:59:59", // … creation time equal or previous to this - datetime
    "fromUpdateTime" : "2020-09-01 12:00:00", // … last update time equal or next to this - datetime
    "toUpdateTime" : "2020-12-31 23:59:59", // … last update time equal or previous to this - datetime
    "fromIssueDate" : "2020-05-01 12:00:00", // … issue date equal or next to this - date
    "toIssueDate" : "2020-12-31 23:59:59", // … issue date equal or previous to this - date
    "fromDueDate" : "2020-05-01 12:00:00", // … due date equal or next to this - date
    "toDueDate" : "2020-12-31 23:59:59", // … due date equal or previous to this - date
    "customer" : 4907, // … of this customer (id) - int(1…)
    "address" : "Baker Street", // … this exact phrase in the address - string(1…30)
    "labels" : [ 1, 3, … ], // … with these labels - int(1…64)
    "after" : 662705500 // … with identifier after this value - int(0…)
  }
}

Response

{
  "status" : "ok",
  "count" : 547 // number of invoices - int(0…)
}

invoices.create

Creates a new invoice.

Request

Admin SDK
Admin.api('commerce.invoices.create', request, function(response) { … });
HTTP POST
/api/v8/commerce.invoices.create
{
  "invoice" : { // invoice to create (required)
    "type" : "ShippingInvoice", // type, can be "Proforma", "Invoice", "ShippingInvoice" or "CreditNote" - string
    "number" : "2020/3918", // number - string(0…32)
    "status" : "Open", // status, can be "Open", "Sent", "Disputed", "Archived" or "Cancelled" - string
    "creationTime" : "2020-08-28 09:41:47", // creation time, if empty it takes the current time - datetime
    "issueDate" : "2020-08-28", // issue date - date
    "dueDate" : "2020-09-28", // due date (can be null) - date
    "shippingTime" : "2020-09-02 10:22:54", // shipping time, only for shipping invoices (can be null) - datetime
    "referenceType" : "Order", // reference type, can be "Order", "Quote", "Invoice", "ShippingInvoice", "Proforma", "CreditNote", "Receipt" or "PackingSlip" (can be null) - string
    "referenceNumber" : "2020/30991", // reference number - string(0…32)
    "customer" : 37091, // customer (id) (can be null) - int(1…)
    "rounding" : { // rounding
      "mode" : "HalfUp", // mode, can be "Down", "HalfDown", "HalfEven" or "HalfUp" - string
      "rule" : "PerItem" // rule, can be "PerItem", "PerLine" or "Total" - string
    },
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "items" : [ { // items
      "sku" : "A927TP", // SKU - string(0…32)
      "name" : "Shirt", // name - string(0…255)
      "quantity" : 3.00, // quantity - decimal[8,2](0…)
      "price" : 56.330, // price (excluded taxes) - decimal[10,3]
      "weight" : 0.450, // weight - decimal[8,3](0…)
      "taxClass" : 2, // tax class (id) (can be null) - int(1…)
      "requests" : "…" // customer requests - string(0…255)
    }, … ],
    "discounts" : [ { // discounts, up to 5
      "type" : "PercentOff", // type, can be "PercentOff" or "AmountOff" - string
      "value" : 20.000 // value, must be greater than zero and if percentage must be less than or equal to 100 - decimal[8,3](0…)
    }, {
      "type" : "AmountOff",
      "value" : 10.450
    }, … ],
    "discountsIncludeTaxes" : false, // indicates if discounts include taxes - bool
    "shippingMethod" : 3, // shipping method (id) (can be null) - int(1…)
    "shippingCost" : 8.572, // shipping cost, if null it is calculated by the shipping method (can be null) - decimal[8,3](0…)
    "paymentMethod" : 8, // payment method (id) (can be null) - int(1…)
    "paymentCost" : 1.200, // payment cost, if null it is calculated by the payment method (can be null) - decimal[8,3](0…)
    "isPaidFor" : true, // indicates if it is paid for - bool
    "invoiceRecipient" : "AB7TR6K", // electronic invoice recipient code or PEC email address - string(0…256)
    "billingAddress" : { // billing address (required)
      "firstName" : "Sherlock", // first name (required) - string(1…25)
      "lastName" : "Holmes", // last name (required) - string(1…25)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
      "street1" : "221b Baker Street", // street, first row (required) - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city  (required) - string(1…25)
      "postalCode" : "NW1 6XE", // postal code (required) - string(1…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) (required) - string(2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address (required) - string(3…120)
    },
    "shippingAddress" : { // shipping address (can be null)
      "name" : "John", // recipient name (required) - string(1…100)
      "street1" : "221b Baker Street", // street, first row (required) - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city (required) - string(1…25)
      "postalCode" : "NW1 6XE", // postal code (required) - string(1…20)
      "stateProv" : "LND", // province, state or county - string(0…3)
      "country" : "GB" // country (ISO code) (required) - string(2)
    },
    "sellerAddress" : { // seller address
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(0…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(0…25)
      "postalCode" : "NW1 6XE", // postal code - string(0…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(0…2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(0…120)
    },
    "numberOfPackages" : 1, // number of packages, only for shipping invoices (can be null) - int(1…100)
    "porto" : "Franco", // porto, only for shipping invoices, can be "Franco" or "Assegnato" (can be null) - string
    "goodsAppearance" : "Five cardboard boxes", // goods appearance, only for shipping invoices (can be null) - string(0…255)
    "trackingNumber" : "rt-5pl7f-fg", // tracking number, only for shipping invoices (can be null) - string(0…64)
    "transportReason" : "Order shipment", // transport reason, only for shipping invoices (can be null) - string(0…255)
    "terms" : "" // terms and conditions - string(0…65535)
  }
}

Response

{
  "status" : "ok",
  "id" : 662705500 // identifier of the new invoice - int(1…)
}

Errors

Field Type Description
country InvalidValue No tax areas for country '<country>'
country MissingCombination Country of seller address is required if 'stateProv' is provided
creationTime InvalidValue Creation time '<creationTime>' is in the future
customer NotFound Customer <customer> does not exist
discounts InvalidValue Amount off discount can not be applied to a zero subtotal
discounts Malformed There can be no more than 5 discounts
goodsAppearance InvalidValue Goods appearance can be defined only for shipping invoices
goodsAppearance InvalidValue Goods appearance must be defined for shipping invoices
invoiceRecipient Malformed '<invoiceRecipient>' is not a recipient code or email address
locale Malformed '<locale>' is not a valid locale code
numberOfPackages InvalidValue Number of packages can be defined only for shipping invoices
numberOfPackages InvalidValue Number of packages must be defined for shipping invoices
paymentMethod InvalidCombination Payment method is required if payment cost is provided
paymentMethod InvalidValue No payment methods can be used if total is zero or negative
paymentMethod InvalidValue Payment method <paymentMethod> can not be used in combination with shipping method <shippingMethod>
paymentMethod InvalidValue Payment method <paymentMethod> is not suitable for this invoice
paymentMethod NotFound Payment method <paymentMethod> does not exist
porto InvalidValue Porto can be defined only for shipping invoices
shippingMethod InvalidCombination Shipping method is required if shipping cost is provided
shippingMethod InvalidValue Shipping method <shippingMethod> is not suitable for this invoice
shippingMethod MissingCombination Shipping method is required because the payment method is on delivery
shippingMethod NotFound Shipping method <shippingMethod> does not exist
shippingTime InvalidValue Shipping time can be defined only for shipping invoices
shippingTime InvalidValue Shipping time must be defined for shipping invoices
taxClass NotFound Tax class <taxClass> does not exist
trackingNumber InvalidValue Tracking number can be defined only for type "ShippingInvoice"
trackingNumber InvalidValue Tracking number must be defined for type "ShippingInvoice"
transportReason InvalidValue Transport reason can be defined only for type "ShippingInvoice"
transportReason InvalidValue Transport reason must be defined for type "ShippingInvoice"

Notes

  • Per i nuovi ordini non indicare number e creationTime, prenderanno automaticamente il prossimo numero d'ordine e la data corrente.
  • Non indicare rounding se si vuole utilizzare l'impostazione globale.

invoices.update

Updates an invoice. Any fields left out of the request will remain unchanged.

Request

Admin SDK
Admin.api('commerce.invoices.update', request, function(response) { … });
HTTP POST
/api/v8/commerce.invoices.update
{
  "id" : 662705500, // identifier of the invoice to update (required) - int(1…)
  "invoice" : { // invoice's fields to update (required)
    "number" : "2020/3918", // number - string(0…32)
    "status" : "Open", // status, can be "Open", "Sent", "Disputed", "Archived" or "Cancelled" - string
    "creationTime" : "2020-08-28 13:13:47", // creation time - datetime
    "issueDate" : "2020-08-28", // issue date - date
    "dueDate" : "2020-09-28", // due date (can be null) - date
    "shippingTime" : "2020-09-02 10:22:54", // shipping time, only for shipping invoices (can be null) - datetime
    "referenceType" : "Order", // reference type, can be "Order", "Quote", "Invoice", "ShippingInvoice", "Proforma", "CreditNote", "Receipt" or "PackingSlip" (can be null) - string
    "referenceNumber" : "2020/30991", // reference number - string(0…32)
    "customer" : 37091, // customer (id) (can be null) - int(1…)
    "rounding" : { // rounding
      "mode" : "HalfUp", // mode, can be "Down", "HalfDown", "HalfEven" or "HalfUp" - string
      "rule" : "PerItem" // rule, can be "PerItem", "PerLine" or "Total" - string
    },
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "items" : [ { // items
      "id" : 2716394, // identifier, if it is not left out an item with this identifier must exist - int(1…)
      "sku" : "A927TP", // SKU - string(0…32)
      "name" : "Shirt", // name - string(0…255)
      "quantity" : 3.00, // quantity - decimal[8,2](0…)
      "price" : 56.330, // price (excluded taxes) - decimal[10,3]
      "weight" : 0.450, // weight - decimal[8,3](0…)
      "taxClass" : 2, // tax class (id) (can be null) - int(1…)
      "requests" : "…" // customer requests - string(0…255)
    }, … ],
    "discounts" : [ { // discounts, up to 5
      "type" : "PercentOff", // type, can be "PercentOff" or "AmountOff" - string
      "value" : 20.000 // value, must be greater than zero and if percentage must be less than or equal to 100 - decimal[8,3](0…)
    }, {
      "type" : "AmountOff",
      "value" : 10.450
    }, … ],
    "discountsIncludeTaxes" : false, // indicates if discounts include taxes - bool
    "shippingMethod" : 3, // shipping method (id) (can be null) - int(1…)
    "shippingCost" : 8.572, // shipping cost, if null it is calculated by the shipping method (can be null) - decimal[8,3](0…)
    "paymentMethod" : 8, // payment method (id) (can be null) - int(1…)
    "paymentCost" : 1.200, // payment cost, if null it is calculated by the payment method (can be null) - decimal[8,3](0…)
    "isPaidFor" : true, // indicates if it is paid for - bool
    "customer" : 4907, // customer (id) that has done the invoice - int(0…)
    "invoiceRecipient" : "AB7TR6K", // electronic invoice recipient code or PEC email address - string(0…256)
    "billingAddress" : { // billing address
      "firstName" : "Sherlock", // first name (required) - string(1…25)
      "lastName" : "Holmes", // last name (required) - string(1…25)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
      "street1" : "221b Baker Street", // street, first row (required) - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city  (required) - string(1…25)
      "postalCode" : "NW1 6XE", // postal code (required) - string(1…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) (required) - string(2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address (required) - string(3…120)
    },
    "shippingAddress" : { // shipping address (can be null)
      "name" : "John", // recipient name (required) - string(1…100)
      "street1" : "221b Baker Street", // street, first row (required) - string(1…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city (required) - string(1…25)
      "postalCode" : "NW1 6XE", // postal code (required) - string(1…20)
      "stateProv" : "LND", // province, state or county - string(0…3)
      "country" : "GB" // country (ISO code) (required) - string(2)
    },
    "sellerAddress" : { // seller address
      "companyName" : "Investigations Inc", // company name - string(0…100)
      "companyCode" : "INV8403MC1", // company code number - string(0…20)
      "personalCode" : "SH239IBA", // personal code - string(0…20)
      "street1" : "221b Baker Street", // street, first row - string(0…60)
      "street2" : "", // street, second row - string(0…60)
      "city" : "London", // city - string(0…25)
      "postalCode" : "NW1 6XE", // postal code - string(0…20)
      "stateProv" : "LND", // state, province or county - string(0…3)
      "country" : "GB", // country (ISO code) - string(0…2)
      "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
      "mobileNumber" : "", // mobile number - string(0…15)
      "faxNumber" : "", // fax number - string(0…15)
      "email" : "holmes@inv-london.com" // email address - string(0…120)
    },
    "numberOfPackages" : 1, // number of packages, only for shipping invoices (can be null) - int(1…100)
    "porto" : "Franco", // porto, only for shipping invoices, can be "Franco" or "Assegnato" (can be null) - string
    "goodsAppearance" : "Five cardboard boxes", // goods appearance, only for shipping invoices (can be null) - string(0…255)
    "trackingNumber" : "rt-5pl7f-fg", // tracking number, only for shipping invoices (can be null) - string(0…64)
    "transportReason" : "Order shipment", // transport reason, only for shipping invoices (can be null) - string(0…255)
    "terms" : "" // terms and conditions - string(0…65535)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
country InvalidValue No tax areas for country '<country>'
country MissingCombination Country of seller address is required if 'stateProv' is provided
creationTime InvalidValue Creation time '<creationTime>' is in the future
customer NotFound Customer <customer> does not exist
discounts InvalidValue Amount off discount can not be applied to a zero subtotal
discounts Malformed There can be no more than 5 discounts
goodsAppearance InvalidValue Goods appearance can be defined only for shipping invoices
goodsAppearance InvalidValue Goods appearance must be defined for shipping invoices
id NotFound Invoice <id> does not exist
invoiceRecipient Malformed '<invoiceRecipient>' is not a recipient code or email address
items Malformed An item id is repeated
items NotFound Invoice <id> does not have item <id>
locale Malformed '<locale>' is not a valid locale code
numberOfPackages InvalidValue Number of packages can be defined only for shipping invoices
numberOfPackages InvalidValue Number of packages must be defined for shipping invoices
paymentCost InvalidValue Invoice <id> has not a payment method
paymentMethod InvalidValue No payment methods can be used if total is zero or negative
paymentMethod InvalidValue Payment method <paymentMethod> can not be used in combination with shipping method <shippingMethod>
paymentMethod InvalidValue Payment method <paymentMethod> is not suitable for this invoice
paymentMethod NotFound Payment method <paymentMethod> does not exist
porto InvalidValue Porto can be defined only for shipping invoices
shippingCost InvalidValue Invoice <id> has not a shipping method
shippingMethod InvalidValue Shipping method <shippingMethod> is not suitable for this invoice
shippingMethod MissingCombination Shipping method is required because the payment method is on delivery
shippingMethod NotFound Shipping method <shippingMethod> does not exist
shippingTime InvalidValue Shipping time can be defined only for shipping invoices
shippingTime InvalidValue Shipping time must be defined for shipping invoices
taxClass NotFound Tax class <taxClass> does not exist
trackingNumber InvalidValue Tracking number can be defined only for type "ShippingInvoice"
trackingNumber InvalidValue Tracking number must be defined for type "ShippingInvoice"
transportReason InvalidValue Transport reason can be defined only for type "ShippingInvoice"
transportReason InvalidValue Transport reason must be defined for type "ShippingInvoice"

invoices.delete

Deletes one or more invoices.

Request

Admin SDK
Admin.api('commerce.invoices.delete', request, function(response) { … });
HTTP POST
/api/v8/commerce.invoices.delete
{
  "ids" : [ 662705500, 550472018, … ] // identifiers of the invoices to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}