Receipt Upload Endpoint

Overview

The Receipt Upload API allows members to upload their shopping receipts to claim offers listed under the Magic Receipts program. The API processes the uploaded receipt image, evaluates the eligibility for cashback, and returns the status of each claimed offer.

HTTP Request

curl \
-X POST https://receipts.bitlabs.ai/?cmd=mp-mr-api-upload-receipt&offerIDs=191405%2C143787&merchantID=7 \
-H "Authorization: Bearer <token>"

Request Parameters

NameTypeDescription
merchantIDintegerThe ID of the merchant where the purchase was made (optional).
offerIDsinteger[]An array of offer IDs that the member wants to claim.
receiptstringThe text representation of the receipt, if applicable. Defaults to empty.

Form Data Parameters

NameTypeDescription
img0binaryThe binary data of the receipt image.
imgName0stringThe file name of the receipt image.
image-20240209-230706.png

Main Response

NameTypeDescription
statusintegerThe HTTP status code of the response.
dataobjectThe main data object containing the details of the processed receipt.

Data Object Fields

NameTypeDescription
awardPendingobjectContains information about the offers that are now in an award pending state, i.e. they will be awarded in a couple of days unless CS rejects them.
confirmedobjectContains information about the offers that were automatically awarded
confirmedAndAwardPendingobjectContains both offers there were confirmed + award pending
manualReviewobjectContains information about offers that require manual review.

If an offer was rejected but it's eligible for manual review it will appear here. There's a request to request manual review and you would pull the eligible list from this object
rejectedobjectContains information about any offers that were rejected during processing.
pendingobjectContains information about offers that were automatically send to manual review. Sometimes this happens if you receipt was flagged for fraud. This offer will be manually approved / denied
barcodeScanEligibleDeviceCodesarrayAn array of device codes that are eligible for barcode scanning.
barcodeScanEnabledbooleanIndicates if barcode scanning is enabled for the receipt upload.

Rejected and Manual Review Objects

NameTypeDescription
offersarrayAn array of offers with their respective processing status.
awardBonusesarrayAny bonus awards applicable to the receipt.
unusedLineItemsarrayLine items on the receipt that were not used for any offers.
totalAwardCashbackstringThe total cashback amount awarded for the receipt.
totalAwardstringThe total award points (SB) earned for the receipt.

Offers Array Object

NameTypeDescription
maxLinesForManualReviewintegerThe maximum number of lines allowed for manual review.
offerIDintegerThe ID of the offer.
imageUrlstringThe URL of the image related to the offer.
pendingDaysintegerThe number of days the offer is pending for.
uploadOfferIDintegerThe ID of the uploaded offer.
statestringThe processing state of the offer (e.g., "rejected").
awardstringThe award points (SB) for the offer.
awardCashbackstringThe cashback amount for the offer.
surveyUrlstringThe URL to a survey related to the offer, if applicable.
shortErrorStrstringA short description of any error encountered.
errorStrstringA full description of the error.
errorCodeintegerA code representing the error encountered.
isBarcodeScanEligiblebooleanIndicates if the offer is eligible for barcode scanning.
offerTitlestringThe title of the offer.
addedToListbooleanIndicates if the offer was added to the user's list.
isUnselectedOfferbooleanIndicates if the offer was not originally selected by the user

Unused Line Items Object Fields

NameTypeDescription
receiptLineIDintegerThe unique identifier for the line item on the receipt.
rsdstringThe recognized shopping description or item name extracted from the receipt.
pricedecimalThe price of the item as captured from the receipt.

Error Handling

  • The method includes comprehensive error handling, providing clear error messages and codes for various failure scenarios such as invalid merchant ID, image count, offer IDs, receipt data, and upload progress state.
  • It also ensures that if a receipt upload is already in progress, it will not start another, preserving the integrity of the member's upload queue.

Sample Receipt Upload Request Display:

On the main screen there is a Submit Receipt button that allows the member to start the upload process

image-20240209-214506.png

Clicking on that button makes a call to the merchants api above to retrieve all the merchants that a member could choose they shopped at for their receipt.

image-20240209-214701.png

after selecting a merchant and clicking Continue a call is made to the offers-short api above with sortType=0 and merchantID=?? whatever the id of the merchant is, that will return to you all the offers relevant for this merchant that the member could upload for.

image-20240209-215142.png

choose which offers are on your receipt and how many of them you bought for offers that have multiple goals (buying options) attached to them, i.e. buy 1 get this amount, buy 2 get this award.

image-20240209-215426.png

After clicking Continue you’re taken to this screen that allows you to upload a file which is a picture of your receipt.

image-20240209-215454.png

A member can attach multiple pictures to capture the entire receipt if it’s long

image-20240209-215630.png

Then when clicking Submit Receipt we make the upload-receipt call to the api to do the validation, while we are validating we have an upload screen.

image-20240209-215731.png

Depending on the result from the upload we display accordingly

image-20240209-215841.png image-20240209-215920.png

there can be multiple reasons the offers were rejected, as can be seen here 3 different reasons: date, matching, duplicate

image-20240209-220026.png

From there you can click Contact Customer Support to request manual review (see above API doc), or click Review Your Receipt Photos and either resubmit the same photo or choose different ones.