关闭

安卓 支付 问题

104人阅读 评论(0) 收藏 举报

1、获取支付宝必须的参数

申请支付宝商户帐号,并且创建应用通过审核。获取商户PID。使用openssl生成支付宝公钥、私钥和pkcs8格式私钥(安卓必须是pkcs8格式的私钥,openssl工具在支付宝官方的SDK里面都有,也有使用介绍)。

<code class="hljs java has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/** 商户PID*/</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">final</span> String PARTNER = <span class="hljs-string" style="color:#0880;box-sizing: border-box;">""</span>;
    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/** 商户收款账号*/</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">final</span> String SELLER = <span class="hljs-string" style="color:#0880;box-sizing: border-box;">""</span>;
    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/** 商户私钥,pkcs8格式*/</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">final</span> String RSA_PRIVATE = <span class="hljs-string" style="color:#0880;box-sizing: border-box;">""</span>;
    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/** 支付宝公钥*/</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">final</span> String RSA_PUBLIC = <span class="hljs-string" style="color:#0880;box-sizing: border-box;">""</span>;</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li></ul>

2、导入jar包

将alipaySdk-20151215.jar包放入应用工程的libs目录下。

3、修改AndroidManifest.xml文件

在AndroidManifest.xml文件中添加如下代码:

<code class="hljs xml has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"> <span class="hljs-comment" style="color:#8800;box-sizing: border-box;"><!-- ===== alipay sdk begin 支付宝配置开始 = --></span>
    <span class="hljs-tag" style="color:#06666;box-sizing: border-box;"><<span class="hljs-title" style="color:#0088;box-sizing: border-box;">activity
</span>        <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:name</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"com.alipay.sdk.app.H5PayActivity"</span>
        <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:configChanges</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"orientation|keyboardHidden|navigation|screenSize"</span>
        <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:exported</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"false"</span>
        <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:screenOrientation</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"behind"</span>
        <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:launchMode</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"singleTop"</span>
       <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:windowSoftInputMode</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"adjustResize|stateHidden"</span> ></span>
    <span class="hljs-tag" style="color:#06666;box-sizing: border-box;"></<span class="hljs-title" style="color:#0088;box-sizing: border-box;">activity</span>></span>
 <span class="hljs-comment" style="color:#8800;box-sizing: border-box;"><!-- ====== alipay sdk end 支付宝配置结束 ======= --></span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li></ul>

* 注意:添加启动模式 Android:launchMode=”singleTop”。

添加权限:

<code class="hljs xml has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-tag" style="color:#06666;box-sizing: border-box;"><<span class="hljs-title" style="color:#0088;box-sizing: border-box;">uses-permission</span> <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:name</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"android.permission.INTERNET"</span> /></span>
<span class="hljs-tag" style="color:#06666;box-sizing: border-box;"><<span class="hljs-title" style="color:#0088;box-sizing: border-box;">uses-permission</span> <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:name</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"android.permission.ACCESS_NETWORK_STATE"</span> /></span>
<span class="hljs-tag" style="color:#06666;box-sizing: border-box;"><<span class="hljs-title" style="color:#0088;box-sizing: border-box;">uses-permission</span> <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:name</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"android.permission.ACCESS_WIFI_STATE"</span> /></span>
<span class="hljs-tag" style="color:#06666;box-sizing: border-box;"><<span class="hljs-title" style="color:#0088;box-sizing: border-box;">uses-permission</span> <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:name</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"android.permission.READ_PHONE_STATE"</span> /></span>
<span class="hljs-tag" style="color:#06666;box-sizing: border-box;"><<span class="hljs-title" style="color:#0088;box-sizing: border-box;">uses-permission</span> <span class="hljs-attribute" style="color:#66066;box-sizing: border-box;">android:name</span>=<span class="hljs-value" style="color:#0880;box-sizing: border-box;">"android.permission.WRITE_EXTERNAL_STORAGE"</span> /></span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>

4、创建支付宝支付类

在支付宝的官方demo中找到Base64.Java,PayResult.Java和SignUtils.java文件放在自己的项目中。

创建支付类: 
为了保证后台可以正确的接收数据可以设置异步接收支付结果,商户提供一个http协议的接口,包含在参数里传递给快捷支付,即notify_url。支付宝服务器在支付完成后,会以POST方式调用notify_url,以xml数据格式传输支付结果。

//服务器异步通知页面路径 Url.PAYORDER 订单支付-支付宝支付完成异步回调接口 
orderInfo += “&notify_url=” + “\”” + Url.PAYORDER + “\”“;

<code class="hljs java has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-class" style="box-sizing: border-box;"><span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">class</span> <span class="hljs-title" style="color:#66066;box-sizing: border-box;">AlipayPay</span> {</span>

    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">private</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">final</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">int</span> SDK_PAY_FLAG = <span class="hljs-number" style="color:#06666;box-sizing: border-box;">1</span>;
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">private</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">static</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">final</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">int</span> SDK_CHECK_FLAG = <span class="hljs-number" style="color:#06666;box-sizing: border-box;">2</span>;
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">private</span> Context context;
    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/** 在后台获取的商户订单号 */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">private</span> String tradeNo;

    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-title" style="box-sizing: border-box;">AlipayPay</span>(Context context, String tradeNo) {
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">this</span>.context = context;
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">this</span>.tradeNo = tradeNo;
    }

    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">private</span> Handler mHandler = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Handler() {
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">handleMessage</span>(Message msg) {
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">switch</span> (msg.what) {
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">case</span> SDK_PAY_FLAG: {
                PayResult payResult = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> PayResult((String) msg.obj);
                <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 支付宝返回此次支付结果及加签,建议对支付宝签名信息拿签约时支付宝提供的公钥做验签</span>
                String resultInfo = payResult.getResult();
                String resultStatus = payResult.getResultStatus();
                String memo = payResult.getMemo();
                LogUtils.e(<span class="hljs-string" style="color:#0880;box-sizing: border-box;">"resultStatus=="</span> + resultStatus + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"==memo=="</span> + memo);
                <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 判断resultStatus 为“9000”则代表支付成功,具体状态码代表含义可参考接口文档</span>
                <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">if</span> (TextUtils.equals(resultStatus, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"9000"</span>)) {
                    Toast.makeText(context, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"支付成功"</span>, Toast.LENGTH_SHORT).show();
                } <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">else</span> {
                    <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 判断resultStatus 为非“9000”则代表可能支付失败</span>
                    <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// “8000”代表支付结果因为支付渠道原因或者系统原因还在等待支付结果确认,最终交易是否成功以服务端异步通知为准(小概率状态)</span>
                    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">if</span> (TextUtils.equals(resultStatus, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"8000"</span>)) {
                        Toast.makeText(context, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"支付结果确认中"</span>, Toast.LENGTH_SHORT)
                                .show();
                    } <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">else</span> {
                        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 其他值就可以判断为支付失败,包括用户主动取消支付,或者系统返回的错误</span>
                        Toast.makeText(context, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"支付失败"</span>, Toast.LENGTH_SHORT)
                                .show();
                    }
                }
                <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">break</span>;
            }
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">case</span> SDK_CHECK_FLAG: {
                Toast.makeText(context, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"检查结果为:"</span> + msg.obj, Toast.LENGTH_SHORT)
                        .show();
                <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">break</span>;
            }
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">default</span>:
                <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">break</span>;
            }
        };
    };

    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/**
     * call alipay sdk pay. 调用SDK支付 subject 商品名称 body 商品详情 price 该笔订单的资金总额
     */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">pay</span>(String subject, String body, String price) {
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">if</span> (TextUtils.isEmpty(PayConfig.PARTNER)
                || TextUtils.isEmpty(PayConfig.RSA_PRIVATE)
                || TextUtils.isEmpty(PayConfig.SELLER)) {
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> AlertDialog.Builder(context)
                    .setTitle(<span class="hljs-string" style="color:#0880;box-sizing: border-box;">"警告"</span>)
                    .setMessage(<span class="hljs-string" style="color:#0880;box-sizing: border-box;">"需要配置PARTNER | RSA_PRIVATE| SELLER"</span>)
                    .setPositiveButton(<span class="hljs-string" style="color:#0880;box-sizing: border-box;">"确定"</span>,
                            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> DialogInterface.OnClickListener() {
                                <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">onClick</span>(
                                        DialogInterface dialoginterface, <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">int</span> i) {
                                    <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// ((Activity) context).finish();</span>
                                }
                            }).show();
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">return</span>;
        }
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 订单</span>
        String orderInfo = getOrderInfo(subject, body, price);

        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 对订单做RSA 签名</span>
        String sign = sign(orderInfo);
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">try</span> {
            <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 仅需对sign 做URL编码</span>
            sign = URLEncoder.encode(sign, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"UTF-8"</span>);
        } <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">catch</span> (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 完整的符合支付宝参数规范的订单信息</span>
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">final</span> String payInfo = orderInfo + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&sign=\""</span> + sign + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\"&"</span>
                + getSignType();

        Runnable payRunnable = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Runnable() {
            <span class="hljs-annotation" style="color:#9b859d;box-sizing: border-box;">@Override</span>
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">run</span>() {
                <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 构造PayTask 对象</span>
                PayTask alipay = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> PayTask((Activity) context);
                <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 调用支付接口,获取支付结果</span>
                String result = alipay.pay(payInfo);

                Message msg = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Message();
                msg.what = SDK_PAY_FLAG;
                msg.obj = result;
                mHandler.sendMessage(msg);
            }
        };

        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 必须异步调用</span>
        Thread payThread = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Thread(payRunnable);
        payThread.start();
    }

    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/**
     * check whether the device has authentication alipay account.
     * 查询终端设备是否存在支付宝认证账户
     */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">check</span>(View v) {
        Runnable checkRunnable = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Runnable() {

            <span class="hljs-annotation" style="color:#9b859d;box-sizing: border-box;">@Override</span>
            <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">run</span>() {
                <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 构造PayTask 对象</span>
                PayTask payTask = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> PayTask((Activity) context);
                <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 调用查询接口,获取查询结果</span>
                <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">boolean</span> isExist = payTask.checkAccountIfExist();

                Message msg = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Message();
                msg.what = SDK_CHECK_FLAG;
                msg.obj = isExist;
                mHandler.sendMessage(msg);
            }
        };

        Thread checkThread = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Thread(checkRunnable);
        checkThread.start();

    }

    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/**
     * get the sdk version. 获取SDK版本号
     */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">void</span> <span class="hljs-title" style="box-sizing: border-box;">getSDKVersion</span>() {
        PayTask payTask = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> PayTask((Activity) context);
        String version = payTask.getVersion();
        Toast.makeText(context, version, Toast.LENGTH_SHORT).show();
    }

    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/**
     * create the order info. 创建订单信息
     */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> String <span class="hljs-title" style="box-sizing: border-box;">getOrderInfo</span>(String subject, String body, String price) {
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 签约合作者身份ID</span>
        String orderInfo = <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"partner="</span> + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span> + PayConfig.PARTNER + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 签约卖家支付宝账号</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&seller_id="</span> + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span> + PayConfig.SELLER + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 商户网站唯一订单号 getOutTradeNo()</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&out_trade_no="</span> + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span> + tradeNo + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 商品名称</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&subject="</span> + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span> + subject + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 商品详情</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&body="</span> + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span> + body + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 商品金额</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&total_fee="</span> + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span> + price + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 服务器异步通知页面路径  Url.PAYORDER 订单支付-支付宝支付完成异步回调接口</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&notify_url="</span> + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span> + Url.PAYORDER + <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 服务接口名称, 固定值</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&service=\"mobile.securitypay.pay\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 支付类型, 固定值</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&payment_type=\"1\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 参数编码, 固定值</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&_input_charset=\"utf-8\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 设置未付款交易的超时时间</span>
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 默认30分钟,一旦超时,该笔交易就会自动被关闭。</span>
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 取值范围:1m~15d。</span>
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// m-分钟,h-小时,d-天,1c-当天(无论交易何时创建,都在0点关闭)。</span>
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 该参数数值不接受小数点,如1.5h,可转换为90m。</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&it_b_pay=\"30m\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// extern_token为经过快登授权获取到的alipay_open_id,带上此参数用户将使用授权的账户进行支付</span>
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// orderInfo += "&extern_token=" + "\"" + extern_token + "\"";</span>
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 支付宝处理完请求后,当前页面跳转到商户指定页面的路径,可空</span>
        orderInfo += <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"&return_url=\"m.alipay.com\""</span>;
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// 调用银行卡支付,需配置此参数,参与签名, 固定值 (需要签约《无线银行卡快捷支付》才能使用)</span>
        <span class="hljs-comment" style="color:#8800;box-sizing: border-box;">// orderInfo += "&paymethod=\"expressGateway\"";</span>
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">return</span> orderInfo;
    }

    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/**
     * get the out_trade_no for an order. 生成商户订单号,该值在商户端应保持唯一(可自定义格式规范)
     * 
     */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> String <span class="hljs-title" style="box-sizing: border-box;">getOutTradeNo</span>() {
        SimpleDateFormat format = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> SimpleDateFormat(<span class="hljs-string" style="color:#0880;box-sizing: border-box;">"MMddHHmmss"</span>,
                Locale.getDefault());
        Date date = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Date();
        String key = format.format(date);
        Random r = <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> Random();
        key = key + r.nextInt();
        key = key.substring(<span class="hljs-number" style="color:#06666;box-sizing: border-box;">0</span>, <span class="hljs-number" style="color:#06666;box-sizing: border-box;">15</span>);
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">return</span> key;
    }

    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/**
     * sign the order info. 对订单信息进行签名
     * 
     *<span class="hljs-javadoctag" style="color:#66066;box-sizing: border-box;"> @param</span> content
     *            待签名订单信息
     */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> String <span class="hljs-title" style="box-sizing: border-box;">sign</span>(String content) {
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">return</span> SignUtils.sign(content, PayConfig.RSA_PRIVATE);
    }

    <span class="hljs-javadoc" style="color:#8800;box-sizing: border-box;">/**
     * get the sign type we use. 获取签名方式
     * 
     */</span>
    <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">public</span> String <span class="hljs-title" style="box-sizing: border-box;">getSignType</span>() {
        <span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">return</span> <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"sign_type=\"RSA\""</span>;
    }

}
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li><li style="box-sizing: border-box; padding: 0px 5px;">62</li><li style="box-sizing: border-box; padding: 0px 5px;">63</li><li style="box-sizing: border-box; padding: 0px 5px;">64</li><li style="box-sizing: border-box; padding: 0px 5px;">65</li><li style="box-sizing: border-box; padding: 0px 5px;">66</li><li style="box-sizing: border-box; padding: 0px 5px;">67</li><li style="box-sizing: border-box; padding: 0px 5px;">68</li><li style="box-sizing: border-box; padding: 0px 5px;">69</li><li style="box-sizing: border-box; padding: 0px 5px;">70</li><li style="box-sizing: border-box; padding: 0px 5px;">71</li><li style="box-sizing: border-box; padding: 0px 5px;">72</li><li style="box-sizing: border-box; padding: 0px 5px;">73</li><li style="box-sizing: border-box; padding: 0px 5px;">74</li><li style="box-sizing: border-box; padding: 0px 5px;">75</li><li style="box-sizing: border-box; padding: 0px 5px;">76</li><li style="box-sizing: border-box; padding: 0px 5px;">77</li><li style="box-sizing: border-box; padding: 0px 5px;">78</li><li style="box-sizing: border-box; padding: 0px 5px;">79</li><li style="box-sizing: border-box; padding: 0px 5px;">80</li><li style="box-sizing: border-box; padding: 0px 5px;">81</li><li style="box-sizing: border-box; padding: 0px 5px;">82</li><li style="box-sizing: border-box; padding: 0px 5px;">83</li><li style="box-sizing: border-box; padding: 0px 5px;">84</li><li style="box-sizing: border-box; padding: 0px 5px;">85</li><li style="box-sizing: border-box; padding: 0px 5px;">86</li><li style="box-sizing: border-box; padding: 0px 5px;">87</li><li style="box-sizing: border-box; padding: 0px 5px;">88</li><li style="box-sizing: border-box; padding: 0px 5px;">89</li><li style="box-sizing: border-box; padding: 0px 5px;">90</li><li style="box-sizing: border-box; padding: 0px 5px;">91</li><li style="box-sizing: border-box; padding: 0px 5px;">92</li><li style="box-sizing: border-box; padding: 0px 5px;">93</li><li style="box-sizing: border-box; padding: 0px 5px;">94</li><li style="box-sizing: border-box; padding: 0px 5px;">95</li><li style="box-sizing: border-box; padding: 0px 5px;">96</li><li style="box-sizing: border-box; padding: 0px 5px;">97</li><li style="box-sizing: border-box; padding: 0px 5px;">98</li><li style="box-sizing: border-box; padding: 0px 5px;">99</li><li style="box-sizing: border-box; padding: 0px 5px;">100</li><li style="box-sizing: border-box; padding: 0px 5px;">101</li><li style="box-sizing: border-box; padding: 0px 5px;">102</li><li style="box-sizing: border-box; padding: 0px 5px;">103</li><li style="box-sizing: border-box; padding: 0px 5px;">104</li><li style="box-sizing: border-box; padding: 0px 5px;">105</li><li style="box-sizing: border-box; padding: 0px 5px;">106</li><li style="box-sizing: border-box; padding: 0px 5px;">107</li><li style="box-sizing: border-box; padding: 0px 5px;">108</li><li style="box-sizing: border-box; padding: 0px 5px;">109</li><li style="box-sizing: border-box; padding: 0px 5px;">110</li><li style="box-sizing: border-box; padding: 0px 5px;">111</li><li style="box-sizing: border-box; padding: 0px 5px;">112</li><li style="box-sizing: border-box; padding: 0px 5px;">113</li><li style="box-sizing: border-box; padding: 0px 5px;">114</li><li style="box-sizing: border-box; padding: 0px 5px;">115</li><li style="box-sizing: border-box; padding: 0px 5px;">116</li><li style="box-sizing: border-box; padding: 0px 5px;">117</li><li style="box-sizing: border-box; padding: 0px 5px;">118</li><li style="box-sizing: border-box; padding: 0px 5px;">119</li><li style="box-sizing: border-box; padding: 0px 5px;">120</li><li style="box-sizing: border-box; padding: 0px 5px;">121</li><li style="box-sizing: border-box; padding: 0px 5px;">122</li><li style="box-sizing: border-box; padding: 0px 5px;">123</li><li style="box-sizing: border-box; padding: 0px 5px;">124</li><li style="box-sizing: border-box; padding: 0px 5px;">125</li><li style="box-sizing: border-box; padding: 0px 5px;">126</li><li style="box-sizing: border-box; padding: 0px 5px;">127</li><li style="box-sizing: border-box; padding: 0px 5px;">128</li><li style="box-sizing: border-box; padding: 0px 5px;">129</li><li style="box-sizing: border-box; padding: 0px 5px;">130</li><li style="box-sizing: border-box; padding: 0px 5px;">131</li><li style="box-sizing: border-box; padding: 0px 5px;">132</li><li style="box-sizing: border-box; padding: 0px 5px;">133</li><li style="box-sizing: border-box; padding: 0px 5px;">134</li><li style="box-sizing: border-box; padding: 0px 5px;">135</li><li style="box-sizing: border-box; padding: 0px 5px;">136</li><li style="box-sizing: border-box; padding: 0px 5px;">137</li><li style="box-sizing: border-box; padding: 0px 5px;">138</li><li style="box-sizing: border-box; padding: 0px 5px;">139</li><li style="box-sizing: border-box; padding: 0px 5px;">140</li><li style="box-sizing: border-box; padding: 0px 5px;">141</li><li style="box-sizing: border-box; padding: 0px 5px;">142</li><li style="box-sizing: border-box; padding: 0px 5px;">143</li><li style="box-sizing: border-box; padding: 0px 5px;">144</li><li style="box-sizing: border-box; padding: 0px 5px;">145</li><li style="box-sizing: border-box; padding: 0px 5px;">146</li><li style="box-sizing: border-box; padding: 0px 5px;">147</li><li style="box-sizing: border-box; padding: 0px 5px;">148</li><li style="box-sizing: border-box; padding: 0px 5px;">149</li><li style="box-sizing: border-box; padding: 0px 5px;">150</li><li style="box-sizing: border-box; padding: 0px 5px;">151</li><li style="box-sizing: border-box; padding: 0px 5px;">152</li><li style="box-sizing: border-box; padding: 0px 5px;">153</li><li style="box-sizing: border-box; padding: 0px 5px;">154</li><li style="box-sizing: border-box; padding: 0px 5px;">155</li><li style="box-sizing: border-box; padding: 0px 5px;">156</li><li style="box-sizing: border-box; padding: 0px 5px;">157</li><li style="box-sizing: border-box; padding: 0px 5px;">158</li><li style="box-sizing: border-box; padding: 0px 5px;">159</li><li style="box-sizing: border-box; padding: 0px 5px;">160</li><li style="box-sizing: border-box; padding: 0px 5px;">161</li><li style="box-sizing: border-box; padding: 0px 5px;">162</li><li style="box-sizing: border-box; padding: 0px 5px;">163</li><li style="box-sizing: border-box; padding: 0px 5px;">164</li><li style="box-sizing: border-box; padding: 0px 5px;">165</li><li style="box-sizing: border-box; padding: 0px 5px;">166</li><li style="box-sizing: border-box; padding: 0px 5px;">167</li><li style="box-sizing: border-box; padding: 0px 5px;">168</li><li style="box-sizing: border-box; padding: 0px 5px;">169</li><li style="box-sizing: border-box; padding: 0px 5px;">170</li><li style="box-sizing: border-box; padding: 0px 5px;">171</li><li style="box-sizing: border-box; padding: 0px 5px;">172</li><li style="box-sizing: border-box; padding: 0px 5px;">173</li><li style="box-sizing: border-box; padding: 0px 5px;">174</li><li style="box-sizing: border-box; padding: 0px 5px;">175</li><li style="box-sizing: border-box; padding: 0px 5px;">176</li><li style="box-sizing: border-box; padding: 0px 5px;">177</li><li style="box-sizing: border-box; padding: 0px 5px;">178</li><li style="box-sizing: border-box; padding: 0px 5px;">179</li><li style="box-sizing: border-box; padding: 0px 5px;">180</li><li style="box-sizing: border-box; padding: 0px 5px;">181</li><li style="box-sizing: border-box; padding: 0px 5px;">182</li><li style="box-sizing: border-box; padding: 0px 5px;">183</li><li style="box-sizing: border-box; padding: 0px 5px;">184</li><li style="box-sizing: border-box; padding: 0px 5px;">185</li><li style="box-sizing: border-box; padding: 0px 5px;">186</li><li style="box-sizing: border-box; padding: 0px 5px;">187</li><li style="box-sizing: border-box; padding: 0px 5px;">188</li><li style="box-sizing: border-box; padding: 0px 5px;">189</li><li style="box-sizing: border-box; padding: 0px 5px;">190</li><li style="box-sizing: border-box; padding: 0px 5px;">191</li><li style="box-sizing: border-box; padding: 0px 5px;">192</li><li style="box-sizing: border-box; padding: 0px 5px;">193</li><li style="box-sizing: border-box; padding: 0px 5px;">194</li><li style="box-sizing: border-box; padding: 0px 5px;">195</li><li style="box-sizing: border-box; padding: 0px 5px;">196</li><li style="box-sizing: border-box; padding: 0px 5px;">197</li><li style="box-sizing: border-box; padding: 0px 5px;">198</li><li style="box-sizing: border-box; padding: 0px 5px;">199</li><li style="box-sizing: border-box; padding: 0px 5px;">200</li><li style="box-sizing: border-box; padding: 0px 5px;">201</li><li style="box-sizing: border-box; padding: 0px 5px;">202</li><li style="box-sizing: border-box; padding: 0px 5px;">203</li><li style="box-sizing: border-box; padding: 0px 5px;">204</li><li style="box-sizing: border-box; padding: 0px 5px;">205</li><li style="box-sizing: border-box; padding: 0px 5px;">206</li><li style="box-sizing: border-box; padding: 0px 5px;">207</li><li style="box-sizing: border-box; padding: 0px 5px;">208</li><li style="box-sizing: border-box; padding: 0px 5px;">209</li><li style="box-sizing: border-box; padding: 0px 5px;">210</li><li style="box-sizing: border-box; padding: 0px 5px;">211</li><li style="box-sizing: border-box; padding: 0px 5px;">212</li><li style="box-sizing: border-box; padding: 0px 5px;">213</li><li style="box-sizing: border-box; padding: 0px 5px;">214</li><li style="box-sizing: border-box; padding: 0px 5px;">215</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li><li style="box-sizing: border-box; padding: 0px 5px;">60</li><li style="box-sizing: border-box; padding: 0px 5px;">61</li><li style="box-sizing: border-box; padding: 0px 5px;">62</li><li style="box-sizing: border-box; padding: 0px 5px;">63</li><li style="box-sizing: border-box; padding: 0px 5px;">64</li><li style="box-sizing: border-box; padding: 0px 5px;">65</li><li style="box-sizing: border-box; padding: 0px 5px;">66</li><li style="box-sizing: border-box; padding: 0px 5px;">67</li><li style="box-sizing: border-box; padding: 0px 5px;">68</li><li style="box-sizing: border-box; padding: 0px 5px;">69</li><li style="box-sizing: border-box; padding: 0px 5px;">70</li><li style="box-sizing: border-box; padding: 0px 5px;">71</li><li style="box-sizing: border-box; padding: 0px 5px;">72</li><li style="box-sizing: border-box; padding: 0px 5px;">73</li><li style="box-sizing: border-box; padding: 0px 5px;">74</li><li style="box-sizing: border-box; padding: 0px 5px;">75</li><li style="box-sizing: border-box; padding: 0px 5px;">76</li><li style="box-sizing: border-box; padding: 0px 5px;">77</li><li style="box-sizing: border-box; padding: 0px 5px;">78</li><li style="box-sizing: border-box; padding: 0px 5px;">79</li><li style="box-sizing: border-box; padding: 0px 5px;">80</li><li style="box-sizing: border-box; padding: 0px 5px;">81</li><li style="box-sizing: border-box; padding: 0px 5px;">82</li><li style="box-sizing: border-box; padding: 0px 5px;">83</li><li style="box-sizing: border-box; padding: 0px 5px;">84</li><li style="box-sizing: border-box; padding: 0px 5px;">85</li><li style="box-sizing: border-box; padding: 0px 5px;">86</li><li style="box-sizing: border-box; padding: 0px 5px;">87</li><li style="box-sizing: border-box; padding: 0px 5px;">88</li><li style="box-sizing: border-box; padding: 0px 5px;">89</li><li style="box-sizing: border-box; padding: 0px 5px;">90</li><li style="box-sizing: border-box; padding: 0px 5px;">91</li><li style="box-sizing: border-box; padding: 0px 5px;">92</li><li style="box-sizing: border-box; padding: 0px 5px;">93</li><li style="box-sizing: border-box; padding: 0px 5px;">94</li><li style="box-sizing: border-box; padding: 0px 5px;">95</li><li style="box-sizing: border-box; padding: 0px 5px;">96</li><li style="box-sizing: border-box; padding: 0px 5px;">97</li><li style="box-sizing: border-box; padding: 0px 5px;">98</li><li style="box-sizing: border-box; padding: 0px 5px;">99</li><li style="box-sizing: border-box; padding: 0px 5px;">100</li><li style="box-sizing: border-box; padding: 0px 5px;">101</li><li style="box-sizing: border-box; padding: 0px 5px;">102</li><li style="box-sizing: border-box; padding: 0px 5px;">103</li><li style="box-sizing: border-box; padding: 0px 5px;">104</li><li style="box-sizing: border-box; padding: 0px 5px;">105</li><li style="box-sizing: border-box; padding: 0px 5px;">106</li><li style="box-sizing: border-box; padding: 0px 5px;">107</li><li style="box-sizing: border-box; padding: 0px 5px;">108</li><li style="box-sizing: border-box; padding: 0px 5px;">109</li><li style="box-sizing: border-box; padding: 0px 5px;">110</li><li style="box-sizing: border-box; padding: 0px 5px;">111</li><li style="box-sizing: border-box; padding: 0px 5px;">112</li><li style="box-sizing: border-box; padding: 0px 5px;">113</li><li style="box-sizing: border-box; padding: 0px 5px;">114</li><li style="box-sizing: border-box; padding: 0px 5px;">115</li><li style="box-sizing: border-box; padding: 0px 5px;">116</li><li style="box-sizing: border-box; padding: 0px 5px;">117</li><li style="box-sizing: border-box; padding: 0px 5px;">118</li><li style="box-sizing: border-box; padding: 0px 5px;">119</li><li style="box-sizing: border-box; padding: 0px 5px;">120</li><li style="box-sizing: border-box; padding: 0px 5px;">121</li><li style="box-sizing: border-box; padding: 0px 5px;">122</li><li style="box-sizing: border-box; padding: 0px 5px;">123</li><li style="box-sizing: border-box; padding: 0px 5px;">124</li><li style="box-sizing: border-box; padding: 0px 5px;">125</li><li style="box-sizing: border-box; padding: 0px 5px;">126</li><li style="box-sizing: border-box; padding: 0px 5px;">127</li><li style="box-sizing: border-box; padding: 0px 5px;">128</li><li style="box-sizing: border-box; padding: 0px 5px;">129</li><li style="box-sizing: border-box; padding: 0px 5px;">130</li><li style="box-sizing: border-box; padding: 0px 5px;">131</li><li style="box-sizing: border-box; padding: 0px 5px;">132</li><li style="box-sizing: border-box; padding: 0px 5px;">133</li><li style="box-sizing: border-box; padding: 0px 5px;">134</li><li style="box-sizing: border-box; padding: 0px 5px;">135</li><li style="box-sizing: border-box; padding: 0px 5px;">136</li><li style="box-sizing: border-box; padding: 0px 5px;">137</li><li style="box-sizing: border-box; padding: 0px 5px;">138</li><li style="box-sizing: border-box; padding: 0px 5px;">139</li><li style="box-sizing: border-box; padding: 0px 5px;">140</li><li style="box-sizing: border-box; padding: 0px 5px;">141</li><li style="box-sizing: border-box; padding: 0px 5px;">142</li><li style="box-sizing: border-box; padding: 0px 5px;">143</li><li style="box-sizing: border-box; padding: 0px 5px;">144</li><li style="box-sizing: border-box; padding: 0px 5px;">145</li><li style="box-sizing: border-box; padding: 0px 5px;">146</li><li style="box-sizing: border-box; padding: 0px 5px;">147</li><li style="box-sizing: border-box; padding: 0px 5px;">148</li><li style="box-sizing: border-box; padding: 0px 5px;">149</li><li style="box-sizing: border-box; padding: 0px 5px;">150</li><li style="box-sizing: border-box; padding: 0px 5px;">151</li><li style="box-sizing: border-box; padding: 0px 5px;">152</li><li style="box-sizing: border-box; padding: 0px 5px;">153</li><li style="box-sizing: border-box; padding: 0px 5px;">154</li><li style="box-sizing: border-box; padding: 0px 5px;">155</li><li style="box-sizing: border-box; padding: 0px 5px;">156</li><li style="box-sizing: border-box; padding: 0px 5px;">157</li><li style="box-sizing: border-box; padding: 0px 5px;">158</li><li style="box-sizing: border-box; padding: 0px 5px;">159</li><li style="box-sizing: border-box; padding: 0px 5px;">160</li><li style="box-sizing: border-box; padding: 0px 5px;">161</li><li style="box-sizing: border-box; padding: 0px 5px;">162</li><li style="box-sizing: border-box; padding: 0px 5px;">163</li><li style="box-sizing: border-box; padding: 0px 5px;">164</li><li style="box-sizing: border-box; padding: 0px 5px;">165</li><li style="box-sizing: border-box; padding: 0px 5px;">166</li><li style="box-sizing: border-box; padding: 0px 5px;">167</li><li style="box-sizing: border-box; padding: 0px 5px;">168</li><li style="box-sizing: border-box; padding: 0px 5px;">169</li><li style="box-sizing: border-box; padding: 0px 5px;">170</li><li style="box-sizing: border-box; padding: 0px 5px;">171</li><li style="box-sizing: border-box; padding: 0px 5px;">172</li><li style="box-sizing: border-box; padding: 0px 5px;">173</li><li style="box-sizing: border-box; padding: 0px 5px;">174</li><li style="box-sizing: border-box; padding: 0px 5px;">175</li><li style="box-sizing: border-box; padding: 0px 5px;">176</li><li style="box-sizing: border-box; padding: 0px 5px;">177</li><li style="box-sizing: border-box; padding: 0px 5px;">178</li><li style="box-sizing: border-box; padding: 0px 5px;">179</li><li style="box-sizing: border-box; padding: 0px 5px;">180</li><li style="box-sizing: border-box; padding: 0px 5px;">181</li><li style="box-sizing: border-box; padding: 0px 5px;">182</li><li style="box-sizing: border-box; padding: 0px 5px;">183</li><li style="box-sizing: border-box; padding: 0px 5px;">184</li><li style="box-sizing: border-box; padding: 0px 5px;">185</li><li style="box-sizing: border-box; padding: 0px 5px;">186</li><li style="box-sizing: border-box; padding: 0px 5px;">187</li><li style="box-sizing: border-box; padding: 0px 5px;">188</li><li style="box-sizing: border-box; padding: 0px 5px;">189</li><li style="box-sizing: border-box; padding: 0px 5px;">190</li><li style="box-sizing: border-box; padding: 0px 5px;">191</li><li style="box-sizing: border-box; padding: 0px 5px;">192</li><li style="box-sizing: border-box; padding: 0px 5px;">193</li><li style="box-sizing: border-box; padding: 0px 5px;">194</li><li style="box-sizing: border-box; padding: 0px 5px;">195</li><li style="box-sizing: border-box; padding: 0px 5px;">196</li><li style="box-sizing: border-box; padding: 0px 5px;">197</li><li style="box-sizing: border-box; padding: 0px 5px;">198</li><li style="box-sizing: border-box; padding: 0px 5px;">199</li><li style="box-sizing: border-box; padding: 0px 5px;">200</li><li style="box-sizing: border-box; padding: 0px 5px;">201</li><li style="box-sizing: border-box; padding: 0px 5px;">202</li><li style="box-sizing: border-box; padding: 0px 5px;">203</li><li style="box-sizing: border-box; padding: 0px 5px;">204</li><li style="box-sizing: border-box; padding: 0px 5px;">205</li><li style="box-sizing: border-box; padding: 0px 5px;">206</li><li style="box-sizing: border-box; padding: 0px 5px;">207</li><li style="box-sizing: border-box; padding: 0px 5px;">208</li><li style="box-sizing: border-box; padding: 0px 5px;">209</li><li style="box-sizing: border-box; padding: 0px 5px;">210</li><li style="box-sizing: border-box; padding: 0px 5px;">211</li><li style="box-sizing: border-box; padding: 0px 5px;">212</li><li style="box-sizing: border-box; padding: 0px 5px;">213</li><li style="box-sizing: border-box; padding: 0px 5px;">214</li><li style="box-sizing: border-box; padding: 0px 5px;">215</li></ul>

5、调起支付

<code class="hljs cs has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">AlipayPay alipayPay=<span class="hljs-keyword" style="color:#0088;box-sizing: border-box;">new</span> AlipayPay(context,moneySn);
alipayPay.pay(<span class="hljs-string" style="color:#0880;box-sizing: border-box;">"钱包充值"</span>, <span class="hljs-string" style="color:#0880;box-sizing: border-box;">"支付宝充值"</span>,<span class="hljs-string" style="color:#0880;box-sizing: border-box;">"100"</span>);<span class="hljs-comment" style="color:#8800;box-sizing: border-box;">//第一个参数为商品详情,第二个参数为商品描述,第三个参数为商品价格</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:2404次
    • 积分:80
    • 等级:
    • 排名:千里之外
    • 原创:4篇
    • 转载:12篇
    • 译文:0篇
    • 评论:0条
    文章存档