A lightweight library provides UI widgets to display payment code in mobile applications. The dimension of the payment code is optimal and scanner-friendly.
Objective
To make sure that the scanner can easily read the payment code and let mobile users make payment successfully
Supported standard
Alipay CGCP (Contactless Gateway Code Protocol)
How to use
Installation
// Add the dependency in your build.gradle
dependencies {
...
implementation 'com.alipay.iap:payment-code-widget:1.0.0'
}
Please note that theBarcodeView automatically resizes the height if the given layout height is less than the recommended size (i.e., less than 10mm), and the width of the barcode (including left and right quiet zones) is capped at 65mm.
Adaptive Barcode Display in action
The width of the Payment code is capped within 65mm even though the width of the view is > 65mm
The height of the Payment code is capped within 10mm OR 15% of the length of the central barcode even though the height of the view is > 10mm
The width of the Payment code is capped within 65mm even though the width of the view is > 65mm
The height of the Payment code maintains at 10mm even though the height of the view is < 10mm
The width of the Payment code is adjusted to cope with view if the width of the view is < 65mm
The height of the Payment code is capped within 10mm OR 15% of the length of the central barcode even though the height of the view is > 10mm
payment-code-widget
A lightweight library provides UI widgets to display payment code in mobile applications. The dimension of the payment code is optimal and scanner-friendly.
Objective
To make sure that the scanner can easily read the payment code and let mobile users make payment successfully
Supported standard
How to use
Installation
BarcodeView
Use the BarcodeView in the layout xml file.
Get the instance of the
BarcodeViewand usesetCodemethod to pass in the payment codePlease note that the
BarcodeViewautomatically resizes the height if the given layout height is less than the recommended size (i.e., less than 10mm), and the width of the barcode (including left and right quiet zones) is capped at 65mm.Adaptive Barcode Display in action
Dependencies
Appendix
Alipay CGCP Adaptive Barcode display