PayPal沙盒Webhooks(例如付款)。

发布于 2025-02-13 04:35:27 字数 132 浏览 1 评论 0 原文

我正在使用PayPal Webhooks自动获取订阅信息。

但是,我们必须在付款和订阅激活之间等待约20秒。

是因为沙盒环境吗?生产环境更快吗?

这很重要,因为客户必须等待,如果可以避免等待时间,那就更好了。

I'm using PayPal webhooks to get subscription information automatically.

However, we have to wait about 20 seconds between the payment and the subscription activation.

Is it because of the sandbox environment? Is the production environment faster?

This is important because the customers have to wait and if waiting time could be avoided, it would be better.

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

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

发布评论

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

评论(1

携余温的黄昏 2025-02-20 04:35:27

通常,沙箱较慢,但是您需要在现场实时测试自己 - 异步通知的速度在不同的条件下有所不同。

如果您需要更快的通知,您可以做的就是让客户端 onapprove 事件致电服务器(使用JS fetch 类似于此演示,加上身体有效负载,如果需要),并具有处理获取订阅的服务器路由,请使用订阅API到,看看它实际上是否在PayPal中直接在API响应中活跃。

这种服务器路由的客户端触发器将与等待Webhook通知并行发生,因此首先完成的订阅将在您的记录中标记为活动性。这样,您就不依赖客户端触发器或等待Webhook,而是首先发生的。

The sandbox is slower in general, but you will need to test yourself in live -- and the speed of asynchronous notifications vary in different conditions.

If you need a faster notification, what you can do is have the client-side onApprove event call your server (with a JS fetch similar to this demo, plus a body payload if desired), and have the server route that handles that fetch use the Subscriptions API to get the status of the subscription, and see whether it is in fact active in that API response direct from PayPal.

Such a client-side trigger of a server route would happen in parallel to waiting for the webhook notification, so whichever completes first will mark the subscription as active in your records. This way you are not relying on either the client-side trigger nor waiting for the webhook, but rather whichever happens first.

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