plan-a23/paymob

:package_description

dev-main 2023-07-23 18:04 UTC

This package is auto-updated.

Last update: 2024-10-23 20:46:59 UTC


README

Latest Version on Packagist Total Downloads

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require plan-a23/paymob

Main Setup

Config

$ php artisan vendor:publish --tag=config --force

env

PAYMOB_API_KEY: xxxxxxx
PAYMOB_HMAC: xxxxxxxx

Card

env

PAYMOB_CARD_INTEGRATION:xxxxx
PAYMOB_CARD_IFRAME_ID:xxxxx

Payment

use PlanA23\Paymob\Classes\CardPay;

$pay = new CardPay();
$pay->setItems([
    [
        "name"=>"ASC1515",
        "amount_cents"=> "500000",
        "description"=>"Smart Watch",
        "quantity"=> "1"
    ],
    [
        "name"=> "ERT6565",
        "amount_cents"=> "200000",
        "description"=> "Power Bank",
        "quantity"=> "1"
    ]
]);
$pay->setAmountCents(700000);
$pay->setPayOrderId(2); // don't duplicate this id
// can enter shipping data only or shipping and billing
$pay->setShippingData(
    first_name: 'test',
    last_name:'test',
    email: 'test@domain.com',
    phone_number:'+201xxxxxxxx',
    country:'EG',
    state:'giza',
    city: '6 october',
    street: '123 elhosry' ,
    postal_code: 34546
);
$pay->setBillingData( 
    first_name: 'test',
    last_name:'test',
    email: 'test@domain.com',
    phone_number:'+201xxxxxxxx',
    country:'EG',
    state:'giza',
    city: '6 october',
    street: '123' ,
    postal_code: 34546);
return $pay->payment();

Wallet

env

PAYMOB_WALLETS_INTEGRATION:xxxxxxx

payment

use PlanA23\Paymob\Classes\WalletPay;
$pay = new WalletPay();
$pay->setItems([
    [
        "name"=>"ASC1515",
        "amount_cents"=> "500000",
        "description"=>"Smart Watch",
        "quantity"=> "1"
    ],
    [
        "name"=> "ERT6565",
        "amount_cents"=> "200000",
        "description"=> "Power Bank",
        "quantity"=> "1"
    ]
]);
$pay->setAmountCents(700000);
$pay->setPayOrderId(2); // don't duplicate this id
// can enter shipping data only or shipping and billing
$pay->setShippingData(
    first_name: 'test',
    last_name:'test',
    email: 'test@domain.com',
    phone_number:'+201xxxxxxxx',
    country:'EG',
    state:'giza',
    city: '6 october',
    street: '123 elhosry' ,
    postal_code: 34546
);
$pay->setBillingData(
    first_name: 'test',
    last_name:'test',
    email: 'test@domain.com',
    phone_number:'+201xxxxxxxx',
    country:'EG',
    state:'giza',
    city: '6 october',
    street: '123 elhosry' ,
    postal_code: 34546);
$pay->setPhoneNumber('+201xxxxxxxxx'); // for wallet
return $pay->payment(); //this is link for payment

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author@email.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.