Soldato
I've built a very simple php shop on my site. You add and remove items, click the Paypal button and it uses Paypal express checkout to charge the user through Paypal.
The javascript function looks like this -
In the function I'm trying to set a session variable that can then be checked on the success page, where the database gets updated and an email gets sent to me with the order.
My problem is, the php code, setting the variable happens even if the payment isn't authorised, so you can load things into the basket, load the success page and the database gets updated and I get an email.
So, what method can I use to let the success page know it's been called because this function was run, that can't be spoofed by someone? I'm sure I should know, but can't think how
Thanks!
The javascript function looks like this -
Code:
// onAuthorize() is called when the buyer approves the payment
onAuthorize: function(data, actions) {
// Make a call to the REST api to execute the payment
return actions.payment.execute().then(function() {
<?php
$_SESSION['paid'] = 1;
?>
window.location.href = "shop_success.php";
});
}
In the function I'm trying to set a session variable that can then be checked on the success page, where the database gets updated and an email gets sent to me with the order.
My problem is, the php code, setting the variable happens even if the payment isn't authorised, so you can load things into the basket, load the success page and the database gets updated and I get an email.
So, what method can I use to let the success page know it's been called because this function was run, that can't be spoofed by someone? I'm sure I should know, but can't think how
Thanks!