where('id', $invoiceid)->first(); $userid = $invoice->userid; // Checks transaction number isn't already in the database and ends processing if it does checkCbTransID($transid); // Successful $fee = 0; // left blank, this will auto-fill as the full balance $amount = ''; switch ($response['status']) { case 'paid': // New payment, not confirmed logTransaction($GATEWAY['name'], $response, 'The payment has been received, but the transaction has not been confirmed on the bitcoin network. This will be updated when the transaction has been confirmed.'); break; case 'confirmed': // Apply Payment to Invoice Capsule::table('tblclients')->where('id', $userid)->update(array('defaultgateway' => $gatewaymodule)); addInvoicePayment($invoiceid, $transid, $amount, $fee, $gatewaymodule); logTransaction($GATEWAY['name'], $response, 'The payment has been received, and the transaction has been confirmed on the bitcoin network. This will be updated when the transaction has been completed.'); break; case 'complete': // Apply Payment to Invoice Capsule::table('tblclients')->where('id', $userid)->update(array('defaultgateway' => $gatewaymodule)); addInvoicePayment($invoiceid, $transid, $amount, $fee, $gatewaymodule); logTransaction($GATEWAY['name'], $response, 'The transaction is now complete.'); break; case 'expired': case 'invalid': // Bad payment transaction logTransaction($GATEWAY['name'], $response, 'The transaction is invalid. Do not process this order!'); break; default: logTransaction($GATEWAY['name'], $response, 'Unknown response received.'); } }