dongqian1028 2016-07-29 23:03
浏览 128

从wordpress中的其他站点接收webhook


I am developing a plugin for courier management system
The plugin includes payment gateway (Instamojo) integration.
Successfully completed payment gateway integration by creating payment request.

In the payment process, This payment gateway will gives detailed data of transaction using webhooks. Im unable to get values from webhooks in wordpress

My try
The code for initiating payment is down below,

try {
$response = $api->paymentRequestCreate(array(
    "buyer_name" => $_POST['name_f'],
     "purpose" => "#order :".$info_f['serno'],
    "amount" => $info_f['totalprice'],
   "send_email" => true,
    "email" => $info_f['emailid'],
    "redirect_url" => "http://www.mywebsite.in/thank-you",
    "webhook" => "http://www.mywebsite.in/thank-you"
    ));
    print_r($response);
    header('Location:'.$response['longurl']);
    }
    catch (Exception $e) {
   print('Error: ' . $e->getMessage());
 }

(Not sure about webhook url)
Now at the thank you page, i have added a shortcode [cm-thankyou], the function is in thankyou.php

function cm_redback(){

echo "THANK YOU<br>";
print_r($_POST);
 }
add_shortcode( 'cm-thankyou', 'cm_redback' );

I tried printing the $_POST (i heard webhooks will be in $_POST) but unable to get the webhook working.
Please help me to get this working, I searched a lot in google and hit dead-end without getting any results.

These are instamojo integration guides, i referred.
https://docs.instamojo.com/docs/payments-api
https://github.com/Instamojo/instamojo-php.

Thanks in advance :)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题