orkhanahmadov/goldenpay
Composer 安装命令:
composer require orkhanahmadov/goldenpay
包简介
GoldenPay payment library for PHP and Laravel framework
README 文档
README
If you are using Laravel, you can use laravel-goldenpay package instead for better integration with extra features.
Requirements
PHP 7.2 or higher, with json extension.
Installation
composer require orkhanahmadov/goldenpay
Usage
First, instantiate Orkhanahmadov\Goldenpay\Goldenpay and call authenticate() method with "auth key" and "merchant name". Both can be acquired from Goldenpay merchant dashboard.
use Orkhanahmadov\Goldenpay\Goldenpay; $goldenpay = new Goldenpay(); $goldenpay->authenticate('auth-key-here', 'merchant-name-here');
Getting payment key
To get new payment key use payment method.
Method accepts following arguments:
- Amount - Amount to charge. Only integer accepted. For example 10.25 needs to be converted to 1025
- Card type - Requires instance of
Orkhanahmadov\Goldenpay\Enums\CardType.CardType::VISA()for VISA,CardType::MASTERCARD()for MasterCard - Description - Payment related description
- Language (optional) - Sets payment page interface language. Requires instance of
Orkhanahmadov\Goldenpay\Enums\Language.Language::EN()for english,Language::RU()for russian,Language::AZ()for azerbaijani. Default is azerbaijani
$paymentKey = $goldenpay->payment(100, CardType::VISA(), 'item-description', Language::EN());
Method will return instance of Orkhanahmadov\Goldenpay\Response\PaymentKey. You can access payment key and payment url from this object instance.
$paymentKey->getCode(); // endpoint response code $paymentKey->getMessage(); // endpoint response message $paymentKey->getPaymentKey(); // unique payment key $paymentKey->paymentUrl(); // payment url. you should redirect user to this url to start payment
Important! Goldenpay charges all payments only in AZN.
Checking payment result
To check payment result use result method.
Method accepts following arguments:
- Payment key - Previously available payment key
$paymentResult = $goldenpay->result('payment-key-here');
Method also accepts instance of Orkhanahmadov\Goldenpay\Response\PaymentKey as an argument.
Method will return instance of Orkhanahmadov\Goldenpay\Response\PaymentResult. You can access following properties from this object instance:
$paymentResult->getCode(); // status code $paymentResult->getMessage(); // status message $paymentResult->getPaymentKey(); // instance of Orkhanahmadov\Goldenpay\Response\PaymentKey $paymentResult->getMerchantName(); // merchant name $paymentResult->getAmount(); // charged amount in integer format. 100 = 1.00 $paymentResult->getCheckCount(); // shows how many times this payment key result checked $paymentResult->getPaymentDate(); // \DateTimeImmutable instance of payment date $paymentResult->getCardNumber(); // charged card number. only first 6 digits and last 4 digits. Example: 422865******8101 $paymentResult->getLanguage(); // 2 letter interface language: 'lv', 'en' or 'ru' $paymentResult->getDescription(); // description used for payment $paymentResult->getReferenceNumber(); // payment reference number
You can also use global helper function. Calling this function requires passing "auth key" and "merchant name".
$goldenpay = goldenpay('auth-key-here', 'merchant-name-here'); // returns instance of "Orkhanahmadov\Goldenpay\Goldenpay" $goldenpay->payment(100, CardType::VISA(), 'your-description', Language::EN());
Orkhanahmadov\Goldenpay\Goldenpay implements Orkhanahmadov\Goldenpay\GoldenpayInterface. You can use this interface as abstraction for dependency injection.
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 ahmadov90@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
orkhanahmadov/goldenpay 适用场景与选型建议
orkhanahmadov/goldenpay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 502 次下载、GitHub Stars 达 10, 最近一次更新时间为 2019 年 05 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「azerbaijan」 「goldenpay」 「orkhanahmadov」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 orkhanahmadov/goldenpay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 orkhanahmadov/goldenpay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 orkhanahmadov/goldenpay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP library to work with cbar.az currency rates
Laravel api for generating random strings,floats,integers,arrays and etc.
Laravel api for sending sms from different providers.
Azerbaijan PayRiff payment gateway for the Laravel framework.
Laravel 12/13 SDK for PASHA Bank CardSuite ECOMM (3D-Secure acquiring) integration.
Laravel api for converting date for humans reading
统计信息
- 总下载量: 502
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 13
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-01