Introduction
Welcome to the QuickReceipts API — a RESTful service for making digital receipts that look like the real thing. As of now, our API is rather simple; designed to be fast, yet easy to use for developers at all levels of experience.
As we do not have any dedicated language libraries, we have provided code samples in cURL and Javascript. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
The root URL for all calls to the API is: https://api.quickreceipts.co/
Authentication
An example of included Authorization Header:
# With cURL, you can just pass the correct header with each request
curl -X POST https://api.quickreceipts.co/api/receipt/create \
-H 'Content-Type: application/json' \
-H 'Authorization: $QUICKRECEIPTS_API_KEY'
// An example of including the Auth header with a Javascript request
var request = require('request');
var options = {
method: 'POST',
json: true,
url: 'https://api.quickreceipts.co/api/receipt/create',
headers: {
'Authorization':'Bearer $QUICKRECEIPTS_API_KEY'
}
};
request(options, function (error, response, body) {
// -> response
});
Make sure to replace
$QUICKRECEIPTS_API_KEY
with your API key.
QuickReceipts uses API keys to allow access to the API. You can register a new QuickReceipts API key in our developer portal.
QuickReceipts expects the API key to be included in all API requests to the server in a header as a Bearer
token. Like the following:
Authorization: Bearer $QUICKRECEIPTS_API_KEY
Receipts
Create a Receipt
# An example of /create with two purchased items
curl -X POST https://api.quickreceipts.co/api/receipt/create \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $QUICKRECEIPTS_API_KEY' \
-H 'cache-control: no-cache' \
-d '{
"payment": {
"method": "Visa ****3491"
},
"line_items": [
{
"category":"CLOTHING",
"description":"POLO TOP M",
"sku":"3793j8903ior",
"taxable":false,
"subtotal":39.99
},
{
"category":"PHARMACY",
"description":"GENxMEDICINE",
"sku":"629hh8203dlp",
"saving":2.99,
"taxable":true,
"subtotal":10.99
}
],
"taxRate": 0.08025
}'
// An example of /create request with two purchased items
const request = require('request');
var data = {
{
payment: {
method: "Visa ****3491"
},
line_items: [
{
category:"CLOTHING",
description:"POLO TOP M",
sku:"3793j8903ior",
taxable:false,
subtotal:39.99
},
{
category:"PHARMACY",
description:"GENxMEDICINE",
sku:"629hh8203dlp",
saving:2.99,
taxable:true,
subtotal:12.99
}
],
taxRate: 0.08025
}
};
var options = {
method: 'POST',
json: true,
body: data,
url: 'https://api.quickreceipts.co/api/receipt/create',
headers: {
'Authorization':'Bearer $QUICKRECEIPTS_API_KEY'
}
};
request(options, function (error, response, body) {
// -> response
});
The above returns JSON structured like this:
{
"id": "Azs3PO735yPhqyxwHFpu",
"direct_link": "https://view.quickreceipts.co/?id=Azs3PO735yPhqyxwHFpu",
"qrcode_img": "data:image/png;base64,....encoded_content..."
}
This endpoint creates a digital receipt from a set of required and optional inputs. For the best results and formatting, be sure to have filled out your Account Details in the developer portal. We use the information provided in the developer portal to craft the header for each receipt created with your API Keys.
The QuickReceipts API is built to allow flexibility. So while some fields are required, what you submit in these fields is largely up to you; almost all String
parameters are freeform text based on how you would like things to look on your receipt.
HTTP Request
POST https://api.quickreceipts.co/api/receipt/create
Post Body
Parameter | Type | Description |
---|---|---|
payment |
Object Required |
The payment details for the transaction. |
payment.method |
String Required |
A freeform text noting details of the payment method used. e.g: "Visa 1234", "Paypal", "Wire Transfer" 24 character limit |
line_items |
Object Required |
An array of purchased items to be shown on the receipt. |
line_items.category |
String |
A broad category for the item. The API will automatically group items on the receipt that have the same Category. e.g: "Grocery", "Electronics", "Cosmetics" 16 character limit |
line_items.description |
String Required |
A short detail about this item. e.g: "Sunscreen SPF45", "Wireless Earbud", "Iceberg Lettuce" 15 character limit |
line_item.sku |
String Required |
The SKU identifier for the item. SKUs are usually internal product identifiers.13 character limit |
line_item.saving |
Number |
Any savings the customer received on this item. If an item includes this field, it will be lightly underlined on your receipt, and used to calculate a sum total of all savings for the "Savings this trip" area at the footer of each receipt. See Example9999.99 value limit |
line_item.taxable |
Boolean Required |
Determines whether an item should be taxed or not. The API will automatically calculate tax and append it to the total transaction amount based on any items marked as taxable. |
line_item.subtotal |
Number Required |
The subtotal of this item — in other words, this is the final amount the consumer will be charged for this item after any savings or promotions.9999.99 value limit |
taxRate |
Number Required |
The tax rate on any items purchased that were marked as 'taxable'. eg: 0.0825 for 8.25% tax rate.1.0 value limit |
Errors
The QuickReceipts API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is somehow incorrect, or lacks proper scope. |
403 | Forbidden -- Your request was denied for lack of permission. |
404 | Not Found -- The resource could not be found. |
406 | Not Acceptable -- You requested a format that isn't json. |
429 | Too Many Requests -- You're requesting too many receipts! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline. We are working our best to fix it. |