PayPal沙盒Webhooks(例如付款)。
我正在使用PayPal Webhooks自动获取订阅信息。
但是,我们必须在付款和订阅激活之间等待约20秒。
是因为沙盒环境吗?生产环境更快吗?
这很重要,因为客户必须等待,如果可以避免等待时间,那就更好了。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,沙箱较慢,但是您需要在现场实时测试自己 - 异步通知的速度在不同的条件下有所不同。
如果您需要更快的通知,您可以做的就是让客户端
onapprove
事件致电服务器(使用JSfetch
类似于此演示,加上身体有效负载,如果需要),并具有处理获取订阅的服务器路由,请使用订阅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 JSfetch
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.