PHPackages                             emydev/laravel\_paytabs - 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. emydev/laravel\_paytabs

ActiveComposer-package

emydev/laravel\_paytabs
=======================

Official laravel package to implement PayTabs integration with laravel apps

1.1.1(4y ago)0550MITDartPHP ^7.0.0

Since May 20Pushed 1y agoCompare

[ Source](https://github.com/EmyDevWork/paytabs-php-laravel-package)[ Packagist](https://packagist.org/packages/emydev/laravel_paytabs)[ Docs](https://site.paytabs.com/en/)[ RSS](/packages/emydev-laravel-paytabs/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (4)Used By (0)

💳 Paystack Plugin for Flutter
=============================

[](#credit_card-paystack-plugin-for-flutter)

[![build status](https://camo.githubusercontent.com/574b184a7de20ca3da0c60d7c2069a7e28f481514a705a8d4399dabb0936f99d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f77696c627572742f666c75747465725f706179737461636b2f4275696c64253230616e6425323054657374)](https://github.com/wilburt/flutter_paystack/actions?query=Build+and+test)[![Coverage Status](https://camo.githubusercontent.com/453ef4d9529c146b4697107edf510c2324560be83af0f1414862ad88e4b89495/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f77696c627572742f666c75747465725f706179737461636b2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/wilburt/flutter_paystack?branch=master)[![pub package](https://camo.githubusercontent.com/6c14dcfb382bdaac933320ec3a4cb7eb697cee5781a26fff1f9eed541d9b83bb/68747470733a2f2f696d672e736869656c64732e696f2f7075622f762f666c75747465725f706179737461636b2e737667)](https://pub.dartlang.org/packages/flutter_paystack)

 [![](https://raw.githubusercontent.com/wilburt/flutter_paystack/master/screenshots/card_payment.png)](https://raw.githubusercontent.com/wilburt/flutter_paystack/master/screenshots/card_payment.png) [![](https://raw.githubusercontent.com/wilburt/flutter_paystack/master/screenshots/bank_payment.png)](https://raw.githubusercontent.com/wilburt/flutter_paystack/master/screenshots/bank_payment.png)

A Flutter plugin for making payments via Paystack Payment Gateway. Fully supports Android and iOS.

🚀 Installation
--------------

[](#rocket-installation)

To use this plugin, add `flutter_paystack` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

Then initialize the plugin preferably in the `initState` of your widget.

```
import 'package:flutter_paystack/flutter_paystack.dart';

class _PaymentPageState extends State {
  var publicKey = '[YOUR_PAYSTACK_PUBLIC_KEY]';
  final plugin = PaystackPlugin();

  @override
  void initState() {
    plugin.initialize(publicKey: publicKey);
  }
}
```

No other configuration required—the plugin works out of the box.

💲 Making Payments
-----------------

[](#heavy_dollar_sign-making-payments)

There are two ways of making payment with the plugin.

1. **Checkout**: This is the easy way; as the plugin handles all the processes involved in making a payment (except transaction initialization and verification which should be done from your backend).
2. **Charge Card**: This is a longer approach; you handle all callbacks and UI states.

### 1. 🌟 Checkout (Recommended)

[](#1-star2-checkout-recommended)

You initialize a charge object with an amount, email &amp; accessCode or reference. Pass an `accessCode` only when you have [initialized the transaction](https://developers.paystack.co/reference#initialize-a-transaction)from your backend. Otherwise, pass a `reference`.

```
Charge charge = Charge()
      ..amount = 10000
      ..reference = _getReference()
       // or ..accessCode = _getAccessCodeFrmInitialization()
      ..email = 'customer@email.com';
    CheckoutResponse response = await plugin.checkout(
      context context,
      method: CheckoutMethod.card, // Defaults to CheckoutMethod.selectable
      charge: charge,
    );
```

Please, note that an `accessCode` is required if the method is `CheckoutMethod.bank` or `CheckoutMethod.selectable`.

`plugin.checkout()` returns the state and details of the payment in an instance of `CheckoutResponse` .

It is recommended that when `plugin.checkout()` returns, the payment should be [verified](https://developers.paystack.co/v2.0/reference#verify-transaction)on your backend.

### 2. ⭐ Charge Card

[](#2-star-charge-card)

You can choose to initialize the payment locally or via your backend.

#### A. Initialize Via Your Backend (Recommended)

[](#a-initialize-via-your-backend-recommended)

1.a. This starts by making a HTTP POST request to [paystack](https://developers.paystack.co/reference#initialize-a-transaction)on your backend.

1.b If everything goes well, the initialization request returns a response with an `access_code`. You can then create a `Charge` object with the access code and card details. The `charge` is in turn passed to the `plugin.chargeCard()` function for payment:

```
  PaymentCard _getCardFromUI() {
    // Using just the must-required parameters.
    return PaymentCard(
      number: cardNumber,
      cvc: cvv,
      expiryMonth: expiryMonth,
      expiryYear: expiryYear,
    );
  }

  _chargeCard(String accessCode) async {
    var charge = Charge()
      ..accessCode = accessCode
      ..card = _getCardFromUI();

    final response = await plugin.chargeCard(context, charge: charge);
    // Use the response
  }
```

The transaction is successful if `response.status` is true. Please, see the documentation of [CheckoutResponse](https://pub.dev/documentation/flutter_paystack/latest/flutter_paystack/CheckoutResponse-class.html)for more information.

#### 2. Initialize Locally

[](#2-initialize-locally)

Just send the payment details to `plugin.chargeCard`

```
      // Set transaction params directly in app (note that these params
      // are only used if an access_code is not set. In debug mode,
      // setting them after setting an access code would throw an error
      Charge charge = Charge();
      charge.card = _getCardFromUI();
      charge
        ..amount = 2000
        ..email = 'user@email.com'
        ..reference = _getReference()
        ..putCustomField('Charged From', 'Flutter PLUGIN');
      _chargeCard();
```

🔧 🔩 Validating Card Details
---------------------------

[](#wrench-nut_and_bolt-validating-card-details)

You are expected but not required to build the UI for your users to enter their payment details. For easier validation, wrap the **TextFormField**s inside a **Form** widget. Please check this article on [validating forms on Flutter](https://medium.freecodecamp.org/how-to-validate-forms-and-user-input-the-easy-way-using-flutter-e301a1531165)if this is new to you.

**NOTE:** You don't have to pass a card object to `Charge`. The plugin will call-up a UI for the user to input their card.

You can validate the fields with these methods:

#### card.validNumber

[](#cardvalidnumber)

This method helps to perform a check if the card number is valid.

#### card.validCVC

[](#cardvalidcvc)

Method that checks if the card security code is valid.

#### card.validExpiryDate

[](#cardvalidexpirydate)

Method checks if the expiry date (combination of year and month) is valid.

#### card.isValid

[](#cardisvalid)

Method to check if the card is valid. Always do this check, before charging the card.

#### card.getType

[](#cardgettype)

This method returns an estimate of the string representation of the card type(issuer).

✔️ Verifying Transactions
-------------------------

[](#heavy_check_mark-verifying-transactions)

This is quite easy. Just send a HTTP GET request to `https://api.paystack.co/transaction/verify/$[TRANSACTION_REFERENCE]`. Please, check the [official documentaion](https://developers.paystack.co/reference#verifying-transactions) on verifying transactions.

🚁 Testing your implementation
-----------------------------

[](#helicopter-testing-your-implementation)

Paystack provides tons of [payment cards](https://developers.paystack.co/docs/test-cards) for testing.

▶️ Running Example project
--------------------------

[](#arrow_forward-running-example-project)

For help getting started with Flutter, view the online [documentation](https://flutter.io/).

An [example project](https://github.com/wilburt/flutter_paystack/tree/master/example) has been provided in this plugin. Clone this repo and navigate to the **example** folder. Open it with a supported IDE or execute `flutter run` from that folder in terminal.

📝 Contributing, 😞 Issues and 🐛 Bug Reports
------------------------------------------

[](#pencil-contributing-disappointed-issues-and-bug-bug-reports)

The project is open to public contribution. Please feel very free to contribute. Experienced an issue or want to report a bug? Please, [report it here](https://github.com/wilburt/flutter_paystack/issues). Remember to be as descriptive as possible.

🏆 Credits
---------

[](#trophy-credits)

Thanks to the authors of Paystack [iOS](https://github.com/PaystackHQ/paystack-ios) and [Android](https://github.com/PaystackHQ/paystack-android) SDKS. I leveraged on their work to bring this plugin to fruition.
===================================================================================================================================================================================================================

[](#thanks-to-the-authors-of-paystack-ios-and-android-sdks-i-leveraged-on-their-work-to-bring-this-plugin-to-fruition)

Laravel PayTabs PT2

Description
-----------

[](#description)

This Package provides integration with the PayTabs payment gateway.

CONTENTS OF THIS FILE
---------------------

[](#contents-of-this-file)

- Introduction
- Requirements
- Installation
- Configuration
- usage

INTRODUCTION
------------

[](#introduction)

This Package integrates PayTabs online payments into the Laravel Framework starts from version 5.8 - 8.x.

REQUIREMENTS
------------

[](#requirements)

This Package requires no external dependencies.

INSTALLATION
------------

[](#installation)

- composer require paytabscom/laravel\_paytabs

CONFIGURATION
-------------

[](#configuration)

- composer dump-autoload
- Go to *config/app.php* and in the providers array add

    ```
      Paytabscom\Laravel_paytabs\PaypageServiceProvider::class,

    ```
- Create the package config file:

    ```
      php artisan vendor:publish --tag=paytabs

    ```
- Go to *config/logging.php* and in the channels array add

    ```
    'PayTabs' => [
    'driver' => 'single',
    'path' => storage_path('logs/paytabs.log'),
    'level' => 'info',
    ],

    ```
- In *config/paytabs.php* add your merchant info.

**Important Hint:**you can pass your merchant info in the environment file with the same key names mentioned in the *config/paytabs.php* file. This value will be returned if no environment variable exists for the given key.

Usage
-----

[](#usage)

- create pay page

    ```
      use Paytabscom\Laravel_paytabs\Facades\paypage;

      $pay= paypage::sendPaymentCode('all')
             ->sendTransaction('sale')
              ->sendCart(10,1000,'test')
             ->sendCustomerDetails('Walaa Elsaeed', 'w.elsaeed@paytabs.com', '0101111111', 'test', 'Nasr City', 'Cairo', 'EG', '1234','100.279.20.10')
             ->sendShippingDetails('Walaa Elsaeed', 'w.elsaeed@paytabs.com', '0101111111', 'test', 'Nasr City', 'Cairo', 'EG', '1234','100.279.20.10')
             ->sendURLs('return_url', 'callback_url')
             ->sendLanguage('en')
             ->create_pay_page();
      return $pay;

    ```
- if you want to pass the shipping address as same as billing address you can use

    ```
      ->sendShippingDetails('same as billing')

    ```
- if you want to hide the shipping address you can use

    ```
      ->sendHideShipping(true);

    ```
- if you want to use iframe option instead of redirection you can use

    ```
      ->sendFramed(true);

    ```
- refund (you can use this function to both refund and partially refund)

    ```
      $refund = Paypage::refund('tran_ref','order_id','amount','refund_reason');
      return $refund;

    ```
- Auth

    ```
      pay= Paypage::sendPaymentCode('all')
             ->sendTransaction('Auth')
              ->sendCart(10,1000,'test')
             ->sendCustomerDetails('Walaa Elsaeed', 'w.elsaeed@paytabs.com', '0101111111', 'test', 'Nasr City', 'Cairo', 'EG', '1234','100.279.20.10')
             ->sendShippingDetails('Walaa Elsaeed', 'w.elsaeed@paytabs.com', '0101111111', 'test', 'Nasr City', 'Cairo', 'EG', '1234','100.279.20.10')
             ->sendURLs('return_url', 'callback_url')
             ->sendLanguage('en')
             ->create_pay_page();
      return $pay;

    ```
- capture (the tran\_ref is the tran\_ref of the Auth transaction you need to capture it.

    you can use this function to both capture and partially capture.)

    ```
       $capture = Paypage::capture('tran_ref','order_id','amount','capture description');
       return $capture;

    ```
- void (the tran\_ref is the tran\_ref of the Auth transaction you need to void it.

    you can use this function to both capture and partially capture)

    ```
      $void = Paypage::void('tran_ref','order_id','amount','void description');
      return $void

    ```
- transaction details

    ```
      $transaction = Paypage::queryTransaction('tran_ref');
      return $transaction;

    ```
- if you face any error you will find it logged in: *storage/logs/paytabs.log*

PAYMENT RESULT NOTIFICATION
---------------------------

[](#payment-result-notification)

PayTabs payment gateway provides means to notify your system with payment result once transaction processing was completed so that your system can update the transaction respective cart.

To get use of this feature do the following:

1- Defining a route (Optional)
------------------------------

[](#1--defining-a-route-optional)

Laravel PayTabs PT2 package comes with a default route for incoming IPN requests. The route URI is */paymentIPN* , if you don't like it this URI just ignore it and define your own. Look at *src/routes.php* to get a clue.

2- Implementing a means to receive notification
-----------------------------------------------

[](#2--implementing-a-means-to-receive-notification)

To receive notification, do one of the following:

- While creating a pay page, passed a URL as the second argument to *sendURLs* method, that URL will receive an HTTP Post request with the payment result. For more about callback check: **merchant dashboard** &gt; **Developers** &gt; **Transaction API**.
- Second means is to configure IPN notification from merchant dashboard. For more details about how to configure IPN request and its different formats check: **merchant dashboard** &gt; **Developers** &gt; **Service Types**.

3- Configuring a callback method
--------------------------------

[](#3--configuring-a-callback-method)

Now, you need to configure the plugin with the class\\method that will grab the payment details and perform your custom logic (updating cart in DB, notifying the customer ...etc ).

- In your website *config/paytabs.php* file, add the following:

    ```
      'callback' => env('paytabs_ipn_callback', new namespace\your_class() ),

    ```
- In your class add new method, it must named: **updateCartByIPN**

    ```
      updateCartByIPN( $requestData){
          $cartId= $requestData->getCartId();
          $status= $requestData->getStatus();
          //your logic .. updating cart in DB, notifying the customer ...etc
      }

    ```

you can also get transaction reference number. To get the list of available properties check: *Paytabscom\\Laravel\_\_paytabs\\IpnRequest* class.

###  Health Score

28

—

LowBetter than 57% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~83 days

Total

3

Last Release

1601d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/feb503cbf38f8026f8e0393893400556e303f629f8845853f3a88b1d9d7c4072?d=identicon)[EmyDev](/maintainers/EmyDev)

---

Top Contributors

[![wilburx9](https://avatars.githubusercontent.com/u/24422971?v=4)](https://github.com/wilburx9 "wilburx9 (163 commits)")[![asabra-paytabs](https://avatars.githubusercontent.com/u/82454211?v=4)](https://github.com/asabra-paytabs "asabra-paytabs (5 commits)")[![Walaa-Elsaeed-93](https://avatars.githubusercontent.com/u/79043296?v=4)](https://github.com/Walaa-Elsaeed-93 "Walaa-Elsaeed-93 (4 commits)")[![EmyDevWork](https://avatars.githubusercontent.com/u/59580879?v=4)](https://github.com/EmyDevWork "EmyDevWork (3 commits)")[![ahmed-elliethy](https://avatars.githubusercontent.com/u/1816271?v=4)](https://github.com/ahmed-elliethy "ahmed-elliethy (2 commits)")[![peterchibunna](https://avatars.githubusercontent.com/u/2616804?v=4)](https://github.com/peterchibunna "peterchibunna (2 commits)")[![Itope84](https://avatars.githubusercontent.com/u/33374480?v=4)](https://github.com/Itope84 "Itope84 (1 commits)")[![mohamedsabil83](https://avatars.githubusercontent.com/u/10126040?v=4)](https://github.com/mohamedsabil83 "mohamedsabil83 (1 commits)")[![nuelsoft](https://avatars.githubusercontent.com/u/32180049?v=4)](https://github.com/nuelsoft "nuelsoft (1 commits)")

---

Tags

laravelpaymentspaytabsE-comerce

### Embed Badge

![Health badge](/badges/emydev-laravel-paytabs/health.svg)

```
[![Health](https://phpackages.com/badges/emydev-laravel-paytabs/health.svg)](https://phpackages.com/packages/emydev-laravel-paytabs)
```

###  Alternatives

[paytabscom/laravel_paytabs

Official laravel package to implement PayTabs integration with laravel apps

24166.0k5](/packages/paytabscom-laravel-paytabs)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[a17mad/laravel-cybersource

This package wraps the Cybersource SOAP API in a convenient, easy to use package for Laravel.

136.8k](/packages/a17mad-laravel-cybersource)[threesquared/laravel-paymill

Laravel wrapper for the Paymill API

121.3k](/packages/threesquared-laravel-paymill)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
