I'm working on it, don't take my changes seriously by now. Documentation of Cielo: https://developercielo.github.io/manual/cielo-ecommerce#sandbox-e-ferramentas
You can install via terminal, executing the following command:
composer require abelaguiar/cielo-api
or you can add this in your composer.json
"require": {
"abelaguiar/cielo-api": "^1.1.1"
}
<?php
require_once('vendor/autoload.php');
use AbelAguiar\Cielo\Cielo;
use AbelAguiar\Cielo\Payments\CreditCardPayment;
// Create a new instance of Cielo...
$cielo = new Cielo(
'Your Merchant ID goes here',
'Your Merchant Key goes here'
);
// Create a new instance of Payment Method Credit...
$creditCard = new CreditCardPayment([
'cardNumber' => '0000000000000001',
'holder' => 'John F Doe',
'expirationDate' => '12/2020',
'securityCode' => '123',
'installments' => 5,
'amount' => 259.90
]);
// Set the Customer and the Payment Method...
$cielo->setCustomer('John F. Doe')
->setPaymentMethod($creditCard);
// Performs a transaction...
$response = $cielo->performTransaction();
// or ------------------------------------
// Create a new instance of Payment Method Debit...
$debitCard = new DebitCardPayment([
'cardNumber' => '0000000000000001',
'holder' => 'John F Doe',
'expirationDate' => '12/2020',
'securityCode' => '123',
'amount' => 259.90,
'returnUrl' => 'https://www.cielo.com.br'
]);
// Set the Customer and the Payment Method...
$cielo->setCustomer('John F. Doe')
->setPaymentMethod($debitCard);
// Performs a transaction...
$response = $cielo->performTransaction();
<?php
require_once('vendor/autoload.php');
use AbelAguiar\Cielo\Cielo;
// Create a new instance of Cielo...
$cielo = new Cielo(
'Your Merchant ID goes here',
'Your Merchant Key goes here'
);
// Consult a transaction by id...
$response = $cielo->consultTransaction('Transaction ID goes here');
// Consult a transaction by id...
$response = $cielo->captureTransaction('Transaction ID goes here');