GetTransactionDetails 不带交易 ID

发布于 2025-01-14 17:45:54 字数 298 浏览 2 评论 0原文

我有一个使用 PayPal NVP 沙箱的网站。有时,用户成功付款后,PayPal 返回我的返回 URL 的速度非常慢。除非 PayPal 返回我的网站并提供详细信息,否则我无法检查用户是否已完成订单(对于所有尝试网站都会将订单 ID 添加到数据库),这会破坏网站的工作原理。

我需要的是,如果可能的话,我想检索没有交易ID的交易数据。也许有自定义字段或其他东西。如果我能够在没有交易 id 的情况下检查交易详细信息,那么我将能够相应地处理用户的请求。或者,如果有一种方法可以在另一个变量的帮助下以某种方式获取交易 ID,也可以,因为我将在找到交易 ID 后进行检查。

I have website where I use PayPal NVP sandbox. Sometimes after successful payment of user, PayPal get back to my return URL very slow. Unless PayPal returns to my website with details I am unable to check whether user has completed the order (For all attempt website adds order id to the database) or not and that destroys website's work principle.

What I need is that I want to retrieve the data of transaction without transaction id if possible. Maybe with custom field or something else. If I would be able to check the transaction details without transaction id , then I would be able to handle the requests by user accordingly. Or if there is a way to get a transaction id somehow with the help of another variable that also fine as I will make checking after finding out the transaction id.

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

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

发布评论

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

评论(1

红尘作伴 2025-01-21 17:45:54

当前的 PayPal Checkout 集成可立即响应成功/失败。无需从您的站点进行任何重定向,也无需等待异步 IPN 或 Webhook 消息。不要使用这样的东西。

遵循 PayPal Checkout 集成 指南并在您的服务器上创建 2 条路由,其中​​一条一个用于“创建订单”,一个用于“捕获订单”(请参阅​​“添加和修改代码”中的可选步骤 5;您可以使用 Checkout-PHP-SDK)。服务器上的这两个路由应仅返回/输出 JSON 数据(无 HTML 或文本)。在第二条路线中,当捕获 API 成功时,您应该将其生成的付款详细信息存储在数据库中(特别是 purchase_units[0]. payments.captures[0].id,这是 PayPal 交易 ID )并在将返回的 JSON 转发给前端调用者之前立即执行任何必要的业务逻辑(例如发送确认电子邮件或预订产品)。

将这 2 条路由与前端审批流程配对:https://developer.paypal。 com/demo/checkout/#/pattern/server

Current PayPal Checkout integrations give an immediate response of success/failure. There is no need for any redirect away from your site, and there is no need to wait for asynchronous IPN or webhook messages. Don't use such things.

Follow the PayPal Checkout integration guide and make 2 routes on your server, one for 'Create Order' and one for 'Capture Order' (see the optional step 5 in 'Add and modify the code'; you can use the Checkout-PHP-SDK). Both of these routes on your server should return/output only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.

Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

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