承接 ayman-elmalah/laravel-myfatoorah 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ayman-elmalah/laravel-myfatoorah

Composer 安装命令:

composer require ayman-elmalah/laravel-myfatoorah

包简介

My fatoorah api wrapper

README 文档

README

laravel myfatoorah is a php package written by Ayman Elmalah with laravel to handle myfatoorah functionality by making it's api more easy .

Features

  • Creating invoices
  • Returning payments
  • Check that payment is success or not
  • Change the token on the fly
  • Refund invoice

Installation Guide

Composer installation

composer require ayman-elmalah/laravel-myfatoorah

The package is compatible with laravel ^6.0|^7.0|^8.0|^9.0 so you don't need to set providers or aliases for the package, we're using laravel auto discovery

Configuration

To publish config run

php artisan vendor:publish --provider="AymanElmalah\MyFatoorah\MyFatoorahServiceProvider"

and modify the config file with your own information. File is located in /config/myfatoorah.php

Get Your Credentials From Myfatoorah

  • Go to My fatoorah
  • You will get access token
  • Go to your .env file and paste your credentials to be like this
  • MYFATOORAH_MODE options ["test", "live", "live-sa"]
MYFATOORAH_MODE=test
MYFATOORAH_TOKEN=token

or you can add it using setAccessToken($token?)->setMode($mode?)

You are now ready to use the package

Test cards page

You can get test cards from DOCS

Usage examples

Create payment page

Route::get('payment', [\App\Http\Controllers\MyFatoorahController::class, 'index']);
Route::get('payment/callback', [\App\Http\Controllers\MyFatoorahController::class, 'callback']);
Route::get('payment/error', [\App\Http\Controllers\MyFatoorahController::class, 'error']);

At the controller, you can get the data from payment page at DOCS

use AymanElmalah\MyFatoorah\Facades\MyFatoorah;

public function index() {
     $data = [
       'CustomerName' => 'New user',
       'NotificationOption' => 'all',
       'MobileCountryCode' => '+966',
       'CustomerMobile' => '0000000000',
       'DisplayCurrencyIso' => 'SAR',
       'CustomerEmail' => 'test@test.test',
       'InvoiceValue' => '100',
       'Language' => 'en',
       'CallBackUrl' => 'https://yourdomain.test/callback',
       'ErrorUrl' => 'https://yourdomain.test/error',
   ];

// If you want to set the credentials and the mode manually.
//    $myfatoorah = MyFatoorah::setAccessToken($token)->setMode('test')->createInvoice($data);

// And this one if you need to access token from config
   $myfatoorah = MyFatoorah::createInvoice($data);

 // when you got a response from myFatoorah API, you can redirect the user to the myfatoorah portal 
 return response()->json($myfatoorah);
}

Get callback to check if success payment

public function callback(Request $request) {
   $myfatoorah = MyFatoorah::payment($request->paymentId);

   // It will check that payment is success or not
   // return response()->json($myfatoorah->isSuccess());
   
   // It will return payment response with all data
   return response()->json($myfatoorah->get());
}

Error page

public function error(Request $request) {
   // Show error actions
   return response()->json(['status' => 'fail']);
}

Refund payment

Route::get('reund', [\App\Http\Controllers\MyFatoorahController::class, 'refund']);

At the controller, you can get the data from payment page at DOCS

use AymanElmalah\MyFatoorah\Facades\MyFatoorah;

public function refund() {
     $data = [
       'KeyType' => 'invoiceid',     // can be invoiceId or PaymentId
       'Key' => '94272',             // key value like payment reference id, you can got it from the $request->paymentId in callback function 
       'RefundChargeOnCustomer' => false,
       'ServiceChargeOnCustomer' => false,
       'Amount' => 210,
       'Comment' => 'Refund',
       'AmountDeductedFromSupplier' => 0
     ];

   // If you want to set the credentials and the mode manually.
   // $myfatoorah = MyFatoorah::setAccessToken($token)->setMode('test')->refundInvoice($data);

   // And this one if you need to access token from config
   $myfatoorah = MyFatoorah::refundInvoice($data);

   // You can check the output
   return response()->json($myfatoorah);
}

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • If yo have any questions, issues or PRs feel free to contact me.

ayman-elmalah/laravel-myfatoorah 适用场景与选型建议

ayman-elmalah/laravel-myfatoorah 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.3k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2021 年 03 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ayman-elmalah/laravel-myfatoorah 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ayman-elmalah/laravel-myfatoorah 我们能提供哪些服务?
定制开发 / 二次开发

基于 ayman-elmalah/laravel-myfatoorah 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 21
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 21
  • Watchers: 1
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-25