chico-rei / cielo-ecommerce-v3-php
chico-rei
1.1.3
2020-05-15 20:15 UTC
Requires
- php: >=7.1
- guzzlehttp/guzzle: ~6.0
- nesbot/carbon: ^1.16||^2.0
Requires (Dev)
- php-coveralls/php-coveralls: ~1.0
- phpunit/phpunit: ^7.0
- squizlabs/php_codesniffer: 3.*
README
这是 Cielo e-Commerce v3 的 PHP 客户端包装器。
安装
通过 Composer
$ composer require chico-rei/cielo-ecommerce-v3-php "^1.0"
需要 PHP 7.1 或更高版本。
特性
- 创建支付
- 信用卡/借记卡
- 钱包(Visa Checkout / Masterpass / Apple Pay / Samsung Pay)
- 银行汇票
- 电子转账
- 周期性支付
- 更新支付
- 捕获
- 取消
- 周期性支付
- 查询支付
- 通过支付 ID
- 通过订单 ID
- 查询卡 Bin
- 卡令牌化
- 欺诈分析
- 速度
- 零授权
- 静默订单提交
使用方法
require 'path/to/vendor/autoload.php'; use \ChicoRei\Packages\Cielo\Cielo; use \ChicoRei\Packages\Cielo\Merchant; use \ChicoRei\Packages\Cielo\Util; $merchant = Merchant::create([ 'id' => 'Your_ID', 'key' => 'Your_KEY', ]); $cielo = new Cielo($merchant); // For sandbox use: new Cielo($merchant, true); try { $response = $cielo->sale()->create([ 'merchantOrderId' => '19800731', 'payment' => [ 'type' => 'CreditCard', 'amount' => 15700, // 157,00 'installments' => 2, 'softDescriptor' => 'Your Company', 'capture' => true, 'creditCard' => [ 'cardNumber' => '4551870000000000', 'holder' => 'Name', 'expirationDate' => '12/2021', 'securityCode' => '123', 'brand' => 'Visa' ] ] ]); echo $response->getPayment()->getStatus(); // Transaction Status Code $returnCode = $response->getPayment()->getReturnCode(); // Ex: '00' $details = Util::getReturnCodeDetails($returnCode); echo $details['definition']; // Transação autorizada com sucesso. } catch (CieloAPIException $e) { // Handle API errors (or validation errors) } catch (Exception $e) { // Handle exceptions }
查看 示例 获取更多信息。
测试
$ composer test
致谢
基于 DeveloperCielo/API-3.0-PHP 的项目
许可证
MIT 许可证(MIT)。请参阅 许可证文件 获取更多信息。