2mindapps / laravel-pay-unity
Laravel 中的统一支付和订阅处理。
dev-master
2024-09-26 17:36 UTC
Requires
- php: ^7.3 || 8.*
- guzzlehttp/guzzle: ^7.8
- respect/validation: ^2.1
This package is auto-updated.
Last update: 2024-09-26 17:36:31 UTC
README
PayUnity
PHP 库,用于集中处理支付网关集成,以统一的方式调用 API。
安装
使用 composer 安装此包
composer require 2mindapps/laravel-pay-unity
功能比较
网关方法
基本用法
- 通过提供参数(如首选网关、网关版本、账户环境和附加数据(如访问令牌或密钥))来实例化工厂类。
# Example instance for Pagar.me
$handler = new \MindApps\LaravelPayUnity\Factory('pagarme','v5','sandbox', ['secret_key' => 'MY_SCRET_KEY']);
- 根据功能比较表调用方法。
# Example for create customer
$data = (object) [
'first_name' => 'Fulano',
'last_name' => 'de Tal',
'document_type' => 'cpf',
'document_number' => '00011122233',
'email' => 'customer@example.com',
'birth_date' => '1990-01-01',
'address' => (object) [
'street' => 'Av XYZ',
'street_number' => '100',
'neighborhood' => 'Centro',
'zipcode' => '01100000',
'city' => 'São Paulo',
'state_code' => 'SP',
'country_code' => 'BR',
],
'phone' => (object) [
'country_code' => '+55',
'area_code' => '11',
'number' => '999999999',
],
];
$handler->customer()
->create($data)
->send(); #execute this method to send data to Gateway API
更多示例可以在 测试 中找到