Reputation: 2397
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 ?
Upvotes: 3
Views: 2004
Reputation: 27
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.
Upvotes: -1