Rails shopify/stripe/braintree/twilio 在本地主机上进行 webhook 测试
Rails shopify/stripe/braintree/twilio webhooks testing on localhost
我正在尝试为本地主机配置 shopify/stripe/braintree/twilio webhook。它显示目的地未验证。请建议一些与 ruby-rails?
兼容的方法
要在本地主机上使用 运行 webhook,您需要在本地开发环境中创建 public 隧道。有不同的提供程序,例如 UltraHook 和 ngrok。它们很容易设置,例如:
对于 UltraHook
$ gem install ultrahook
$ ultrahook stripe 3000
Authenticated as senvee
Forwarding activated...
http://stripe.senvee.ultrahook.com -> http://localhost:3000
对于 Ngrok,您需要从 https://ngrok.com/download 下载到您的机器上,然后 运行 在您的机器上使用此命令。
解压缩 $ unzip /path/to/ngrok.zip
和运行它来自:
./ngrok http 3000
3000 是您的本地主机端口号。它会给你一个 URL,你需要用这个 url.
设置 webhook
Nitesh 的回答很中肯。我们喜欢来自服务器端代码的 ngrok at Twilio and use it all the time to start sending messages:
require 'rubygems'
require 'twilio-ruby'
# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACCOUNT_SID'
auth_token = 'AUTH_TOKEN'
@client = Twilio::REST::Client.new account_sid, auth_token
message = @client.account.messages.create(:body => "ngrok is awesome!",
:to => "+1415XXXXXXX", # Replace with your phone number
:from => "+1415XXXXXXX") # Replace with your Twilio number
puts message.sid
ngrok 配置已在版本 2
中更改
ngrok 易于安装。为任何主要平台下载零 运行 时间依赖性的单个二进制文件。将其解压缩,然后从命令行 运行。
$ unzip /path/to/ngrok.zip
现在运行喜欢下面
$ ./ngrok http 3000
我正在尝试为本地主机配置 shopify/stripe/braintree/twilio webhook。它显示目的地未验证。请建议一些与 ruby-rails?
兼容的方法要在本地主机上使用 运行 webhook,您需要在本地开发环境中创建 public 隧道。有不同的提供程序,例如 UltraHook 和 ngrok。它们很容易设置,例如:
对于 UltraHook
$ gem install ultrahook
$ ultrahook stripe 3000
Authenticated as senvee
Forwarding activated...
http://stripe.senvee.ultrahook.com -> http://localhost:3000
对于 Ngrok,您需要从 https://ngrok.com/download 下载到您的机器上,然后 运行 在您的机器上使用此命令。
解压缩 $ unzip /path/to/ngrok.zip
和运行它来自:
./ngrok http 3000
3000 是您的本地主机端口号。它会给你一个 URL,你需要用这个 url.
设置 webhookNitesh 的回答很中肯。我们喜欢来自服务器端代码的 ngrok at Twilio and use it all the time to start sending messages:
require 'rubygems'
require 'twilio-ruby'
# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACCOUNT_SID'
auth_token = 'AUTH_TOKEN'
@client = Twilio::REST::Client.new account_sid, auth_token
message = @client.account.messages.create(:body => "ngrok is awesome!",
:to => "+1415XXXXXXX", # Replace with your phone number
:from => "+1415XXXXXXX") # Replace with your Twilio number
puts message.sid
ngrok 配置已在版本 2
中更改ngrok 易于安装。为任何主要平台下载零 运行 时间依赖性的单个二进制文件。将其解压缩,然后从命令行 运行。
$ unzip /path/to/ngrok.zip
现在运行喜欢下面
$ ./ngrok http 3000