essai background
POSSIBLE ERROR RETURNS
Invalid JSON
Description: Received data do not seem to be in JSON or JSON input is invalid.
Return code: 400
Response example:
{
"document_reference" : null,
"document_name" : null,
"layout_reference" : null,
"file_destination" : null,
"generation_status" : "FAILURE",
"generation_error_code" : "INVALID_JSON",
"generation_error_message" : "Provided data must be in valid JSON format.",
"generation_error_details" : null
}
Missing or invalid required field
Description: Some required information is missing or invalid in the provided data.
Return code: 400
Response example:
{
"document_reference" : "INV_2081200001",
"document_name" : "inv@l!d nam€",
"layout_reference" : "My_Layout_8",
"file_destination" : "binary",
"generation_status" : "FAILURE",
"generation_error_code" : "MISSING_OR_INVALID_REQUIRED_FIELD",
"generation_error_message" : "Missing or invalid required field",
"generation_error_details" : [
{
"property" : "document_name",
"message" : "Does not match the regex pattern ^{a-zA-Z0-9._-}*$"
},
{
"property" : "document.information",
"message" : "The property information is required"
}
]
}
The “generation_error_details” field will vary depending on the provided data. Its format will remain the same and consists of an array of the errors in received data.
Each array item is an object containing two properties represented by the following keys:
- “property”: name of the field containing errors
- “message”: error message associated with the field
List of possible errors:
File download not enabled
Description: The “File download” option has not been enabled on your account.
Return code: 403
Response example:
{
"document_reference" : "INV_2081200001",
"document_name" : "My_Custom_doc_name",
"layout_reference" : "My_Layout_8",
"file_destination" : "sftp",
"generation_status" : "FAILURE",
"generation_error_code" : "FILE_DOWNLOAD_NOT_ENABLED",
"generation_error_message" : "File download is not activated on your account. Please ask the HiPay team to enable it.",
"generation_error_details" : null
}
Layout not found
Description: The selected layout does not exist.
Return code: 404
Response example:
{
"document_reference" : "INV_2081200001",
"document_name" : "My_Custom_doc_name",
"layout_reference" : "My_Layout_100",
"file_destination" : "sftp",
"generation_status" : "FAILURE",
"generation_error_code" : "LAYOUT_NOT_FOUND",
"generation_error_message" : "Layout not found",
"generation_error_details" : "Layout reference \"My_Layout_100\" does not exist"
}
Invalid document data
Description: Document data contain errors.
Return code: 400
Response example:
{
"document_reference" : "INV_2081200001",
"document_name" : "My_Custom_doc_name",
"layout_reference" : "My_Layout_8",
"file_destination" : "sftp",
"generation_status" : "FAILURE",
"generation_error_code" : "INVALID_DOCUMENT_DATA",
"generation_error_message" : "Invalid document data",
"generation_error_details" : [
{
"property" : "items.values",
"message" : "NULL value found, but an array is required"
},
{
"property" : "",
"message" : "The property customs_azerty is not defined and the definition does not allow additional properties"
},
{
"property" : "order_information.reference_value_1",
"message" : "The property reference_value_1 is required"
},
{
"property" : "summary",
"message" : "The property summary is required"
}
]
}
The “generation_error_details” field will vary depending on the provided data. Its format will remain the same and consists of an array of the errors in received data.
Each array item is an object containing two properties represented by the following keys:
- “property”: name of the field containing errors
- “message”: error message associated with the field
List of possible errors:
List of possible errors for an invoice layout:
Document with same data already exists
Description: A document with the same data already exists.
Return code: 409
Response example:
{
"document_reference" : "INV_2081200001",
"document_name" : "My_Custom_doc_name",
"layout_reference" : "My_Layout_8",
"file_destination" : "binary",
"generation_status" : "FAILURE",
"generation_error_code" : "DOCUMENT_WITH_SAME_DATA_ALREADY_EXISTS",
"generation_error_message" : "Document with same data already exists",
"generation_error_details" : null
}
REQUIRED INFORMATION FOR INVOICE LAYOUT
To generate invoices through our API, merchants must provide us beforehand with:
- a document (e.g.: in Excel or Word format) indicating all the fields (with their exact name and position in the layout) they want to appear on API generated invoices;
- an actual invoice, with all the formatting to replicate on API generated invoices.