android端调用芝麻信用认证相关

本文详细介绍了芝麻信用认证的两种方式,重点讲解了通过WebAPI和SDK实现的认证流程,包括获取业务串号和商户号,初始化认证过程,以及认证后的回调结果处理。同时,列举了可能出现的错误代码及其含义,帮助开发者快速定位问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

芝麻信用认证的方式有两种:

在这里插入图片描述

在这里插入图片描述

芝麻信用认证官方网站

本篇文章使用的第二种方案,jar下载地址

芝麻认证逻辑大致分为三步:
1.调用芝麻验证WebAPI,获取bizNO(业务串号) 以及 merchantID(商户号);
2.使用bizNO 和merchantID 完成SDK初始化,进入认证页面;
3.用户通过认证流程后,返回商户界面,并通过回调告知结果。

public void zmCertification(String bizNo,String merchantID) {

    ZMCertification zmCertification  = ZMCertification.getInstance();
    zmCertification.setZMCertificationListener(new ZMCertificationListener() {
        @Override
        public void onFinish(boolean isCanceled, boolean isPassed, int errorCode) {
            zmCertification.setZMCertificationListener(null);
            if (isCanceled) {
                Toast.makeText(getContext(), "cancel : 芝麻验证失败,原因是:" + errorCode, Toast.LENGTH_SHORT).show();
            }else {
                if (isPassed) {
                    Toast.makeText(getContext(), "complete : 芝麻验证成功,原因是:" + errorCode, Toast.LENGTH_SHORT).show();
                }else {
                    Toast.makeText(getContext(), "complete : 芝麻验证失败,原因是:" + errorCode, Toast.LENGTH_SHORT).show();
                }
            }
        }
    });
    zmCertification.startCertification(getActivity(), bizNo, merchantID, null);
}

错误code

名称说明数值
none无 0
verification_failed用户人脸与数据库中的人脸比对分数较低1
device_not_support手机在不支持列表里2
no_permission缺少手机权限3
no_network_permission没有联网权限4
no_camera_permission没有打开相机的权限5
no_sensor_permission无法读取运动数据的权限6
face_init_fail人脸采集算法初始化失败7
network_error发生网络错误8
invalid_biz_no传入的bizNO 有误9
invalid_bundle_id此APP的bundle_id在系统的黑名单库里10
data_source_error数据源错误11
internal_error服务发生内部错误12
unmatched_merchant_idbizNO和merchantID不匹配13
version_too_oldSDK版本过旧14
userinfo_error身份证号和姓名的格式不正确15
bizno_limit_exceed身份证号和姓名在一天内使用次数过多16
wrong_system_time用户当前的设备时间与授权时间不符17
no_write_external_storage_permission没有写存储空间的权限18
upload_image_error商户上传的底库图像出现问题20
image_error_unsupported_format用户在公安部门的证件照片不够清晰22

更多详细配置可查看
在这里插入图片描述
到此芝麻验证基本就结束了!

自定义View之仿支付宝芝麻信用分仪表盘效果,喜欢的话,请给个star,谢谢.使用添加项目依赖Add it in your root build.gradle at the end of repositories: allprojects {         repositories { ... maven { url "https://jitpack.io" }         }     } Add the dependency     dependencies {             compile 'com.github.HotBitmapGG:CreditSesameRingView:V1.0.2' }新版芝麻信用分使用     // The gradient color can define your own private final int[] mColors = new int[]{             0xFFFF80AB,             0xFFFF4081,             0xFFFF5177,             0xFFFF7997              }; // Set up the need to score mLayout = (RelativeLayout) view.findViewById(R.id.layout);       mButton = (Button) view.findViewById(R.id.btn);       newCreditSesameView = (NewCreditSesameView) view.findViewById(R.id.sesame_view);       mLayout.setBackgroundColor(mColors[0]);       mButton.setOnClickListener(new View.OnClickListener()       { @Override public void onClick(View view)            {                newCreditSesameView.setSesameValues(639);                startColorChangeAnim();            }       }); // The background color gradient animation Simply illustrates the effect Can customize according to your need public void startColorChangeAnim()      { ObjectAnimator animator = ObjectAnimator.ofInt(mLayout, "backgroundColor", mColors);          animator.setDuration(3000);          animator.setEvaluator(new ArgbEvaluator());          animator.start();      }旧版芝麻信用分使用      // Set up the need to score oldCreditSesameView = (OldCreditSesameView) view.findViewById(R.id.sesame_view);       mButton = (Button) view.findViewById(R.id.btn);       mButton.setOnClickListener(new View.OnClickListener()       { @Override public void onClick(View view)           {               oldCreditSesameView.setSesameValues(639);           }       });
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值