MerchantDetection
Diagnostic signals showing how the scanner identified the store: which merchant detectors fired and what each one matched. Returned by ScanResults.merchantDetection(), which is null when no detector produced a signal. Added in 2.5.0.
These are diagnostics, not results, and a normal integration does not need them: the merchant the scan settled on is ScanResults.merchantName(), and its banner is ScanResults.retailerId(). Use them to trace a misidentified store back to the detector responsible. Only detectors that ran populate their values; everything else is null.
Banner IDs are the values of Retailer.bannerId(); convert one with Retailer.fromBannerId().
Package: com.microblink.core
Declaration
class MerchantDetection : Parcelable
Quick Reference
Properties
| Property | Description |
|---|---|
phoneMatch() | Merchant matched from the receipt's phone number |
phoneBanner() | Banner ID of the phone match |
phoneNumber() | Phone number read from the receipt |
phoneMatchSource() | Where the phone match was found |
phoneMatch2() | Secondary phone match (not populated on Android) |
phoneBanner2() | Banner ID of the secondary phone match (not populated on Android) |
logoMatch() | Merchant matched from the store logo |
logoBanner() | Banner ID of the logo match |
logoConfidence() | Confidence of the logo match |
merchantFromGoogle() | Whether the logo match came from Google |
logoMatchUserImage() | Whether the logo match came from a captured image |
textMatch() | Merchant matched from the receipt text |
textBanner() | Banner ID of the text match |
textConfidence() | Confidence of the text match |
taxIdMatch() | Merchant matched from the tax ID |
taxIdBanner() | Banner ID of the tax ID match |
csvMatch() | Merchant matched in the SDK's merchant list |
csvBanner() | Banner ID of the merchant-list match |
productSearchMatch() | Merchant inferred from the receipt's products |
productSearchBanner() | Banner ID of the product search match |
longtailMatch() | Merchant found by the long-tail merchant lookup |
tripResolutionMatch() | Merchant returned by Trip Resolution |
tripResolutionBanner() | Banner ID returned by Trip Resolution |
Methods
| Method | Description |
|---|---|
newBuilder() | Creates a MerchantDetection.Builder |
Properties
Phone
phoneMatch()
fun phoneMatch(): String?
Merchant name matched by looking up the phone number printed on the receipt.
phoneBanner()
fun phoneBanner(): Int?
Banner ID of the phone match.
phoneNumber()
fun phoneNumber(): String?
The store phone number read from the receipt. Present whenever one was read, even if no phone match was found.
phoneMatchSource()
fun phoneMatchSource(): String?
Where the phone match was found: "Yelp" or "DB" (the merchant database).
phoneMatch2()
fun phoneMatch2(): String?
Secondary phone match. Kept for parity with iOS and the Activation SDK; not populated on Android.
phoneBanner2()
fun phoneBanner2(): Int?
Banner ID of the secondary phone match. Kept for parity with iOS and the Activation SDK; not populated on Android.
Logo
logoMatch()
fun logoMatch(): String?
Merchant name matched by on-device logo detection. Requires ScanOptions.detectLogo().
logoBanner()
fun logoBanner(): Int?
Banner ID of the logo match.
logoConfidence()
fun logoConfidence(): Float?
Confidence the logo detector reported for the match.
merchantFromGoogle()
fun merchantFromGoogle(): Boolean?
Whether the logo match came from Google's image recognition. Always false on Android when a logo match exists, because logo detection runs on the device.
logoMatchUserImage()
fun logoMatchUserImage(): Boolean?
Whether the logo match was made on an image captured during the scan. Always true on Android when a logo match exists.
Text
textMatch()
fun textMatch(): String?
Merchant name matched by sending the receipt's recognized text to the merchant lookup service.
textBanner()
fun textBanner(): Int?
Banner ID of the text match.
textConfidence()
fun textConfidence(): Float?
Confidence the merchant lookup service reported for the text match.
Tax ID
taxIdMatch()
fun taxIdMatch(): String?
Merchant name matched from the tax ID printed on the receipt (for example, an Australian Business Number).
taxIdBanner()
fun taxIdBanner(): Int?
Banner ID of the tax ID match, when known.
CSV (Merchant List)
csvMatch()
fun csvMatch(): String?
Merchant name found by looking up the merchant name read from the receipt in the SDK's merchant list.
csvBanner()
fun csvBanner(): Int?
Banner ID of the merchant-list match.
Product Search
productSearchMatch()
fun productSearchMatch(): String?
Merchant name inferred by searching for the receipt's line items.
productSearchBanner()
fun productSearchBanner(): Int?
Banner ID of the product search match.
Long Tail
longtailMatch()
fun longtailMatch(): String?
Merchant name found by the long-tail merchant lookup, which searches with the merchant name guess, store address and phone number read from the receipt. US only, and run only when no other detector settled on a merchant. Has no banner ID.
Trip Resolution
tripResolutionMatch()
fun tripResolutionMatch(): String?
Merchant name returned by the Trip Resolution API, the last-resort lookup the SDK calls when a scan ends with no merchant. null unless the call returned a name within its 4-second limit.
tripResolutionBanner()
fun tripResolutionBanner(): Int?
Banner ID returned by the Trip Resolution API. It is reported here even when the Retailer enum has no constant for it.
Methods
newBuilder()
// Java static method (companion object)
fun newBuilder(): MerchantDetection.Builder
Returns a MerchantDetection.Builder with one nullable setter per property (for example .phoneMatch(String?), .logoConfidence(Float?)) and build(). Useful for test fixtures; the class has no public constructor.