我正在尝试从付款意图(其中网站中的用户按下付款来支付商品)和付款链接(他收到一个链接,然后他可以通过该链接付款)读取 webhook 响应试图找出如何区分它们,但我找不到区别。是否有标志或其他东西可以区分哪一个已付款
我正在使用带有braintree沙箱的braintree gem并尝试设置web钩子.我有以下代码:
class PaymentsController < ApplicationController
def webhooks
challenge = request.params["bt_challenge"]
challenge_response = Braintree::WebhookNotification.verify(challenge)
return [200, challenge_response]
end
end
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,当我在braintree的网站上按"创建网络钩子"时,我被告知:
Destination could not be verified.
Run Code Online (Sandbox Code Playgroud)
我检查了服务器日志并且它正在接收请求,但是由于某种原因返回http 500并说出以下内容:
2014-04-09T23:39:19.937280+00:00 app[web.1]: Completed 500 Internal Server Error in 71ms
2014-04-09T23:39:19.941486+00:00 app[web.1]: ActionView::MissingTemplate (Missing template payments/webhooks, application/webhooks with {:locale=>[:en], :formats=>[:xml, :html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :arb, :jbuilder, :haml]}. Searched in:
Run Code Online (Sandbox Code Playgroud)
这表明控制器正在寻找视图而无法找到它.我不知道该怎么做.Web挂钩操作中的代码直接来自braintree的网站:https://www.braintreepayments.com/docs/ruby/guide/webhook_notifications …
我是一名学生,正在尝试使用mandrill并且说实话,我不知道我在做什么.我能够在.net中使用mandrill发送电子邮件没有问题我现在要做的是使用webhooks来捕获当前的退回电子邮件,也许更多一次我完成了.
这是我到目前为止的代码(来自互联网)
public ActionResult HandleMandrillWebhook(FormCollection fc)
{
string json = fc["mandrill_events"];
var events = JsonConvert.DeserializeObject<IEnumerable<Mandrill.MailEvent>>(json);
foreach (var mailEvent in events)
{
var message = mailEvent.Msg;
// ... Do stuff with email message here...
}
// MUST do this or Mandrill will not accept your webhook!
return new HttpStatusCodeResult((int)HttpStatusCode.OK);
Run Code Online (Sandbox Code Playgroud)
然后我有了这个
public class MailEvent
{
[JsonProperty(PropertyName = "ts")]
public string TimeStamp { get; set; }
[JsonProperty(PropertyName = "event")]
public string Event { get; set; }
[JsonProperty(PropertyName = "msg")]
public Message Msg { …Run Code Online (Sandbox Code Playgroud) 为什么我会像这样获得客户ID和发票ID cus_0000000000000和in_0000000000000?在条纹webhook响应中。我正在检查我的帐户中的事件和响应,我得到了200的响应,但是却获得了客户ID和发票ID,为什么?我正在检查发送测试webhook事件,我得到了这样的响应。
public function actionStripeHook() {
if (Yii::app()->request->isPostRequest) {
try {
$postdata = file_get_contents("php://input");
$event = json_decode($postdata);
switch ($event->type) {
case 'invoice.payment_succeeded':
Yii::log('', 'trace', 'stripe');
Yii::log('==================================', 'trace', 'stripe');
Yii::log('==== Event (' . $event->type . ') ====', 'trace', 'stripe');
Yii::log('==================================', 'trace', 'stripe');
$customer_id = $event->data->object->customer;
$customer = Stripe_Customer::retrieve($customer_id);
$invoice = Stripe_Invoice::retrieve($event->data->object->id);
Run Code Online (Sandbox Code Playgroud)
}
我的代码有什么问题,这是我在条纹Webhook端点中的操作,我收到了事件类型invoice.payment_succeeeeeed该事件来自这种情况,但是在我的Response.s中无法正确获取客户ID和发票ID。为什么?
我有主题为Order Updated的 webhook 。Webhook在someotherdomain.com上提供有效负载(订单信息)。我想从结帐表单中添加其他字段,并将其与订单信息一起发送到someotherdomain.com。
我通过以下方式创建了自定义结帐字段:
add_action( 'woocommerce_after_order_notes', 'fs_custom_checkout_field' );
function fs_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h2>' . __('Extra Information') . '</h2>';
woocommerce_form_field( 'fs_psid_field', array(
'type' => 'text',
'class' => array('my-field-class form-row-wide'),
'label' => __('Fill in this field'),
'placeholder' => __('Enter something'),
), $checkout->get_value( 'fs_psid_field' ));
echo '</div>';
Run Code Online (Sandbox Code Playgroud)
}
并将meta保存为:
add_action( 'woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' );
function my_custom_checkout_field_update_order_meta( $order_id ) {
if ( ! empty( $_POST['fs_psid_field'] ) ) {
update_post_meta( $order_id, 'fs_psid_field', sanitize_text_field( $_POST['fs_psid_field'] ) );
}
}
Run Code Online (Sandbox Code Playgroud)
但是字段fs_psid_field不会通过webhook发布。 …
这是来自 Xero 的参数
{"events"=>nil,
"firstEventSequence"=>0,
"lastEventSequence"=>0,
"entropy"=>"KFDXIMNLPDAMRBOEVAVF",
"controller"=>"admin/billing/webhooks",
"action"=>"handle_hook",
"webhook"=>
{"events"=>nil,
"firstEventSequence"=>0,
"lastEventSequence"=>0,
"entropy"=>"KFDXIMNLPDAMRBOEVAVF"}}
Run Code Online (Sandbox Code Playgroud)
我想验证Intent To Receive https://developer.xero.com/documentation/webhooks/configuring-your-server#intent
data = {"events"=>nil, "firstEventSequence"=>0, "lastEventSequence"=>0, "entropy"=>"KFDXIMNLPDAMRBOEVAVF"}
Key = HRj6QPub9BNE4MWewrcLrkKFjpiikV1KrlMZCvDawyDR95MGkkuE2y1DXFP1tifsEWaJygLx6zG0r9rXVTflcg==
Run Code Online (Sandbox Code Playgroud)
下面尝试过
Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), key, data)).strip()
*** TypeError Exception: no implicit conversion of ActionController::Parameters into String
Run Code Online (Sandbox Code Playgroud)
或者
hash = OpenSSL::HMAC.digest('sha256', key, data)
*** TypeError Exception: no implicit conversion of ActionController::Parameters into String
Run Code Online (Sandbox Code Playgroud)
在这里如何实现这一目标?
为了确保您收到的请求来自 Xero,您需要验证 x-xero-signature 标头中提供的签名。创建或重新启用 Webhook 订阅(或更新订阅 URL)时,系统将提示用户启动“接收意图”验证。此验证过程将是对订阅中提供的 url 的一系列 HTTPS POST 请求。
编辑 Rails 正在将空白数组转换为 nil,所以我自己制作了有效负载,根据文档看起来完全相同
data = params[:webhook]
payload = …Run Code Online (Sandbox Code Playgroud) 我想为我的 Github 存储库创建一个徽章,该徽章根据我在每次提交时作为 Webhook 运行的设置脚本显示为失败或通过。
这将是一个自定义脚本,并且将在每次提交时运行,我如何才能创建它?
我阅读了有关我发现的webhook的所有可能信息,但是没有关于为什么使用webhooks而不是Https Request更容易的答案.
我构建了API,当我的服务器上发生某些操作时,需要通知用户的服务器.用户向我提供了一个URL,我需要将Webhooks或HTTP Post Request发送到该特定URL.
我可以使用cron作业并在服务器上发生新事件时发送HTTP post请求.为什么我需要使用webhooks,如果有更简单的方法可以做到这一点?
webhooks优于API请求的优势是什么?使用Webhooks而不是HTTP POST请求有什么好处?
创建或更新新记录时,将触发 Webhook 并在帖子正文中发布三个键。名为有效负载的键之一包含带有记录属性的编码 JSON。
这是 POST 正文消息的示例:请参阅此处的有效负载
我希望当 webhook 触发时它会创建一个文件并将日期发布到该文件,但我得到的有效负载为空。
这是代码。
<?php
/**
* Created by PhpStorm.
* User: Lee N
* Date: 16/07/2018
* Time: 14:46
*/
$data = file_get_contents('php://input');
//decode JSON data to PHP array
$content = json_decode($data, true);
if($content ==""){
$data = "Payload fired but no datkhkjhkjhjka";
}else{
$data = $content;
}
$pagename = 'from_vend';
$newFileName = $pagename.".txt";
if (file_put_contents($newFileName, $data) !== false) {
echo "File created (" . basename($newFileName) . ")";
} else {
echo …Run Code Online (Sandbox Code Playgroud)