PHPackages                             nicholasmt/switchappgo-library - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. nicholasmt/switchappgo-library

ActiveLibrary[API Development](/categories/api)

nicholasmt/switchappgo-library
==============================

This is a Laravel library package for switchApp Api

17PHP

Since Jun 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Nicholasmt/switchappgo-package)[ Packagist](https://packagist.org/packages/nicholasmt/switchappgo-library)[ RSS](/packages/nicholasmt-switchappgo-library/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![](https://camo.githubusercontent.com/48ada78ceabea4aa169829560251da8ee5eee51ce057552ff6fe270c4d6832f7/68747470733a2f2f64617368626f6172642e737769746368617070676f2e636f6d2f7377697463686170702d6c6f676f2e737667)](https://camo.githubusercontent.com/48ada78ceabea4aa169829560251da8ee5eee51ce057552ff6fe270c4d6832f7/68747470733a2f2f64617368626f6172642e737769746368617070676f2e636f6d2f7377697463686170702d6c6f676f2e737667)
=================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#)

Laravel Package
===============

[](#laravel-package)

This is a laravel library package for SwitchApp Api payment engine.

To get Started Run
==================

[](#to-get-started-run)

```
composer require nicholasmt/switchappgo-library

```

Note: if You encounter this or any other error which means you are using the old version of that package

```
Your requirements could not be resolved to an installable set of packages.
```

To Resolve simply run

```

 composer update

```

After successfull composer update then install the package again with `composer require nicholasmt/zoom_library`

Note: if you encounter any error based on poor network on updating composer,

just backup the vender file, delete and run composer update again with `composer update`

Configuire .env file as below:

```
SWITCHAPP_SECRET_KEY = "your switchapp secret key"
```

Create a Controller

```
php artisan make:controller SwitchAppController

```

Require Package using:

```
use Nicholasmt\Switchappgo\Switchappgo;
```

To verify transaction using the API callback use the code below

```

        $tx_ref = $request->query('tx_ref');
        $switchapp = new Switchappgo();
        $transaction_response = $switchapp->SwitchappAPI('GET', 'https://api.switchappgo.com/v1/transactions/verify/'.$tx_ref, false);
        $response = json_decode($transaction_response);

        if($response->status == 'success')
        {
             //code here

         }
        else
        {
           //code here
        }

```

Then Finally Setup callback Route

```
Route::get('switchapp', [App\Http\Controllers\SwitchAppController::class, 'switchappCallback'])->name('switchappgo');
```

What the Controller will look like:

```
