Jump to content

Recommended Posts

Hi

 

I have created a site that when users are logged in, they click a link which takes them to PayPal to pay and then returned to a form page to fill out a job advert, it all works perfect apart from one little issue I have

 

after they submitted the job advert form and is added to the db, they close the page after logging out and then open that page again, they can add another job advert again without paying so was seeing if there is any coding that checks if they have not paid and it redirects them to a error page if they not paid and try accessing the job advert form page

 

Hope that makes sense

 

Thank you in advance

 

Ian

Link to comment
https://forums.phpfreaks.com/topic/300074-paypal-payment-access-page-issue/
Share on other sites

This is the script I am using that works apart from the return url issue where they can access the return url again without paying so need a way of checking if the user has paid or not

 

http://www.sanwebe.com/2012/07/paypal-expresscheckout-with-php

Edited by ianhaney

Think I figured a way round it but unsure how to code it

 

in BuyerTable I have added a paid and complete column so when the payment is made via PayPal the paid column gets updated to a 1 for Yes, I have set it to default of 0 for No and then when they submit the job advert the complete column gets updated to a 1, again I have set that to a default of 0

 

it's the coding where I am getting stuck, I am completing the payment and takes me to the return url but the paid column is not being updated to a 1

 

below is the coding I have from my process.php file that does the PayPal API that adds the transaction to the db

$insert_row = $mysqli->query("INSERT INTO BuyerTable 
                    (BuyerName,BuyerEmail,TransactionID,ItemName,ItemNumber,ItemAmount)
                    VALUES ('$buyerName','$buyerEmail','$TransactionID','$ItemName','$ItemNumber', '$ItemTotalPrice')");
					
					$update_row = $mysqli->query("UPDATE BuyerTable SET paid = 'Y' WHERE TransactionID = '$TransactionID'");

Sorry I been playing around with it more and modified the UPDATE query some more and it updates to 1 so think I sussed it if someone can confirm it is correct or if is a batter way etc

 

UPDATE BuyerTable SET paid = 1 WHERE buyerEmail = '$buyerEmail'

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.