Skip to content

Instantly share code, notes, and snippets.

View cybernerdie's full-sized avatar
🌜
Software Engineer

Joshua Paul cybernerdie

🌜
Software Engineer
View GitHub Profile
@joekenpat
joekenpat / handle_paystack_payment_callback.php
Created June 16, 2021 08:58
Handle paystack payment callback with Laravel Http
/**
* Obtain Paystack payment information
* @return void
*/
public function handleUserFeeViaPaystackCallback(Request $request)
{
//Instantiate Laravel Http get request to Paystack Veryify API route
//passing paystack secret key as Bearer token.
$paystack_client = Http::withToken(config('paystack.secretKey'))
//----------------------------------------------> attach the transaction ref from the request URl
@joekenpat
joekenpat / paystack_create_charge_with laravel_http.php
Created June 16, 2021 08:49
Create a new Paystack charge using Laravel Http Request
public function userPayFeeViaPaystack()
{
//instantiate Laravel Http Client and pass paystack secret key as a bearer token
$paystack = Http::withToken(config('paystack.secretKey'))
->post('https://api.paystack.co/transaction/initialize', [
//email for the user making the payments
'email' => '[email protected],
//amount must be in kobo hence: the multiplication by 100
'amount' => 1500 * 100,
'quantity' => 1,