invays/bog-payments

v1.1 2024-03-31 02:00 UTC

This package is auto-updated.

Last update: 2024-10-01 00:09:24 UTC


README

该库创建的目的是简化各种PHP框架和CMS的软件开发。它允许您轻松地将您的网站或服务与格鲁吉亚银行支付系统集成。

该库提供了创建支付表单、读取订单信息和将订单返回给用户的个人账户管理员的基函数。

业务笔记

该库设计为允许您创建多个在线商店并使用不同的账户。因此,该库可以用于具有特许经营模式的电子商务。

开发笔记

该库使用Guzzle http客户端("guzzlehttp/guzzle": "^7.4")。请确保您已更新它。

安装

通过Composer安装此包。在终端中运行Composer require命令

composer require invays/bog-payments

示例

使用模板中包含的变量。

use Invays\BogPayments\BogPayments;

$bog->order->setLanguage('en');
$bog->order->setCurrency('GEL');
$bog->order->setCallbackUrl('https://example.com/notify');

$order_info = $bog->order->create_order([
            'shop_order_id' => 'OR-855',
            'customer'      => [
                'full_name'    => 'John Doe',
                'masked_email' => 'jonh.doe@example.com',
                'masked_phone' => '0123456789',
            ],
            'products'      => [
                [
                    'product_id' => 'product123',
                    'quantity'   => 1,
                    'price'      => 100,
                ],
                [
                    'product_id' => 'product123de',
                    'quantity'   => 1,
                    'price'      => 525,
                ],

            ],
            'delivery_cost' => 1000
        ]);

使用自定义用户变量,包括主题和重定向链接。

use Invays\BogPayments\BogPayments;

$bog = new BogPayments(0000, '000000');
$bog->order->setLanguage('en');
$bog->order->setCurrency('GEL');
$bog->order->setCallbackUrl('https://example.com/notify');
$bog->order->setFailureUrl('https://example.com/failure');
$bog->order->setSuccessUrl('https://example.com/success');
$bog->order->setHeaderTheme('dark');

$order_info = $bog->order->create_order([
            'shop_order_id' => 'OR-855',
            'customer'      => [
                'full_name'    => 'John Doe',
                'masked_email' => 'jonh.doe@example.com',
                'masked_phone' => '0123456789',
            ],
            'products'      => [
                [
                    'product_id' => 'product123',
                    'quantity'   => 1,
                    'price'      => 100,
                ],
                [
                    'product_id' => 'product123de',
                    'quantity'   => 1,
                    'price'      => 525,
                ],

            ],
            'delivery_cost' => 1000
        ]);

创建退款

use Invays\BogPayments\BogPayments;

$bog = new BogPayments(0000, '000000');
$bog->refund->create_refund('order_id', 10.0);

创建分期付款按钮

use Invays\BogPayments\BogPayments;

// Use separate key for installment
$bog = new BogPayments(00000, '', 'installment');
$bog->installment->setButtonText('My custom text');
$bog->installment->setCallbackUrl('https://example.com/notify');