Skip to main content

Coupon

Describes one coupon or discount applied on a receipt. Returned by ScanResults.coupons().

Package: com.microblink.core

Declaration

class Coupon : Parcelable

Constructors:

Coupon(
couponType: CouponType?,
amount: FloatType?,
sku: StringType?,
description: StringType?
) // relatedProductIndex = -1
Coupon(
couponType: CouponType?,
amount: FloatType?,
sku: StringType?,
description: StringType?,
relatedProductIndex: Int
)

Quick Reference​

Properties​

PropertyDescription
type()The type of coupon
amount()The discount amount
sku()SKU associated with the coupon
description()Coupon description text
relatedProductIndex()Index of the product this coupon applies to

Methods​

MethodDescription
typeToString()Returns the coupon type's enum name

Properties​

type()​

fun type(): CouponType?

The type of coupon. CouponType (com.microblink.core) values:

ValueMeaning
UNKNOWNType could not be determined
STOREStore coupon
MFGRManufacturer coupon

amount()​

fun amount(): FloatType?

The discount amount. See FloatType.


sku()​

fun sku(): StringType?

SKU associated with the coupon, if applicable.


description()​

fun description(): StringType?

Coupon description text as printed on the receipt.


relatedProductIndex()​

fun relatedProductIndex(): Int

Zero-based index into ScanResults.products() for the product this coupon applies to.

Default: -1 (the coupon is not linked to a product)


Methods​

typeToString()​

fun typeToString(): String?

Returns the name of the coupon's CouponType ("UNKNOWN", "STORE" or "MFGR"), or null if type() is null.