Hey, so I've been working on a PayPal checkout system, I finished my return success URL.. and the page doesn't show anything, no matter what. Also doesn't give me any errors (I checked the error log), and as-well checked with phpcodechecker.com and nothing.
Here's my coding:
<?phpuse PayPal\Api\Payment;use PayPal\Api\PaymentExecution; require '../src/start.php'; // Sanitize just in case? $approved = htmlspecialchars($_GET['approved']); $package = htmlspecialchars($_GET['package']); $userID = htmlspecialchars($_GET['userID']); $secretHash = htmlspecialchars($_GET['secretHash']); if (isset($approved) && isset($package) && isset($userID) && isset($secretHash)) { // Encrypt these $userID_enc = openssl_digest(''.$user->ID.'', 'sha512'); $secretHash_enc = openssl_digest(''.$user->privHash.'', 'sha512'); // Verify the $_GETs $approved_check = $approved === 'true'; $package_check = $package === $package; $userID_check = $userID === $userID_enc; $secretHash_check = $secretHash === $secretHash_enc; if ($approved_check && $package_check && $userID_check && $secretHash_check) { $payerId = $_GET['PayerID']; // Get payment_id from database $paymentId = $db->prepare(" SELECT payment_id FROM transactions_paypal WHERE hash = :hash "); $paymentId->execute([ 'hash' => $_SESSION['paypal_hash'] ]); // Update Transaction $updateTransaction = $db->prepare(" UPDATE transactions_paypal SET status = 'paid' WHERE payment_id = :payment_id "); $updateTransaction->execute([ 'payment_id' => $payment_id ]); $payment = $paymentId->fetchObject()->payment_id; // Accept payment $payment = Payment::get($paymentId, $api); // Charge User $execution = new PaymentExecution(); $execution->setPayerId($payerId); $payment->execute($execution, $api); } else { echo "Something went wrong."; } } else { echo "Seomething went wrong."; }