mgamal/paymob-laravel
最新稳定版本:v1.1.2
Composer 安装命令:
composer require mgamal/paymob-laravel
包简介
Paymob API with Laravel
README 文档
README
This is an integration between Laravel framework and Paymob API to make it easier for developers to use Paymob functionalities in their applications.
Installation
You can install the package via composer:
composer require mgamal/paymob-laravel
Optionally, you can publish the config file with:
php artisan vendor:publish --tag=config --provider="MG\Paymob\PaymobServiceProvider"
Usage
- Set Paymob credentials
PAYMOB_API_KEY = xxxxxxxxxxxxxxxxxxxxxx PAYMOB_INTEGRATION_ID = xxxxxx PAYMOB_IFRAME_ID = xxxxx PAYMOB_HMAC_SECRET = xxxxxxxxx
Reference: Paymob integration
- Prepare order items
- Prepare billing data
- Prepare total order
- Make payment with the full details of the order: items, billing data and total order.
Example
use MG\Paymob\Paymob; public function checkout(){ // Prepare order items $orderItems = [ [ 'name' => 'Product x', 'amount_cents' => 100, 'description' => 'Product description', 'quantity' => 1 ] ]; // Prepare billing data: Fill empty keys with 'N/A'; required! $billingData = [ 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'someone@example.com', 'phone_number' => '+1xxxxxxxx', 'apartment' => 'N/A', 'floor' => 'N/A', 'building' => 'N/A', 'street' => 'N/A', 'city' => 'N/A', 'shipping_method' => 'N/A', 'country' => 'N/A', 'state' => 'N/A', ]; // Prepare order itself $orderToPrepare['amount_cents'] = 10; $orderToPrepare['merchant_order_id'] = 101; $orderToPrepare['items'] = $orderItems; $orderToPrepare['billing_data'] = $billingData; // Get payment URL $paymentUrl = $item->makePayment($orderToPrepare); return $paymentUrl; }
统计信息
- 总下载量: 1.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-02