chico-rei / cielo-ecommerce-v3-php
chico-rei
Installs: 11 590
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 4
Forks: 1
Open Issues: 1
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
This is a PHP client wrapper for Cielo e-Commerce v3.
Install
Via Composer
$ composer require chico-rei/cielo-ecommerce-v3-php "^1.0"
Requires PHP 7.1 or newer.
Features
- Create Payment
- Credit/Debit Card
- Wallet (Visa Checkout / Masterpass / Apple Pay / Samsung Pay)
- Boleto
- Eletronic Transfer
- Recurrent
- Update Payment
- Capture
- Void
- Recurrent Payment
- Query Payment
- By Payment ID
- By Order ID
- Query Card Bin
- Tokenize Card
- Fraud Analysis
- Velocity
- Zero Auth
- Silent Order Post
Usage
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 }
See examples for more.
Testing
$ composer test
Credits
Project based on DeveloperCielo/API-3.0-PHP
License
The MIT License (MIT). Please see License File for more information.