Jump to content

FabrizioCo

New Members
  • Posts

    3
  • Joined

  • Last visited

FabrizioCo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Resolved! Call me stupid. I hadn't changed the url of the file that the PayPal IPN connects to.
  2. Thank you so much everyone for answering me. Barand I added the line you suggested. The problem is that the file with the insert communicates with Paypal via IPN and I have no way of seeing if any errors are notified. If I click on it I am obviously redirected to Paypal Sandbox, so I'm afraid there is no way to debug https://edencamp.it/sorgente/payments.php
  3. Hi, for PHP integration with PayPal I found this very useful, clear, and simple tutorial https://serverguy.com/learn/paypal-integration-in-php/ It is very interesting because it allows you to pass parameters to PayPal in a "hidden" way, without having to put them in hidden fields. However, I have problems with the section of code used to read the response from PayPal. Here it is. // Handle the PayPal response. // Create a connection to the database. $db = new mysqli($dbConfig['host'], $dbConfig['username'], $dbConfig['password'], $dbConfig['name']); // Assign posted variables to local data array. $data = [ 'item_name' => $_POST['item_name'], 'item_number' => $_POST['item_number'], 'payment_status' => $_POST['payment_status'], 'payment_amount' => $_POST['mc_gross'], 'payment_currency' => $_POST['mc_currency'], 'txn_id' => $_POST['txn_id'], 'receiver_email' => $_POST['receiver_email'], 'payer_email' => $_POST['payer_email'], 'custom' => $_POST['custom'], ]; // We need to verify the transaction comes from PayPal and check we've not // already processed the transaction before adding the payment to our // database. if (verifyTransaction($_POST) && checkTxnid($data['txn_id'])) { if (addPayment($data) !== false) { // Payment successfully added. } } I added a very simple INSERT, but there is no way to make it work: the data is not saved in the database. // We need to verify the transaction comes from PayPal and check we've not // already processed the transaction before adding the payment to our // database. if (verifyTransaction($_POST) && checkTxnid($data['txn_id'])) { if (addPayment($data) !== false) { // Payment successfully added. $sql = "INSERT INTO prenotazioni_date (id_prenotazione, tariffa_notte) VALUES ('1', '102.00')"; $db->query($sql); } } } I also tried to move the INSERT to other parts of the code, outside the IF, but nothing to do. I want to specify that the records in the payments table are inserted without any problem. It was 7 years that I hadn't programmed anymore and I'm afraid I got a little rusty.
×
×
  • 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.