Giter VIP home page Giter VIP logo

Comments (5)

helei112g avatar helei112g commented on May 16, 2024

transaction_id 是用来标记本笔交易在自己的系统中唯一交易号。transaction_code 是自己向第三方(支付宝、微信等)发起支付请求时,传给第三方的。
这样设计有几个目的:

  1. 个别第三方一个交易号只能发起一次支付请求;
  2. 可以非常清晰的处理重复支付问题;
  3. 对总的发起过的支付次数&路径便于分析。

from manuals.

cowsky avatar cowsky commented on May 16, 2024

谢谢回复,那我可以理解为一个transaction_id对应多个transaction_code么?那我有个疑问哈
是否每次支付请求都生成一个新的transaction_code(不重复)来解决重复支付问题,如果真的是重复提交支付请求并重复支付了,那么解决退款问题呢,具体退哪一笔?还有,这样如果用户重复多次申请支付,是不是导致transaction_code膨胀?

from manuals.

helei112g avatar helei112g commented on May 16, 2024

第一个问题: 一个 transaction_idtransaction_code 确实是一对多的关系。你可以再看下
pay_transaction_extension 这张表的注释。

第二个问题: 重复支付后具体退哪一笔?如果用户支付了两笔,你肯定会收到两个异步通知,那么最后收到的异步通知视为重复支付,对其进行退款。可以看这张表 pay_repeat_transaction

第三个问题:关于膨胀的问题,可以对code设置一个生成次数,比如:2^6。因为一般超过这么多次还在发起请求要么是恶作剧,要么你支付服务出了故障。

上面三个问题都非常好,部分内容由于文章结构考虑没有说到这么细,感谢你的提问。

from manuals.

itcuihao avatar itcuihao commented on May 16, 2024

商户支付的订单号由商户自定义生成,仅支持使用字母、数字、中划线-、下划线_、竖线|、星号*这些英文半角字符的组合,请勿使用汉字或全角等特殊字符。微信支付要求商户订单号保持唯一性(建议根据当前系统时间加随机序列来生成订单号)。重新发起一笔支付要使用原订单号,避免重复支付;已支付过或已调用关单、撤销(请见后文的API列表)的订单号不能重新发起支付。

来自微信参数规定

什么情况下一个交易号,要多次发送支付请求呢?

看微信里使用原订单单号,避免重复支付。

想请教下,这里的重复支付的设置是怎么考量的呢?

from manuals.

helei112g avatar helei112g commented on May 16, 2024

你这里转换一个思路。把自己开发的支付网关想成就是第三方支付。
当业务应用请求支付网关的时候,业务方同一个订单肯定还是给你相同的订单号,无论请求你多少次。

然后假设你就是微信,那么你调用银行的时候,给银行可能就是每笔交易都是一个新的交易号,也可能是同一个。但是这里为了确保对接渠道某种程度上的一致性,我们用都采用新的交易号方式来统一这种行为。

from manuals.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.