After following all the direction on git on unicodeveloper/laravel-paystack
set up,created paystack.php in config,adding 'Paystack' => Unicodeveloper\Paystack\Facades\Paystack::class
in alliases and add class in providers, I still have error Class 'Paystack' not found.
I have tried everything possible but to no avail, I added Unicodeveloper\Paystack\Paystack::genTranxRef()
the full path inline in the form and it worked but got a different error 'Non-static method Unicodeveloper\Paystack\Paystack::genTranxRef()
should not be called statically'
form input: <input type="hidden" name="reference" value="">
Controller use Illuminate\Http\Request;
use \Unicodeveloper\Paystack\Paystack;
use App\Http\Requests;
use App\Http\Controllers\Controller;
`class PaymentController extends Controller { /** * Redirect the User to Paystack Payment Page * @return Url */
public function redirectToGateway(Request $request)
{
$paystack = new Paystack();
$user = Auth::user();
$request->email = $user->email;
$request->orderID = '3';
$request->amount = '200000';
$request->quantity = '1';
$request->reference = $paystack->genTranxRef();
$request->key = config('paystack.secretKey');
return $paystack->getAuthorizationUrl()->redirectNow();
}
/**
* Obtain Paystack payment information
* @return void
*/
public function handleGatewayCallback(Request $request)
{
$paystack = new Paystack();
$paymentDetails = Paystack::getPaymentData();
dd($paymentDetails);
// Now you have the payment details,
// you can store the authorization_code in your db to allow for enter code hererecurrent subscriptions
// you can then redirect or do whatever you want
}
}`
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire