This is a PHP client wrapper for Cielo e-Commerce v3.
Via Composer
$ composer require chico-rei/cielo-ecommerce-v3-php "^1.0"
Requires PHP 7.1 or newer.
- 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
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.
$ composer test
Project based on DeveloperCielo/API-3.0-PHP
The MIT License (MIT). Please see License File for more information.