Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mspace's avatar

Paystack intergration in laravel

I want to integrate paystack to my current project. Do i treat it as raw php or is there a procedure for this on laravel

0 likes
18 replies
mspace's avatar

I ran "composer require unicodeveloper/laravel-paystack" and I keep getting this:

- Installation request for laravel/framework (locked at v6.6.0, required as ^6.2) -> satisfiable by laravel/framework[v6.6.0].

- Installation request for unicodeveloper/laravel-paystack ^1.0 -> satisfiable by unicodeveloper/laravel-paystack[1.0.0, 1.0.1, 1.0.2].


-Installation failed, reverting ./composer.json to its original content.
mspace's avatar

is there an alternative to this or i just have to wait?

Nakov's avatar

You can install or downgrade laravel to a prior release, or just check on Google how you can pull from a PR that has not been merged yet :)

I don't know of any other package.

mspace's avatar

Is it possible for me to downgrade laravel from v6 to v5 so i can use the paystack plugin?

Agoi's avatar

You do not have to use a library, you could just make a CURL request to the paystack endpoint. Below is an example of how to confirm payment:

    /**
     * Handle the process of verifying BVN
     *
     * @param  $bvn
     * @return
     */
    public function confirmBvn($bvn)
    {
          $url = 'https://api.paystack.co/bank/resolve_bvn/'.$bvn;

          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, $url);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt(
            $ch, CURLOPT_HTTPHEADER, [
              'Authorization: Bearer sk_test_da5d641bf00am6413a188c2b383c4b263823e195a5'
            ]
          );
          $request = curl_exec($ch);
          curl_close($ch);

          if ($request) {
            $result = json_decode($request, true);
            return $result;
          }
    }

That I used within my code.

Nakov's avatar

Of course it is, but it is much better to create a new app if you just started, so just check which version the package supports and install a project with that specific version.

mspace's avatar

i want to implement the paystack in my website from scratch. Can you talk me through it or link me to an article about it without having to use the library.

Agoi's avatar

I already give you the code above to help you do it without the package. Observe the code properly, its a method.

All you have to do is pass the bvn to it and change to your Authorization Header

mspace's avatar

I am a little bit confused atm. I have everything working fine but i am trying to set up webhooks. Have you done that yet?

tim_oladoyinbo's avatar

I know this thread is quite old but in case anyone still has a need for an answer:

  1. The Laravel package: https://github.com/unicodeveloper/laravel-paystack has been updated. You can now use it in on Laravel 5, 6 and 7. Follow the instructions and you'll up and running in no time.

  2. For Paystack webhooks, I've just created a package to handle paystack webhooks. https://github.com/digikraaft/laravel-paystack-webhooks. It's pretty straight forward, just follow the instructions!

Macclinson's avatar

@tim_oladoyinbo Hi, tim i am trying integrate Paystack on Laravel 10 project with inertia the package you mention didn't cover Laravel 10 any work around to get this done?

Webprotocol's avatar

Hi Tim, I have a site using bookingcore which is based on laravel. I need someone that can help integrate paystack there seem not to be a paystack plugin for bookingcore yet. Can you help with this? We can discuss it further

Thecreativedev's avatar

Hi web protocol, have you gotten a solution yet? I would love to help

Please or to participate in this conversation.