PHPackages                             ahmedebead/cakephp-4-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. ahmedebead/cakephp-4-paymob

ActiveCakephp-plugin[Payment Processing](/categories/payments)

ahmedebead/cakephp-4-paymob
===========================

Cakephp Paymob plugin for CakePHP

0.1(4y ago)12MITPHPPHP &gt;=7.2

Since Jul 24Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

CAKEPHP 4 Paymob
================

[](#cakephp-4-paymob)

paymob
======

[](#paymob)

paymob payment gateway

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

[](#installation)

```
composer require ahmedebead/cakephp-4-paymob
```

Usage In CakePhp
----------------

[](#usage-in-cakephp)

### Enable Plugin

[](#enable-plugin)

```
// src/Application.php

public function bootstrap()
{
    $this->addPlugin('CakephpLte', ['autoload' => true, 'bootstrap' => true, 'routes' => true]);
}
```

Or, you can load the plugin using the shell command

```
   $ bin/cake plugin load CakeRestApi
```

### Configure

[](#configure)

```
// new config/cakephplte.php file

return [
    'CakephpPaymob' => [
        'apiKey' => '{your-api-key-here-from-your-account}',
        'card_integration_id' => 'card_integration_id', //https://accept.paymob.com/portal2/en/PaymentIntegrations
        'mobile_wallet_integration_id' => 'mobile_wallet_integration_id', //https://accept.paymob.com/portal2/en/PaymentIntegrations

    ]
];

// config/bootstrap.php

Configure::load('cakephppaymob', 'default');
```

Usage
-----

[](#usage)

#### step 1 :

[](#step-1-)

```
use CakephpPaymob\CakephpPaymob;
```

#### step 2 :

[](#step-2-)

Init new client

```
 $client = new CakephpPaymob();
```

#### step 3 :

[](#step-3-)

Order Registration

```
$orderData = [
   "delivery_needed" => "false",  // Required -- Set it to be true if your order needs to be delivered by Accept's product delivery services.
   "amount_cents" => 100, // price * 100  Required
   "currency" => "EGP", // Required
   "merchant_order_id" => 5,
   "items" => [// Required
         [
            "name" => "ASC1515",
            "amount_cents" => "500000",
            "description" => "Smart Watch",
            "quantity" => "1"
         ],
         [
               "name" => "ERT6565",
               "amount_cents" => "200000",
               "description" => "Power Bank",
               "quantity" => "1"
            ]
      ],

];

 $order = $client->OrderRegistrationAPI($orderData);
```

### Card Payment

[](#card-payment)

```
use CakephpPaymob\PaymentTypes\Card;

 $card = new Card();
        $PaymentKey =  $card->PaymentKeyRequest([
            'amount_cents' => 150 * 100, //put your price
            'currency' => 'EGP',
            'order_id' => $order['id'],// From step 3 before
            "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"
            ]
        ]);

        $this->set('PaymentKey',$PaymentKey);
```

#### finally create view and use your iframe like this ( Card Payment)

[](#finally-create-view-and-use-your-iframe-like-this--card-payment)

### card information testing

[](#card-information-testing)

Card number : 4987654321098769
Cardholder Name : Test Account
Expiry Month : 05
Expiry year : 21
CVV : 123

```
