PHPackages                             samir-hussein/paymob - 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. [Payment Processing](/categories/payments)
4. /
5. samir-hussein/paymob

ActiveLibrary[Payment Processing](/categories/payments)

samir-hussein/paymob
====================

paymob payment gateway

2.0(3y ago)226.5k↓39.1%9[2 issues](https://github.com/samir-hussein/paymob/issues)MITPHP

Since Feb 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/samir-hussein/paymob)[ Packagist](https://packagist.org/packages/samir-hussein/paymob)[ RSS](/packages/samir-hussein-paymob/feed)WikiDiscussions main Synced 1mo ago

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

paymob
======

[](#paymob)

paymob payment gateway

paymob payment gateway API documentation

Youtube tutorial [https://www.youtube.com/watch?v=bRCZu9J8hWE&amp;ab\_channel=SamirHussein](https://www.youtube.com/watch?v=bRCZu9J8hWE&ab_channel=SamirHussein)

Installation
------------

[](#installation)

```
composer require samir-hussein/paymob
```

Contents
--------

[](#contents)

php
===

[](#php)

- [Authentication Request](#Authentication-Request)
- [Order Registration](#Order-Registration)
- [Payment Key Request](#Payment-Key-Request)
- [Refund Transaction](#Refund-Transaction)
- [Void Transaction](#Void-Transaction)

Usage In php native
-------------------

[](#usage-in-php-native)

step 1 :

```
    require_once "vendor/autoload.php";
    use Paymob\PayMob;
```

step 2 :

```
    $config = [
      'PayMob_User_Name' => 'your_username',
      'PayMob_Password' => 'your_password',
      'PayMob_Integration_Id' => 'Integration_Id',
    ];

    $init = new PayMob($config);
```

Authentication Request
======================

[](#authentication-request)

step 3 :

```
    $auth = PayMob::AuthenticationRequest();
```

Order Registration
==================

[](#order-registration)

step 4 :

```
    $order = PayMob::OrderRegistrationAPI([
      'auth_token' => $auth->token, // from step 3
      'amount_cents' => 150 * 100, //put your price
      'currency' => 'EGP',
      'delivery_needed' => false, // another option true
      'merchant_order_id' => 6, //put order id from your database must be unique id
      'items' => [[ // all items information
          "name" => "ASC1515",
          "amount_cents" => 150 * 100,
          "description" => "Smart Watch",
          "quantity" => "2"
      ]]
    ]);
```

Payment Key Request
===================

[](#payment-key-request)

step 5 :

```
    $PaymentKey = PayMob::PaymentKeyRequest([
      'auth_token' => $auth->token, // from step 3
      'amount_cents' => 150 * 100,//put your price
      'currency' => 'EGP',
      'order_id' => $order->id, // from step 4
      "billing_data" => [ // put your client information
          "apartment" => "803",
          "email" => "claudette09@exa.com",
          "floor" => "42",
          "first_name" => "Clifford",
          "street" => "Ethan Land",
          "building" => "8028",
          "phone_number" => "+86(8)9135210487",
          "shipping_method" => "PKG",
          "postal_code" => "01898",
          "city" => "Jaskolskiburgh",
          "country" => "CR",
          "last_name" => "Nicolas",
          "state" => "Utah"
      ]
    ]);
```

finally

```
