简体   繁体   English

本地主机上的Webhooks

[英]Webhooks on localhost

I am creating a payment gateway using Paymill (which is comparable to Stripe). 我正在使用Paymill(类似于Stripe)创建付款网关。 I want my website to automatically react to subscription-based billings. 我希望我的网站自动响应基于订阅的账单。 This is why I am considering Paymill webhooks. 这就是为什么我考虑使用Paymill webhooks。

I am in the testing phase and thus on localhost (XAMPP). 我正在测试阶段,因此在本地主机(XAMPP)上。 The receiving webhook script would therefore have this URL: 因此,接收webhook脚本将具有以下URL:

localhost/paymill-example-php-subscriptions-master/src/Paymill/LlamaKisses/Controllers/WebhooksController.php. 

But is it possible at all to set a localhost address as a webhook url (and how)? 但是是否可以将本地主机地址设置为webhook url(以及如何设置)?

(By the way, isn't WebhooksController.php missing a response code line like this: (顺便说一句, WebhooksController.php不会缺少这样的响应代码行:

http_response_code(200);

to let the sending webhook know it succeeded and needn't retry?) 让发送的Webhook知道它成功并且不需要重试?)

Many thanks in advance! 提前谢谢了!

I am using Azure Websites with a Free mode website. 我正在将Azure网站与免费模式网站一起使用。 With that you can attach remote debugger to the Azure Website and if I am not mistaken you can do that with free tools from MS too. 这样,您可以将远程调试器附加到Azure网站,如果我没有记错的话,您也可以使用MS的免费工具来实现。 You can easily switch on tracing to Azure Table storage or file system and from within a webbrowser or tools look at logs. 您可以轻松地打开对Azure Table存储或文件系统的跟踪,并可以从Web浏览器或工具内部查看日志。 It may not be apt for you, but if you have a bit of time to play around it's quite easy. 它可能不适合您,但是如果您有时间玩,那很容易。 I am logging the whole PayMill webhook message to an Azure Table . 我将整个PayMill Webhook消息记录到Azure表。

You can use Webhook Relay ( https://webhookrelay.com ) to create webhook forwarding tunnels or bidirectional tunnels: 您可以使用Webhook中继( https://webhookrelay.com )创建Webhook转发隧道或双向隧道:

$ relay forward -b webhook-demo http://localhost:8090/webhook
Forwarding:
https://my.webhookrelay.com/v1/webhooks/5e722a5e-f3d2-4hqec-9e9f-79f1158e4b10 -> http://localhost:8090/webhook
starting webhook relay agent..

Endpoints are permanent (until you delete them) and it is also possible to fan-out webhooks to more than one destination. 端点是永久性的(直到删除它们),还可以将Webhook散布到多个目的地。 .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM