PayPal API通过WordPress / WooCommerce上的PayPal插件退款

发布于 2025-01-24 07:05:44 字数 557 浏览 1 评论 0原文

我目前正在使用当前的PayPal插件 https:///wordpress.org/wordpress.org/plugins.orgins.plugins/woocommerce-paypal-woocommerce-paypal - 付款/

我使用PayPal API在页面上呈现多个PayPal按钮,因为上述插件不允许您这样做。

批准PayPal交易后,它运行了PHP功能,该功能会创建WooCommerce订单并填写PayPal交易中的数据,例如退款ID并设置正确的支付网关等。退还上述插件会失败。

我已经比较了来自API实现和标准结帐过程中的CSV文件,并且似乎都在引入相同的数据。

我做了一些研究,似乎如果通过插件结帐下订单,它会创建自己的订单ID,这可能会链接到交易中正确的退款ID。我已经联系了他们的插件支持,但他们无法告诉我。

在这个问题上的任何帮助将不胜感激!

I am currently using the current PayPal plugin https://wordpress.org/plugins/woocommerce-paypal-payments/

I have used the PayPal API to render more than one PayPal button on a page as the above plugin does not allow you to do this.

After the PayPal transaction is approved, it runs a PHP function that creates a WooCommerce order and fills in the data from the PayPal transaction such as the refund ID and setting the correct payment gateway etc. This all goes through great, but when it comes to refunding with the above plugin it fails.

I have compared the CSV files from both the API implementation and standard checkout process and both seem to be bringing in the same data.

I have done a bit of research and it seems that if an order is placed through checkout with the plugin, it creates its own order id, which may link back to the correct refund ID from the transaction. I have contacted their plugin support, but they have been unable to tell me.

Any help on this issue would be greatly appreciated!

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

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

发布评论

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

评论(1

謌踐踏愛綪 2025-01-31 07:05:44

当该插件创建订单时,将在代码中的这些行

The invoice ID is later used 进行退款

If you backtrack through that code doing the refund, it first makes use of a GET API call to the PayPal Order endpoint,

我突出显示此通话的特定行取决于带有PayPal网关订单ID的一些元信息。


顺便说一句,此WooCommerce插件无法很好地实施此退款过程。退款最终是使用捕获ID完成的,并且应该 依靠订单端点可以访问以提供包含捕获ID的GET响应。只要PayPal订单端点保留该订单ID的记录(这不是永远的,因为这不是会计价值),它的工作正常就足够好,但这是错误的。取而代之的是,捕获ID(到PayPal事务ID的等式)是应在交易完成/捕获时间(作为元)中存储的, 存储的元值可以稍后直接用于使用v2/付款退款,没有对API端点订单的API请求。订单API端点仅在结帐批准期间使用,一旦成功完成订单捕获后,将其依赖于任何东西是不正确的。

When that plugin creates an order, an invoice_id and custom_id are set on these lines in the code.

The invoice ID is later used when doing a refund.

If you backtrack through that code doing the refund, it first makes use of a GET API call to the PayPal Order endpoint, which happens within here.

I highlight the particular line where this GET call depends on some meta information with the PayPal Gateway Order ID.


As an aside, this refund process is not well implemented by this WooCommerce plugin. Refunds are ultimately done using a capture ID, and should not rely on the Orders endpoint being accessible to provide a GET response that includes that capture ID. It works well enough so long as the PayPal Orders endpoint retains a record of that Order ID (which is not forever, as it's not an accounting value), but this is wrong to rely on. Instead, the Capture ID (eq. to the PayPal transaction ID) is what should be stored at transaction completion/capture time (as meta), and that stored meta value can then later be directly used to use the v2/payments refund, with no GET API request to the Orders API endpoint. The Orders API endpoint is only meant to be used during checkout approval, it is incorrect to be relying on it for anything once an order capture is successfully completed.

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