IOTPay-Android is a sdk called in merchant app to collect consumer's credit/debit card information.
For the whole business picture please refer the '2.3 Event Flow and Options'
1 Embed a credit entry GUI into a ViewGroup to collect consumer’s credit/debit card information:
card number, holder name, expiry date, CVV/CVC
2 provide add card, payment methods
(1) copy IOTPayAndroidCredit-release.aar to app/libs
(2) add followings in app/build.gradle
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
...
compile(name:'IOTPayAndroidCredit-release',ext:'aar')
...
}
Embed IOTPay credit entry GUI into a ViewGroup in your app.
IOTCardInfoView IOTCardInfoView(ViewGroup viewGroup, int creditCardStyle)
- creditCardStyle:
Triple Lines:
(int)IOTPayConstants.TripleLine.label
Single Line:
(int)IOTPayConstants.SingleLine.label
- Example:
IOTCardInfoView iotCardInfoView;
...
iotCardInfoView = IOTPayService.IOTCardInfoView(myViewGroup,(int)IOTPayConstants.TripleLine.label);
pay or add card
IOTPayService.sendRequest(String secureId, Object layoutType, IOTCardInfoView creditForm,IOTPayCallback iotPayCallback);
- layoutType:
IOTPayConfig.SimplePurchase
IOTPayConfig.AddCard
- Example:
(2.1) pay:
Make sure secureID for payment has been retrieved from context
About the secureID please refer the '4 Temporary secureID'
try{
IOTPayService.sendRequest(secureId,IOTPayConfig.SimplePurchase, iotCardInfoView,new IOTPayCallback(){
public void onResultIOTPay(String result) {
//please process result in your own way, Ex: as following;
/*
if retCode == FAIL
go to failure page with retMsg,
Ex: order payment failed, reason: ....., please retry....
else if retCode == SUCCESS
check retData.status
if status in(2,3)
go to success page,
Ex: Order payment successfull....
else
means order status is unknow, go to Order status Unknow page, and involve in
the support team for order final result.
Ex: Order is processing, please call (xxx)xxx xxx for order[xxxxxxxxx] payment result.
*/
}
});
}catch (Exception e){
//showMsg("Error:" + e.getMessage());
}
(2.2) Add card: binding the card to a consumer
Make sure secureID for payment has been retrieved from context
About the secureID please refer the '4 Temporary secureID'
try{
IOTPayService.sendRequest(secureId,IOTPayConfig.AddCard,iotCardInfoView,new IOTPayCallback(){
public void onResultIOTPay(String result) {
//please process result in your own way, ex: showMsg("Payment Result:" + result);
}
});
}catch (Exception e){
//showMsg("Error:" + e.getMessage());
}