dongtan7639 2015-12-14 15:34
浏览 71

如何使用支付网关的重定向链接更新mysql数据库?

On my site, expiry.php script checks expiry date of member from cron job and if it is between 12 days from today, email is sent to member.

That email contains a renewal link with variables related to member.

I am using Instamojo payment gateway with API details on https://www.instamojo.com/developers/request-a-payment-api/

e.g. my code and current link for payment in expiry.php to send email is like

<?php
include("db.php");
$sql=".......";
$name = $data['name']; //fetched from database
$email = $data['email'];
$mobile = $data['mobile'];
$payment_fees = "520";
$url = "https://paymentgateway-website.com/myaccountname/?data_name=".$name."&data_email=".$email."&data_phone=".$mobile."&data_amount=".$payment_fees."&data_readonly=data_name&data_readonly=data_email&data_readonly=data_phone&data_readonly=data_amount";

$url = htmlentities($url);
ob_start();
?>


    <div>
Hello <?=$data['name']?>,
<a href="<?php $url;?>">Click Here</a> To pay Now.
    </div>

<?php 
   $body=ob_get_clean();


    $to = $data["email"];
    .
    .

 ?>

This email is sent perfectly with payment link specifically for member with included member name, email and mobile in it and payment form is populated in browser with readonly fields containing user name, email, mobile, amount.

This payment link has success redirect link with thanks.php on my site.

I want to update my database when user pays fees and get redirected to my site's thanks.php page.

I think , I can not create session as user is going to payment link from email and returning back to my site after successful payment.

What can be solution to put in thanks.php on my site to update my mysql database like

$sql = "update tablename SET `payment_status` = "1" where reg_id = "????(what to enter)?" 

How to get reg_id in mysql database when user pays successfully ?

  • 写回答

1条回答 默认 最新

  • dscqrkvr9562034621 2016-02-01 08:40
    关注

    You can use the webhook url feature of instamojo. It will give all details of transaction and on that page you can write your MySQL query to store response.

    评论

报告相同问题?

悬赏问题

  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线