承接 laraditz/bayar 相关项目开发

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

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

laraditz/bayar

最新稳定版本:0.0.6

Composer 安装命令:

composer require laraditz/bayar

包简介

Expressive and fluent interface to multiple payment gateways.

README 文档

README

Laravel Bayar

Laravel Bayar

Latest Version on Packagist Total Downloads GitHub Actions

Laravel Bayar is a multi-payment processing library for Laravel. It is easy to use and handle most of the tedious tasks when integrating with a payment gateway. You also can easily create a new payment gateway provider to use with this library package.

Installation

You can install the package via composer:

composer require laraditz/bayar

Run the migration command to create the necessary database table.

php artisan migrate

Then install the payment gateway provider that you wish to use. See supported providers section to see list of all available providers.

composer require gerbang-bayar/provider-name

Go to respective provider's repository to see how to set it up.

Usage

To create a payment intent, first create a PaymentData object. Then pass it into the createPayment method.

Here is the data that you can pass when creating PaymentData object. The extra prorperties can be used to pass an extra properties needed and it must follows the same property name as in the payment gateway respective's API.

public string $currency,
public int $amount, // smallest currency unit
public string $returnUrl,
public string $description,
public array $customer,
public ?string $callbackUrl = null,
public ?string $merchantRefId = null,
public ?array $extra = [],

To create payment and get the payment URL to be redirected to.

use Laraditz\Bayar\Data\PaymentData;

$paymentData = new PaymentData(
    description: 'Purchase',
    currency: 'MYR',
    amount: 1000,
    returnUrl: 'https://returnurl.here',
    customer: [
        'name' => 'Raditz Farhan',
        'phone' => '6012345678',
        'email' => 'raditzfarhan@gmail.com'
    ],
    extra: [
        'shippingAddress' => [
            'countryCode' => 'MY',
            'lines' => [
                'No 1, Taman ABC',
                'Jalan DCEF'
            ],
            'postCode' => '12345'
        ],
        'items' => [
            [
                'itemId' => 'ITEMSKU',
                'name' => 'Item 1',
                'quantity' => 1,
                'price' => 1000,
            ]
        ]    
    ]
);

$bayar = \Bayar::driver('atome')->createPayment($paymentData);

Return example:

[
  "id" => "01h91mbatnwn27y4y5s88b783k"
  "merchant_ref_id" => null
  "expires_at" => "2023-08-29T21:54:13.000000Z"
  "payment_url" => "http://yourappurl.com/bayar/pay/01h91mbatnwn27y4y5s88b783k"
]

Redirect to the payment_url to proceed to payment page. Once done, you will be redirected to the returnUrl.

Callback

Callback event will be managed automatically by this package. Each providers have their own callback event to receives payment update from respective payment gateway provider. You just need to add a listener for the event. Refer to the provider package for more info.

Supported Providers

Currently it has only one provider which is Atome, but the list will grows with time.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

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

Dependencies

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固