Bukti Pembayaran (Receipt)
Bukti Pembayaran (Receipt).
Receipt Object
- Name
status
- Type
- string
- Description
Enum code indicating the status of the reading result.
SUCCESS
NO_FILE
FILE_INVALID_FORMAT
FAILED
- Name
reason
- Type
- string
- Description
A human-readable message providing more details about the reading result.
- Name
read
- Type
- object
- Description
Contains the extracted information for each field in the Receipt. Each fields has
value
(The reading),value_original
,page_index
,polygon
(coordinates of the value: top-left, top-right, bottom-right, bottom-left),confidence
(in percentage), andconfidence_text
.- Name
merchant_name
- Type
- string
- Description
The name of the merchant (seller).
- Name
merchant_address
- Type
- string
- Description
The address of the merchant.
- Name
merchant_place
- Type
- string
- Description
The specified place of the merchant (other than address).
- Name
merchant_phone_number
- Type
- string
- Description
The phone number of the merchant stated in the receipt.
- Name
receipt_number
- Type
- string
- Description
A unique identifier assigned to a receipt transaction or purchase made within a business establishment.
- Name
receipt_order
- Type
- string
- Description
Provides the information about the order of the receipt created.
- Name
receipt_date
- Type
- string
- Description
The date of the transaction in the receipt.
- Name
receipt_time
- Type
- string
- Description
The time of the transaction in the receipt.
- Name
items
- Type
- array of object
- Description
Information for each item bought
- Name
item_name
- Type
- string
- Description
Each name of the item bought
- Name
item_quantity
- Type
- number
- Description
Each quantity of the item bought
- Name
item_quantity_unit
- Type
- string
- Description
The unit of the quantity stated in the receipt.
- Name
item_each_price
- Type
- number
- Description
The price of each item before multiplied by quantity.
- Name
item_total_price
- Type
- number
- Description
The subtotal price of each item multiplied by quantity
- Name
item_product_code
- Type
- string
- Description
The product code of each item
- Name
sub_total_amount
- Type
- number
- Description
The subtotal price amount before tax, discount, and/or service charge.
- Name
tax_amount
- Type
- number
- Description
The tax price amount of the receipt.
- Name
service_charge_amount
- Type
- number
- Description
The service charge price amount of the receipt.
- Name
discount_amount
- Type
- number
- Description
The discount price amount of the receipt.
- Name
tip_amount
- Type
- number
- Description
The tip amount of the receipt.
- Name
total_amount
- Type
- number
- Description
The total price amount to be paid after adding or deducing the tax, service charge, and/or discount.
- Name
currency
- Type
- string
- Description
The currency that the customer used to pay in the receipt.
- Name
payment_method
- Type
- string
- Description
The payment method that the customer used in the receipt.
- Name
payment_product
- Type
- string
- Description
The payment product that the customer used to pay in the receipt.
- Name
cc_last_4_digit
- Type
- string
- Description
Final four numbers of a credit card's numerical sequence.
- Name
receipt_status
- Type
- string
- Description
The information in which specifies the payment status of the receipt
Read Receipt
Detects a valid Receipt image and returns the information as text.
Required parameter
- Name
image
- Type
- file (.png, .jpg, .jpeg, .tiff, .pdf)
- Description
The image file for the Receipt.
Sample Request
1
2
3
4
5
import { Vision } from '@glair/vision';
const vision = new Vision({ apiKey: 'api-key', username: 'username', password: 'password' });
await vision.ocr.receipt({ image: '/path/to/image/Receipt.jpg' });
Sample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{
"status": "SUCCESS",
"reason": "File Successfully Read",
"read": {
"merchant_name": {
"value": "Häagen-Dazs",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 97,
"confidence_text": 97
},
"merchant_address": {
"value": "Jakarta",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 95,
"confidence_text": 95
},
"merchant_place": {
"value": "Mall Of Indonesia",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 97,
"confidence_text": 97
},
"merchant_phone_number": {
"value": "0811111111",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"receipt_number": {
"value": "ssmoi202109080036",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"receipt_order": {
"value": "0111",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"receipt_date": {
"value": "2021-09-08",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"receipt_time": {
"value": "18:24:00",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"items": [
{
"item_name": {
"value": "Pint Cookies & Cream",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98,
"confidence_text": 98
},
"item_quantity": {
"value": 1,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"item_quantity_unit": {
"value": "gram",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98,
"confidence_text": 98
},
"item_each_price": {
"value": 200000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98,
"confidence_text": 98
},
"item_total_price": {
"value": 200000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"item_product_code": {
"value": "P81J12",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98.7,
"confidence_text": 98.7
}
}
],
"sub_total_amount": {
"value": 200000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"tax_amount": {
"value": 20000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"service_charge_amount": {
"value": 0,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 97,
"confidence_text": 97
},
"discount_amount": {
"value": 0,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 97,
"confidence_text": 97
},
"tip_amount": {
"value": 4000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 97,
"confidence_text": 97
},
"total_amount": {
"value": 224000,
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 98,
"confidence_text": 98
},
"currency": {
"value": "idr",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"payment_method": {
"value": "E-wallet",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"payment_product": {
"value": "gopay",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"cc_last_4_digit": {
"value": "",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
},
"receipt_status": {
"value": "PAID",
"page_index": 0,
"polygon": [[0, 0], [1, 0], [1, 1], [0, 1]],
"confidence": 99,
"confidence_text": 99
}
}
}
Request ID
An associated request identifier is generated for every request made to this endpoint.
This value can be found in the response headers under Request-Id
Responses
Various responses for this endpoint, in addition to general responses specified in Errors.
200 - OK
Request with readable Receipt image
Response
1
2
3
4
5
{
"status": "SUCCESS",
"reason": "File Successfully Read",
//...,
}
// TODO: no "Request with non Receipt File"?
400 - Bad Request
Request without form-data image
Response
1
2
3
4
5
{
"status": "NO_FILE",
"reason": "No file in request body",
//...,
}
415 - Unsupported Media Type
Request with non-image file format
Response
1
2
3
4
5
{
"status": "FILE_INVALID_FORMAT",
"reason": "Failed to process invalid file format. Please upload the correct file format",
//...,
}