rn-alipay icon indicating copy to clipboard operation
rn-alipay copied to clipboard

支付宝支付在ios机子上报错?

Open luojinghui opened this issue 7 years ago • 3 comments

错误信息:

ExceptionsManager.js:82 Exception '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]' was thrown while invoking pay on target RNAlipay with params (
        {
        body = "\U91d1\U9526\U56caVIP\U4f1a\U5458";
        inputCharset = "utf-8";
        itBPay = 30m;
        notifyURL = "http://testoffline.jnexpert.com.ngrok.cc/jnExpertPay/aliPay/aliVIPCallback.php";
        outTradeNO = "JN-VIP-20170613190830702935";
        partner = 2088911538235821;
        paymentType = 1;
        privateKey = "...key";
        seller = "[email protected]";
        service = "create_direct_pay_by_user";
        showURL = "jnexpert.com";
        subject = "\U91d1\U9526\U56caVIP\U4f1a\U5458";
        totalFee = "0.01";
    },
    36,
    37
)
onPressPay() {
    var orderId;

    request.get(`http://composer.jnexpert.com/api/Order/jnAliVIP/221`)
        .accept('json')
        .end((err, res) => {
          if (err) {
            console.log('网络错误,请稍后重试');
          } else {
            let data = res.body || {};
            let status = data.status;
            orderId = data.order_id.toString();
            // let price = data.total_fee.toString();
            let price = "0.01";
            if (status > 0) {
              // let orderId = "jn-" + (new Date().getTime().toString());
              const privateKey = "...key";
              const data = {
                privateKey,
                partner: '2088911538235821',
                seller: '[email protected]',
                outTradeNO: orderId, //订单ID(由商家自行制定)
                subject: '金锦囊VIP会员', //商品标题
                body: '金锦囊VIP会员', //商品描述
                totalFee: price, //商品价格
                notifyURL: 'http://testoffline.jnexpert.com.ngrok.cc/jnExpertPay/aliPay/aliVIPCallback.php', //回调URL
                service: 'create_direct_pay_by_user',
                paymentType: '1',
                inputCharset: 'utf-8',
                itBPay: '30m',
                showURL: 'jnexpert.com'
              };
              console.log(data);
              Alipay.pay(data).then((msg) => {
                console.log(msg);
              }, (e) => {
                // ToastAndroid.show('支付失败,请稍后重试', ToastAndroid.SHORT);
              });
            } else {
              // ToastAndroid.show('网络错误,请稍后重试', ToastAndroid.SHORT);
              console.log('网络错误,请稍后重试');
            }
          }
        });
  }

在ios上跑就是报哪个错误,不知道为什么,看结果是吊起pay方法时,强行插入了两个参数,37,38,但是这套代码在安卓没有任何问题,有人知道吗? 测试机是:苹果6plus

luojinghui avatar Jun 13 '17 11:06 luojinghui

@huangzuizui @devhyunjae 求解

luojinghui avatar Jun 13 '17 11:06 luojinghui

楼主解决了吗,我也遇到了一样的问题: image

liaochangjiang avatar Nov 29 '19 07:11 liaochangjiang

image

如图,不过我用的不是这个库,但是同样是支付宝支付

liaoyinglong avatar Feb 18 '20 09:02 liaoyinglong