$txn->amount = $paymentAmount; $txn->userId = Privacy::getId(); if (!$filtered['support-userId']) { $txn->forId = Privacy::getId(); } else { $txn->forId = $filtered['support-userId']; } $txn->isAlliance = 0; $t->uid = $filteredG['uid']; if ($filtered['paypal-submit_x']) { $txnId = $txn->create(); $pp = new Paypal(); if(!$pp->step1And2($txn)) { //Redirecting to APIError.php to display errors. $error = 3; } } } switch ($error) { // return URL (success) case 1: break; case 2: // cancel $t->err = 'Your transaction was cancelled'; break; case 3: // api error