digikraaft / laravel-paystack-webhooks Goto Github PK
View Code? Open in Web Editor NEWHandle Paystack Webhooks in a Laravel application
License: MIT License
Handle Paystack Webhooks in a Laravel application
License: MIT License
When i try running the webhook i keep getting the AccessDeniedException and for some reason i believe the request header here might be the problem
if ((! $request->isMethod('post')) || ! $request->header('HTTP_X_PAYSTACK_SIGNATURE', null)) {
throw new AccessDeniedHttpException("Invalid Request");
}
Because when i did this
$request->header('x-paystack-signature');
It works, kindly look into this please. Also my credentials are correct
Also the WebhooksController needs to be changed to this
public function handleWebhook(Request $request): \Symfony\Component\HttpFoundation\Response
{
$payload = json_decode($request->getContent(), true);
$method = 'handle'.Str::studly(str_replace('.', '_', $payload['event']));
WebhookReceived::dispatch($payload);
if (method_exists($this, $method)) {
$response = $this->{$method}($payload);
WebhookHandled::dispatch($payload);
return $response ?? $this->successMethod();
}
return $this->missingMethod();
}
Sorry there is no issue but I want to ask if you have a demo or an example for us to follow. Thanks for this amazing package :)
Hello anyone, I followed your instruction and added webhook url in Paystack dasboard but no event data returned from paystack to my website.
Controller:
<?php
namespace App\Http\Controllers\Web;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Digikraaft\PaystackWebhooks\Http\Controllers\WebhooksController as PaystackWebhooksController;
class WebhookController extends PaystackWebhooksController
{
/**
* Handle charge success.
*
* @param array $payload
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handleChargeSuccess($payload)
{
try {
Log::info("Received charge.success event");
Log::info(json_encode($payload));
} catch (\Exception $e) {
Log::error($e->getMessage());
}
}
}
Route - web.php
Route::post("/paystack/webhooks", [WebhookController::class, "handleChargeSuccess"]);
VerifyCsrfToken
protected $except = [
'paystack/*',
];
.env
PAYSTACK_SECRET_KEY=sk_live_...
PAYSTACK_PUBLIC_KEY=pk_live_...
PAYSTACK_WEBHOOK_PATH=paystack
config.php
'public_key' => env('PAYSTACK_PUBLIC_KEY'),
'secret' => env('PAYSTACK_SECRET_KEY'),
'webhook_path' => env('PAYSTACK_WEBHOOK_PATH', 'paystack'),
webhook path url
https://phplaravel-99.cloudwaysapps.com/paystack/webhooks
What did I miss? Please help me out. Thanks
Hi team, I noticed that you can not install this package on a Laravel version 8.75๐ข
Hello team,
I hope this gets resolved soon.
Whenever a request is made on a class with an inheritance from the WebhooksController class inside of the Digikraaft package, it always returns a 403 forbidden error.
The error is not as descriptive making it seemingly impossible to debug what the problem could be.
I'd be on the lookout for some assistance in resolving this issue.
i require and updated version of guzzle http in my project but this package require older version, thereby creating conflicts.
this is the response i get
`Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires digikraaft/laravel-paystack-webhooks ^1.1 -> satisfiable by digikraaft/laravel-paystack-webhooks[v1.1.0].
- digikraaft/laravel-paystack-webhooks v1.1.0 requires guzzlehttp/guzzle ^6.5 -> found guzzlehttp/guzzle[6.5.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.3).
Installation failed, reverting ./composer.json to its original content.`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.