API Reference | ReDoc

Invoice Management

Product Info

The Invoice Managment API empowers retailers to generate invoices for e-commerce orders dispatched outside the API platform. It captures essential data such as customer information, delivery addresses, and order details to enable seamless tracking and efficient returns processing. By utilizing this API, retailers can enhance operational efficiency and improve the customer experience.

Business Values

  • Intelligent Invoice Grouping: - Streamline returns management by leveraging the groupId field in the Order Model to intelligently group multiple invoices associated with a single e-commerce order. This feature simplifies the processing of complex orders and improves organizational workflows.

  • Flexible Invoice Management: - Modify invoices effortlessly using the Update Invoice API, enabling seamless updates when item details are unavailable during the initial Create Invoice call.

  • Efficient Product Returns: - Facilitate a seamless and customer-friendly returns process with real-time tracking and updates. The platform ensures accurate handling of return requests, reducing processing time and enhancing overall customer satisfaction.

How does it work once I am setup as a user?

Once set up as a user, you can leverage the Invoice Management API to ingest order information for e-commerce orders dispatched outside the API platform. By integrating this functionality, you can intelligently group multiple invoices for streamlined returns management and seamlessly update invoices as new details become available. This ensures accurate tracking and efficient processing.

FAQs

  • What information is required to create an invoice?

    • groupId: The e-commerce order ID mapped to the invoice for efficient tracking and returns management.
    • orderExternalId: The retailer-specific order reference.
    • customer object: Includes customer information.
    • orderInfo object: Subset of the order data, including deliveryAddress.
    • brandExternalId: Identifies the brand associated with the invoice.
    • createdDate: The date the original order was created (in int64 format).
    • timeZone: Timezone of the order creation date."
    • storeExternalId: The ID of the store from which the order was dispatched.
  • When should I use the Update Invoice API?

    The Update Invoice API is used to modify an existing invoice when new details, such as item specifics, become available or corrections are needed. For example, you can update the itemList to include SKU details, dimensions, or images after the initial invoice creation.

  • What is the role of the customer object in the API?

    The customer object provides critical customer details, including delivery address and order information. This data ensures that invoices are correctly associated with the right customer and facilitates efficient returns management.

  • Can I update the delivery address for an existing invoice?

    Yes, the Update Invoice API allows you to modify the deliveryAddress object if changes to the customer's address or return location are required.

  • Does the API support batch updates for invoices?

    Currently, the API supports updating invoices individually using the Update Invoice API. For batch updates, separate calls for each invoice are required.

Error Codes

When the system is unable to respond to a request, be it from a malformed request, an illegal or invalid value, or other issues, the API generates an error response.

Successful response may or may not include warnings.

  1. Without warnings - Indicates the request has been processed as anticipated.
  2. With warnings - Indicates the request has been processed with potentially unanticipated results. The warning contains information in the response that should be passed to the end user.

The severity of an error may be transient or hard.

  • Transient error - Indicates an error that is temporary in nature. Such errors may be caused by response timeouts due to high server loads or scheduled maintenance in progress. The request may be issued successfully at a later time.
  • Hard error - Indicates the request has a problem that the system is not able to resolve. These errors are critical and prevent requests from processing.

/invoices

POST

Type HTTP Code Severity Description
UNAUTHORIZED 401 Hard Unauthorized: Invalid or missing authentication token
INTERNAL_SERVER_ERROR 500 Transient Internal Server Error: An unexpected error occurred while processing the request
INVALID_DATA 422 Hard Invalid data: Invoice already Exists
INVALID_DATA 400 Hard Invalid data: Please enter the phone number in E.164 format" or other invalid values in the request
GEOCODING_FAILED 422 Hard Geocoding Service for the given address failed.
TOO_MANY_REQUESTS 429 Transient Too many requests received per second.
UNMAPPED_ERROR 422 Transient Request received unidentifiable error response.

/invoices/{invoice_id}

PUT

Type HTTP Code Severity Description
UNAUTHORIZED 401 Hard Unauthorized: Invalid or missing authentication token
INTERNAL_SERVER_ERROR 500 Transient Internal Server Error: An unexpected error occurred while processing the request
NOT_FOUND 404 Hard Not Found: Invoice not found
INVALID_DATA 400 Hard Invalid data: Please enter the phone number in E.164 format" or other invalid values in the request
GEOCODING_FAILED 422 Hard Geocoding Service for the given address failed.
TOO_MANY_REQUESTS 429 Transient Too many requests received per second.
UNMAPPED_ERROR 422 Transient Request received unidentifiable error response.

Create Invoice

Use this endpoint to create an Invoice for any e-commerce order. This is essential for enabling returns management through Delivery Solutions when the order was not initially dispatched using Delivery Solutions' platform.

SecurityOAuth2ClientCredentials
Request
path Parameters
version
required
string
Default: "v1"

version

Value: "v1"
Request Body schema: application/json
required
Array of objects (Item)

Array of Items for which Invoice has been created

Array
sku
required
string <= 100 characters

An ID that identify the product/variant from the brand's catalog.

upc
string <= 100 characters

Universal Product Code for the item

category
string <= 100 characters

Category of Item

quantity
integer <int32> >= 1

Number of items of the SKU

object (Size)

Dimensions of the item.

object (Weight)

Weight of an item

price
number <double> >= 0

Retail price of the item.

salePrice
number <double> >= 0

Sale price of the item.

image
string <= 200 characters

Link to the image file of the item.

title
string <= 200 characters

Title of the item.

description
string <= 10000 characters

Description of the item.

itemAttributes
object

Custom item attributes.

tags
Array of strings [ 0 .. 20 ] items

Additional information related to the item.

groupId
string <= 100 characters

E-commerce order id should be mapped to groupId field so that tracking and returns can be utilized efficiently.

orderExternalId
required
string <= 100 characters

Order Id by which retailer can refer to the Invoice.

required
object (schemas-Customer)
email
string <= 100 characters
phone
string <= 20 characters
name
string <= 100 characters
userExternalId
string <= 100 characters
required
object (OrderInfo)

Subset of Order Object to control the rules.

tips
integer >= 0

Optional tips for the order.

type
string

Type of the order e.g. shipping, delivery, pickup.

amount
integer <int32> >= 0

Any delivery or shipping charges applicable for the invoice.

orderValue
required
number <float> >= 0

Cost of the order in major units. e.g. $10.43.

object

Key Value Pairs of attributes that you want to associate with the order.

property name*
additional property
any
status
required
string <= 100 characters

Status associated with the Order if any.

actualDeliveryTime
string <date-time>

The time at which the order was delivered.

object (components-schemas-Address)

Address of the location

street1
required
string <= 100 characters

Address Line 1 (Street Number and Street Name)

street2
string <= 100 characters

Address Line 2 (not to be used for apartment / suite

apartmentNumber
string <= 50 characters

Apartment / Suite

city
required
string <= 100 characters

City

state
required
string <= 100 characters

State

postalCode
required
string <= 20 characters

Postal code or zip.

countryCode
string
Default: "US"

2-letter country code in ISO 3166-1 alpha-2 format. If not provided defaults to 'US'.

Enum: "US" "CA" "GB" "AU" "IE"
latitude
number <double>

Latitude coordinates of the address

longitude
number <double>

Longitude coordinates of the address

brandExternalId
required
string <= 100 characters

Brand External Id for which the Invoice is being created.

createdDate
required
integer <int64>

The date at which the invoice was created.

timeZone
required
string

The timezone in which the invoice was created.

locationExternalId
string

location External Id from where the Order was dispatched.

Responses
201

Request was successful

400

Bad Request

401

Unauthorized

422

Processing failed as request contains invalid data

500

Internal server error

post/returns/{version}/invoices
Request samples
application/json
{
  • "itemList": [],
  • "groupId": "GAKunalA0089",
  • "orderExternalId": "AKunalA0089",
  • "customer": {
    },
  • "orderInfo": {
    },
  • "deliveryAddress": {
    },
  • "brandExternalId": "kunal",
  • "timeZone": "America/Los_Angeles",
  • "createdDate": 1707356123000
}
Response samples
application/json
{
  • "id": "656eb9dd180d13598624a50b",
  • "groupId": "GAKunalA0089",
  • "tenantId": "kunal",
  • "orderExternalId": "AKunalA0089",
  • "deliveryAddress": {
    },
  • "customer": {
    },
  • "brandExternalId": "kunal",
  • "locationExternalId": "location001",
  • "timeZone": "America/Los_Angeles",
  • "createdAt": "2024-07-23T10:34:01.695Z",
  • "createdDate": 1709231400000,
  • "itemList": [],
  • "orderInfo": {
    },
}

Update Invoice

Use this API to update an Invoice by specifying the Invoice ID.

SecurityOAuth2ClientCredentials
Request
path Parameters
version
required
string
Default: "v1"

version

Value: "v1"
invoice_id
required
string

Invoice Id (_id) created during the Create Invoice API

Request Body schema: application/json
Array of objects (Item)

Array of Items for which Invoice has been created

Array
sku
required
string <= 100 characters

An ID that identify the product/variant from the brand's catalog.

upc
string <= 100 characters

Universal Product Code for the item

category
string <= 100 characters

Category of Item

quantity
integer <int32> >= 1

Number of items of the SKU

object (Size)

Dimensions of the item.

object (Weight)

Weight of an item

price
number <double> >= 0

Retail price of the item.

salePrice
number <double> >= 0

Sale price of the item.

image
string <= 200 characters

Link to the image file of the item.

title
string <= 200 characters

Title of the item.

description
string <= 10000 characters

Description of the item.

itemAttributes
object

Custom item attributes.

tags
Array of strings [ 0 .. 20 ] items

Additional information related to the item.

groupId
string <= 100 characters

E-commerce order id should be mapped to groupId field so that tracking and returns can be utilized efficiently.

orderExternalId
string <= 100 characters

Order Id by which retailer can refer to the Invoice's order.

object (schemas-Customer)
email
string <= 100 characters
phone
string <= 20 characters
name
string <= 100 characters
userExternalId
string <= 100 characters
object (OrderInfo)

Subset of Order Object to control the rules.

tips
integer >= 0

Optional tips for the order.

type
string

Type of the order e.g. shipping, delivery, pickup.

amount
integer <int32> >= 0

Any delivery or shipping charges applicable for the invoice.

orderValue
required
number <float> >= 0

Cost of the order in major units. e.g. $10.43.

object

Key Value Pairs of attributes that you want to associate with the order.

property name*
additional property
any
status
required
string <= 100 characters

Status associated with the Order if any.

actualDeliveryTime
string <date-time>

The time at which the order was delivered.

object (components-schemas-Address)

Address of the location

street1
required
string <= 100 characters

Address Line 1 (Street Number and Street Name)

street2
string <= 100 characters

Address Line 2 (not to be used for apartment / suite

apartmentNumber
string <= 50 characters

Apartment / Suite

city
required
string <= 100 characters

City

state
required
string <= 100 characters

State

postalCode
required
string <= 20 characters

Postal code or zip.

countryCode
string
Default: "US"

2-letter country code in ISO 3166-1 alpha-2 format. If not provided defaults to 'US'.

Enum: "US" "CA" "GB" "AU" "IE"
latitude
number <double>

Latitude coordinates of the address

longitude
number <double>

Longitude coordinates of the address

brandExternalId
string <= 100 characters

Brand External Id for which the Invoice is being created.

createdDate
integer <int64>

The date at which the invoice was created.

timeZone
string

The timezone in which the invoice was created.

locationExternalId
string

location External Id from where the Order was dispatched.

Responses
200

Request was successful

400

Bad Request

401

Unauthorized

404

Resource was not found

422

Bad Request

500

Internal server error

put/returns/{version}/invoices/{invoice_id}
Request samples
application/json
{
  • "itemList": [],
  • "groupId": "GAKunalA0089",
  • "orderExternalId": "AKunalA0089",
  • "customer": {
    },
  • "orderInfo": {
    },
  • "deliveryAddress": {
    },
  • "brandExternalId": "kunal",
  • "timeZone": "America/Los_Angeles",
  • "createdDate": 1707356123000
}
Response samples
application/json
{
  • "groupId": "GAKunalA0089",
  • "tenantId": "kunal",
  • "orderExternalId": "AKunalA0089",
  • "deliveryAddress": {
    },
  • "customer": {
    },
  • "brandExternalId": "kunal",
  • "locationExternalId": "location001",
  • "timeZone": "America/Los_Angeles",
  • "createdAt": "2024-07-23T10:34:01.695Z",
  • "createdDate": 1709231400000,
  • "itemList": [],
  • "orderInfo": {
    },
  • "id": "63ea84197afb7569bf4bc6eb"
}