‚Äč

Cloud OCR SDK Documentation

processReceipt Method

Important: the technology fully supports US receipts, other countries are currently supported in beta mode.

The method allows you to recognize the image of a receipt. The method loads the image, creates a processing task for the image with the specified parameters, and passes the task for processing.

[POST] http(s)://cloud.ocrsdk.com/processReceipt

The image file is transmitted in the request body. See the list of supported input formats.

The result is returned in XML format. The elements and attributes of the resulting file are described in Output XML with Receipt Data.

For details on task cost please see billing terms.

For a step-by-step guide, see How to Recognize Receipts. The best practices can be found at ABBYY Technology Portal.

Parameters

ParameterIs requiredDefault valueDescription
country No "usa"

Specifies the country where the receipt was printed. This parameter can contain several names of countries separated with commas, for example "taiwan,china". The following values are supported:

  • uk
  • usa
  • australia
  • canada
  • japan
  • germany
  • italy
  • france
  • brazil
  • russia
  • china
  • korea
  • netherlands
  • spain
  • singapore
  • taiwan

Important! The technology fully supports US receipts, other countries are currently supported in beta mode.

imageSource No "auto"

Specifies the source of the image. It can be either a scanned image, or a photograph created with a digital camera. Special preprocessing operations can be performed with the image depending on the selected source. For example, the system can automatically correct distorted text lines, poor focus and lighting on photos.

The value of this parameter can be one of the following:

  • auto
    The image source is detected automatically.
  • photo
  • scanner
correctOrientation No "true" Specifies whether the orientation of the image should be automatically detected and corrected. It can have one of the following values:
  • true
    The page orientation is automatically detected, and if it differs from normal the image is rotated.
  • false
    The page orientation detection and correction is not performed.
correctSkew No "true" Specifies whether the skew of the image should be automatically detected and corrected. It can have either true or false value.
xml:writeExtendedCharacterInfo No "false" Specifies whether the additional information on the recognized characters (e.g. whether the character is recognized uncertainly) should be written to an output file in XML format. The parameter can have one of the following values:
  • true
  • false
description No "" Contains the description of the processing task. Must contain no more than 255 characters.
pdfPassword No "" Contains a password for accessing password-protected images in PDF format.

Status codes and response format

General status codes and response format of the method are described in HTTP Status Codes and Response Formats.

The following status codes can be returned when this method is called:

CodeDescription
200 Successful method call.
450 Incorrect parameters have been passed. One of the following errors occurred:
  • Image file has not been specified.
  • Incorrect recognition language has been specified.
  • Incorrect export format has been specified.
  • Task description length exceeds 255 characters.
  • Incorrect password for accessing password-protected image file has been specified.
  • Exceeded quota to add images. This error is returned if the number of images you have uploaded exceeds the number of images you can process with the credits available on your account plus some threshold. You can resolve this issue by topping up your account or by removing the tasks which have been submitted but have not been processed.
550 An internal program error occurred while processing the image.
551 An error occurred on the server side:
  • The format of the image file passed for processing is not supported.
  • The PDF file passed for processing has restrictions on creating raster images.

Output file format

The result of processing is returned in an XML file of the following format:

<?xml version="1.0" encoding="UTF-8"?>
<receipts count="1" xmlns="http://www.abbyy.com/ReceiptCaptureSDK_xml/ReceiptCapture-1.0.xsd">
 <receipt currency="USD">
<date>
   <normalizedValue>2011-04-30</normalizedValue>
   <recognizedValue>
    <text>04/30/2011</text>
   </recognizedValue>
  </date>
<total>
   <normalizedValue>54.26</normalizedValue>
   <recognizedValue>
    <text>$54.26</text>
   </recognizedValue>
  </total>
</receipt>
</receipts>

See the XSD schema of an XML file.

Receipt languages

You do not need to set the recognition languages for receipt recognition; they will be selected automatically on the basis of the countries you specify. See below the list of languages corresponding to countries.

CountryLanguages
United Kingdom English
USA English
Japan Japanese; English
Germany German
Italy Italian; English
France French
Brazil Portuguese (Brazil); English
Russia Russian
China Chinese Simplified
Korea Korean; English
Spain Spanish; English
Taiwan Chinese Traditional
Netherlands Dutch

Note that the receipt in one of these languages, but printed in some other country, is not guaranteed to be recognized correctly.