Skip to content

Taro 作为跨平台框架,并没有做到接口封装适配!光支付接口就有requestPayment、tradePay、pay #19216

Description

@felix9ia

请先确认

  • 我已搜索并确定这个提交不是重复的

Taro 版本

v4

相关领域

None

使用框架

React

相关平台

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 头条小程序
  • QQ 小程序
  • 钉钉小程序
  • 飞书小程序
  • 快手小程序

小程序基础库版本

No response

问题描述

我理解的接口适配不应该是统一的接口定义,不同的返回值吗?
要对接支付
微信支付需要调用 Taro.requestPayment
支付宝需要调用 Taro.tradePay
抖音支付需要调用 Taro.pay

需要调用 Taro.setStorage 结果支付宝返回的是 success ,而微信支付返回的errMsg....
那要 Taro 适配的意义是什么呢?
隔壁的Uni ,最起码都做了适配,
https://uniapp.dcloud.net.cn/api/plugins/payment.html
https://uniapp.dcloud.net.cn/api/location/location.html

复现链接

https://github.com/NervJS/taro/issues

复现步骤

微信支付需要调用 Taro.requestPayment
支付宝需要调用 Taro.tradePay
抖音支付需要调用 Taro.pay

环境信息

👽 Taro v4.1.10


  Taro CLI 4.1.10 environment info:
    System:
      OS: Windows 11 10.0.26200
    Binaries:
      Node: 25.9.0 - C:\nvm4w\nodejs\node.EXE
      Yarn: 1.22.22 - C:\nvm4w\nodejs\yarn.CMD
      npm: 11.12.1 - C:\nvm4w\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 4.1.10 => 4.1.10 
      @tarojs/components: 4.1.10 => 4.1.10 
      @tarojs/helper: 4.1.10 => 4.1.10 
      @tarojs/plugin-framework-react: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-alipay: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-h5: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-harmony-hybrid: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-jd: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-qq: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-swan: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-tt: 4.1.10 => 4.1.10 
      @tarojs/plugin-platform-weapp: 4.1.10 => 4.1.10 
      @tarojs/react: 4.1.10 => 4.1.10 
      @tarojs/runtime: 4.1.10 => 4.1.10 
      @tarojs/shared: 4.1.10 => 4.1.10 
      @tarojs/taro: 4.1.10 => 4.1.10 
      @tarojs/taro-loader: 4.1.10 => 4.1.10 
      @tarojs/webpack5-runner: 4.1.10 => 4.1.10 
      babel-preset-taro: 4.1.10 => 4.1.10 
      eslint-config-taro: 4.1.10 => 4.1.10 
      react: ^18.2.0 => 18.3.1

开源贡献

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-reactFramework - ReactT-alipayTarget - 编译到支付宝小程序T-ddT-feishuT-h5Target - 编译到 H5T-harmonyTarget - 编译到 HarmonyT-harmony_hybridTarget - 编译到 Harmony (Hybird 模式)T-jdTarget - 编译到京东小程序T-kwaiT-qqTarget - 编译到 QQ 小程序T-quickappTarget - 编译到快应用T-qyT-rnTarget - 编译到 React NativeT-swanTarget - 编译到百度小程序T-ttTarget - 编译到字节跳动小程序T-weappTarget - 编译到微信小程序V-4Version - 4.xbugSomething isn't working

    Type

    No type

    Projects

    Status
    Todo
    Status
    Padding

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions