Recognize a Photo of a Receipt & Extract Key Business Information with JavaScript

If you’re building an app for expensing receipts, we have an API that can help. Our Receipt Recognition OCR API is designed to pull key information from a photograph of a receipt including timestamps, business names, business websites, address, phone numbers, and more. It’s simple to use — just follow instructions below to structure your API call in JavaScript, and register for a free account on our website to get a Cloudmersive API key.

Let’s begin with installing the jQuery library for this API. Run the following command:

bower install jquery

Next, let’s include the code for the API call. As you can see, there are several parameters to satisfy, including adding the image file itself, the option to engage handwriting recognition (by specifying ‘EnableHandwriting’), and the option to specify language:

var form = new FormData();
form.append("imageFile", fileInput.files[0], "file");
var settings = {
"url": "https://api.cloudmersive.com/ocr/photo/recognize/receipt",
"method": "POST",
"timeout": 0,
"headers": {
"recognitionMode": "<string>",
"language": "<string>",
"preprocessing": "<string>",
"Content-Type": "multipart/form-data",
"Apikey": "YOUR-API-KEY-HERE"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});

After that, you’re good to go. Give it a whirl!

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Reusable User-defined Date & Time Functions in JavaScript

Sorting in Golang

A Practical Understanding Of ES6 Async/Await And Promise Function

Frontend Weekly Digest #224 (23–29 August 2021)

Appartement Neuf RDJ A AZLA BEACH

test this medium post

Getting started with React Native: A designer’s experience

Drawing on Knowledge

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

OCR Preprocessing API: Get the Angle of the Page, Document or Receipt for an OCR Conversion

OJET — Proxy to Backend REST API Server

What to do when PostgreSQL does not use your index

ODOO Remote Procedure Calling