承接 alet-systems/alet-payment 相关项目开发

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

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

alet-systems/alet-payment

最新稳定版本:v2.0.3

Composer 安装命令:

composer require alet-systems/alet-payment

包简介

AletPayment Laravel API Package.

README 文档

README

AletPayment Laravel API Package.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Documentation

See the Developer API docs.

Installation

You can install the package via composer:

composer require alet-systems/alet-payment

For Laravel version <= 5.4

With version 5.4 or below, you must register your facades manually in the aliases section of the config/app.php configuration file.

"aliases": {
            "AletPayment": "AletPayment\\AletPayment\\Facades\\AletPayment"
        }

Usage

The package needs to be configured with your account's API key, which is available in the AletPayment Dashboard. Require it with the key's value. After install the package. you can use as follow.

⚠️ Since V2 AletPayment->create() is deprecated and AletPayment->checkout->create() should be used.

use AletPayment\AletPayment\AletPayment;

...

$alet-systems = new AletPayment('your-api-key');

Creating Checkout Session

After importing the alet-systems package, use the checkout property of the AletPayment instance to create or fetch checkout sessions.

use AletPayment\AletPayment\AletPayment;
use AletPayment\AletPayment\Helper\AletPaymentSupport;
use AletPayment\AletPayment\Lib\AletPaymentBeneficary;
use AletPayment\AletPayment\Lib\AletPaymentCheckoutItem;
use AletPayment\AletPayment\Lib\AletPaymentCheckoutRequest;
use AletPayment\AletPayment\Lib\AletPaymentOptions;

use Illuminate\Support\Carbon;

$alet-systems = new AletPayment('your-api-key');
$d = new  Carbon::now();
$d->setMonth(10);
$expired = AletPaymentSupport::getExpireDateFromDate($d);
$data = new AletPaymentCheckoutRequest(
    cancel_url: 'https://api.alet-systems.com',
    error_url: 'https://api.alet-systems.com',
    notify_url: 'https://gateway.alet-systems.net/test/callback',
    expireDate: $expired,
    nonce: floor(rand() * 10000) . "",
    beneficiaries: [
        AletPaymentBeneficary::fromJson([
            "accountNumber" => '01320811436100',
            "bank" => 'AWINETAA',
            "amount" => 10.0,
        ]),
    ],
    paymentMethods: ["CARD"],
    success_url: 'https://gateway.alet-systems.net',
    items: [
        AletPaymentCheckoutItem::fromJson([
            "name" => 'Bannana',
            "price" => 10.0,
            "quantity" => 1,
        ]),
    ],
);
$session =  $alet-systems->checkout->create($data, new AletPaymentOptions(sandbox: true));
echo $session->session_id;

::Note you Must use use Illuminate\Support\Carbon instead of use Carbon\Carbon to get the expire date

After putting your building AletPaymentCheckoutRequest just call the create method. Note passing sandbox: true option will create the session in test environment.

This is session response object contains the following fields

{
  sessionId: string;
  paymentUrl: string;
  cancelUrl: string;
  totalAmount: number;
}

Getting Session by Session ID

To track the progress of a checkout session you can use the fetch method as shown below:

 $alet-systems = new AletPayment('API KEY...');
// A sessionId will be returned when creating a session.
 $session = $alet-systems->checkout->fetch('checkOutSessionID', new AletPaymentOptions(true));

The following object represents a session

{
  public int $id, 
  public AletPaymentTransaction $transcation, 
  public float $totalAmount, 
  public bool $test,  
  public string $uuid, 
  public string $created_at, 
  public string $update_at
}

Cancel Session by Session ID

If the merchant want to cancel a checkout session. it's now possible as shown below.

 $alet-systems = new AletPayment('API KEY...');
// A sessionId will be returned when creating a session.
 $session = $alet-systems->checkout->cancel('checkOutSessionID', new AletPaymentOptions(true));

The AletPaymentCheckoutSession class is returned.

DirectPay

learn more about DirectPay here

DirectPay for telebirr

     $session = $alet-systems->checkout->create($data, new AletPaymentOptions(true));

    return $alet-systems->directPay->telebirr->pay($session->session_id);

DirectPay for awash wallet

     $session = $alet-systems->checkout->create($data, new AletPaymentOptions(true));

    return $alet-systems->directPay->awash_wallet->pay($session->session_id);

DirectPay for awash

     $session = $alet-systems->checkout->create($data, new AletPaymentOptions(true));

    return $alet-systems->directPay->awash->pay($session->session_id);

Change Log

Released Date: v1.0.0 June 09, 2022

  • Initial Release

Released Date: v1.2.0 June 30, 2022

  • Name space changed. use AletPayment/AletPayment
  • Exception Handling Improved

Released Date: v1.3.0 June 30, 2022

  • expiredate parameter in checkout session create formate changed to LocalDateTime format
  • Exception Handling For Non Exsisting Session

Released Date: v2.0.0 Aug 10, 2022

  • DirectPay added for Telebirr and Awash payment options

More Information

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固