IPN/Ubercart 及其附带的一切:我想确保我有钱

发布于 2024-10-07 20:41:47 字数 502 浏览 0 评论 0原文

抱歉,如果标题有点模糊,我保证我会在下面澄清它:

首先,不久前我问了一个有关销售序列密钥的问题:

购买 Ubercart for Drupal 后如何执行自定义脚本

我在那里发布的信息可能有助于澄清这个问题,但我很怀疑,因为这个问题有点笼统。

基本上,在我知道付款已结清且资金已存入我的帐户之前,我不想执行自定义代码。我有点不确定触发的条件操作“客户完成结账”做了什么?当它说他们完成结账时,是否一定意味着成功并且钱是否在我的帐户中?

如果没有,我如何让 Ubercart 等到它知道我从任何 PSP(例如 Google Checkout、PayPal 等)收到钱来执行我的自定义代码?我无法解决,这可能吗?

Sorry if the title's a bit vaque, I promise I'll clear it up bellow:

First of all, a while ago I asked a question about selling serial keys :

How can I execute a custom script after purchase with Ubercart for Drupal

The information I posted there may help clear things up in this question but I doubt it much because this question is a bit more general.

Basically, I don't want to execute my custom code until I know the payment has been cleared and the moneys in my account. I was a bit unsure what the conditional action thats trigger is 'Customer completes check out' did though? When it says they completed checkout does it necessarily mean successfully and the money is in my account or not?

If not, how do I make Ubercart wait until it knows I've got the money from any PSP (e.g. Google Checkout, PayPal, etc) to execute my custom code? I can't work it out, is it even possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏有森光若流苏 2024-10-14 20:41:47

它没有被记录或公开为应该可靠的东西,但我认为使用“客户完成结帐”触发器是可行的方法。

请记住,以下内容适用于 Ubercart 6.x-2.4。 (今天的最新版本)

从我查看的代码来看,触发器似乎只在成功的订单上执行。成功的订单是否意味着您已收到付款,这在很大程度上取决于您当前的配置以及您正在使用的不同支付网关或方法,但在一般情况和配置下。

该触发器仅从一个函数启动:

function uc_cart_complete_sale($order, $login = FALSE);

如果您对该函数的执行时间进行模块范围的搜索,它应该让您对不同的情况有一个粗略的了解。基本上我发现它是从一些支付模块(例如 paypal 和 2checkout)以及当您到达 cart/checkout/complete drupal 页面(通常是成功订单)时执行的。您特别询问的 paypal 模块似乎在收到“已完成”IPN 状态时调用该函数。

尝试几次购买(正确和错误)并查看触发器是否仅在订单正确收费时才执行应该不难。

It's not documented or exposed as something that should be reliable but I think that using the 'Customer completes check out' trigger is the way to go.

Bear in mind that the following applies to Ubercart 6.x-2.4. (Latest version as of today)

From what I looked at the code, it seems that the trigger is only executed on successful orders. Whether a successful order means that you have received payment, that depends a lot on your current configuration and the different payment gateways or method you are using, but in general situations and configuration.

That trigger is only launched from one function:

function uc_cart_complete_sale($order, $login = FALSE);

If you do a module-wide search on when that function is executed, it should give you a rough idea on the different situations. Basically I found out that it's being executed from a few payment modules (paypal and 2checkout for example) as well as when you reach the cart/checkout/complete drupal page, which is generally on successful orders. The paypal module, which you specifically asked, seems to be calling that function when a 'Completed' IPN status is received.

It shouldn't be hard to try out a few purchases (right and wrong) and see if your trigger executes only when the order is properly charged.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文