question

kiml avatar image
kiml asked kiml commented

Receipt Barcode Value

We're trying to scan the Receipt Barcode value to lookup the Order. The value that's returned doesn't match Order ID or Payment ID. We thought there was something wrong with the Clover Mobile's Scanner but it works fine when we scan the Receipt Barcode from within the Refund app, the Order to be refunded comes up which matches the Receipt.

Can someone tell us what the value from the Receipt Barcode represents?

barcode scanner
3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Can you post the text of the barcode?

0 Likes 0 ·
kiml avatar image kiml Jeffrey Blattman ♦♦ commented ·

Hi Jeffrey,

Here is a scan from a test Receipt Barcode:

IaGbGLl

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ kiml commented ·

Yes that's the "base 32 to base 64 cropped" format.

0 Likes 0 ·
Jeffrey Blattman avatar image
Jeffrey Blattman answered kiml commented
I'm guessing it's "base 32 to base 64 cropped" format. But you can post the barcode text to confirm that. Basically this converts our base 32 ID to base 64 which makes it shorter. The reason is that on Clover's smaller receipt width (384 pixels) encoding the base 32 number results in a barcode that's too dense to scan in most cases.

Unfortunately, and incorrectly, we don't expose the code to convert between these two formats. I'm going to paste it below, and file a bug to expose this in the public SDK.

https://pastebin.com/HRpZ083w
See base32ToBase64Cropped() and safeBase64toBase32().

4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kiml avatar image kiml commented ·
Thank You Jeffrey. We will test this right away. You're a big help!
0 Likes 0 ·
kiml avatar image kiml commented ·
Ok, I can take the Payment ID and encode it into the coded string (i.e. 46GSP65S8ZHSC to IaGbGLl) but I can't decode the coded string back into the Payment ID (i.e. IaGbGLl to 46GSP65S8ZHSC). I'm no guru at Base64. Can someone help with this please?

0 Likes 0 ·
kiml avatar image kiml kiml commented ·

I can convert the coded string to the partial Payment ID (46GSP65S) I guess this will have to do.

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ kiml commented ·

Yes you are right. Not really useful. I've noted this in the internal issue I filed.

0 Likes 0 ·
Bryanne Vega avatar image
Bryanne Vega answered kiml commented
Why don't you try this?

private BroadcastReceiver barcodeReceiver = new BroadcastReceiver() {
                
@Overridepublic void onReceive(Context context, Intent intent) {
BarcodeResult result = new BarcodeResult(intent); if (result.isBarcodeAction()) {

}
}
};
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

Did I miss something? That just returns the raw data from the barcode, which is base 64 cropped, not the order / payment UUID.

0 Likes 0 ·
kiml avatar image kiml Jeffrey Blattman ♦♦ commented ·

Yes, I am already getting the Barcode data, I just need to decrypt it.

0 Likes 0 ·

Welcome to the
Clover Developer Community