b***@163.com
b***@163.com
  • 发布:2024-01-04 13:08
  • 更新:2024-01-04 16:39
  • 阅读:91

【报Bug】苹果支付 同意 媒体服务条款与条件已更改 后报错

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: wind11

手机系统: iOS

手机系统版本号: iOS 14

手机厂商: 苹果

手机机型: iphonex

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: CLI

CLI版本号: 3.0.0-3090920231225001

示例代码:
// 发起支付  
const quzhifu = (product) => {  
  uni.showToast({  
    icon: "loading",  
    title: "获取支付通道...",  
    duration: 99999,  
    mask: true,  
  });  
  uni.getProvider({  
    service: "payment",  
    success: (ProviderRes) => {  
      const iapChannel = ProviderRes.providers.find((channel) => {  
        return channel.id === "appleiap";  
      });  
      if (iapChannel) {  
        uni.showToast({  
          icon: "loading",  
          title: "校验支付产品...",  
          duration: 99999,  
          mask: true,  
        });  
        iapChannel.requestProduct(  
          [product.productId],  
          (productList) => {  
            if (productList.length <= 0) {  
              uni.showToast({  
                title: "未获取到产品信息",  
                icon: "none",  
              });  
              return false;  
            }  
            console.log("获取苹果产品列表成功", productList);  
            APIPostMemberBuy({  
              memberPackageId: product.id, //会员套餐ID  
              isRetrieve: product.isRetrieve, //是否开启挽回优惠: [0=否, 1=是]  
            })  
              .then((orderDetail) => {  
                const { orderId, orderSn, from } = orderDetail.data;  
                console.log("orderId", orderId);  
                uni.requestPayment({  
                  provider: "appleiap",  
                  orderInfo: {  
                    productid: product.productId,  
                    manualFinishTransaction: true,  
                    username: orderId, //根据业务需求透传参数,关联用户和订单关系  
                  },  
                  success: (transactions) => {  
                    //  e 类型为 Transaction, 详见下面的描述  
                    APIPostPayIosIPayNotify({  
                      transactionReceipt: transactions.transactionReceipt, //苹果支付凭证  
                      orderId: orderId, //订单id  
                    }).then((payNotifyRes) => {  
                      console.log("接口的回调", payNotifyRes);  
                      // 验证成功后关闭订单  
                      iapChannel.finishTransaction(transactions);  
                      // 支付成功  
                      storeUserinfo.FnRefreshUserinfo();  
                      uni.showToast({  
                        title: payNotifyRes.msg,  
                        icon: "none",  
                      });  
                    });  
                  },  
                  fail: (err) => {  
                    console.log("支付失败", err);  
                    uni.hideToast();  
                  },  
                });  
              })  
              .catch((err) => {  
                uni.hideToast();  
              });  
          },  
          (err) => {  
            console.log("获取苹果支付产品失败", err);  
            uni.showToast({  
              title: "校验产品失败",  
              icon: "none",  
            });  
          }  
        );  
        return false;  
      }  
      uni.showToast({  
        icon: "none",  
        title: "获取支付通道失败",  
      });  
    },  
    fail: () => {  
      uni.showToast({  
        icon: "none",  
        title: "获取支付通道失败",  
      });  
    },  
  });  
};

操作步骤:

苹果支付

预期结果:

支付成功回调成功

实际结果:

支持成功 回调失败

bug描述:

支付,跳转同意协议后回调是错误的

{  
    "errMsg": "requestPayment:fail Payment_appleiap:Error Domain=SKErrorDomain Code=0 \"发生未知错误\" UserInfo={NSLocalizedDescription=发生未知错误, NSUnderlyingError=0x281ca58c0 {Error Domain=ASDServerErrorDomain Code=3038 \"Apple 媒体服务条款与条件已更改。\" UserInfo={NSLocalizedDescription=Apple 媒体服务条款与条件已更改。}}},https://ask.dcloud.net.cn/article/282",  
    "code": 0  
}
2024-01-04 13:08 负责人:无 分享
已邀请:
b***@163.com

b***@163.com (作者)

uniapp支付的回调,早上 中断,弹服务协议的时候点了同意,但是返回的还是失败回调,下午测试返回的是成功回调。(严重怀疑是hbuilder的问题,中午给社区反馈偷偷修复了)

要回复问题请先登录注册