mykholy / laravel-paymob
paymob integration for laravel
                                    Fund package maintenance!
                                                                            
                                                                                                                                        Patreon
                                                                                    
                                                                
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/mykholy/laravel-paymob
Requires
- illuminate/support: ^7.0|^8.0|^9.0
README
    Laravel PayMob
    
     
  
Paymob integration for laravel.
Currently Supported
Installation
- 
install the package composer require mykholy/laravel-paymob 
- 
publish the package assets with php artisan vendor:publish --provider="mykholy\PayMob\PayMobServiceProvider"
Config
Setup
- 
add the package routes to your routes/web.phpex.Route::group([ 'prefix' => 'orders', 'as' => 'order.', 'middleware' => 'auth', ], function () { mykholy\PayMob\PayMobRoutes::routes(); }); 
- 
add Billableto the model you will be billing.
- 
next add getBillingData()which should return all the required fields for the order creation, check paymob requirements for more info.- all the optional fields has already been taken care of.
 use Illuminate\Database\Eloquent\Model; use mykholy\PayMob\Integrations\Contracts\Billable; class Client extends Model implements Billable { // ... public function getBillingData(): array { return [ 'email' => $this->email, 'first_name' => $this->first_name, 'last_name' => $this->last_name, 'street' => $this->address, 'phone_number' => $this->phone_number, ]; } } 
Usage
# Normal
- 
update paymob.controllerwith your own controller, which should have 3 methodsyou can check DummyControllerfor a more detailed overview.type @method return GET checkOutreturns the view where the user will press the checkout btn POST processget the selected payment type & make a request to paymob server GET completecheck for the transaction hmac & save it to your server, for more info check. 
# Refund
- 
all you need to is to call PayMob::refundand pass to it thetransaction_id&amount_in_poundsthat will be refunded, ex.for more info check PayMob::refund(655, 10); 
Security
If you discover any security-related issues, please email mykholy@protonmail.com.