1. Go to this page and download the library: Download devsitarget/sdk-cielo-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devsitarget / sdk-cielo-php example snippets
use CieloSdk\Cielo;
use CieloSdk\Environment;
use CieloSdk\Store;
$store = new Store(
merchantId: 'SEU_MERCHANT_ID',
merchantKey: 'SEU_MERCHANT_KEY',
environment: Environment::sandbox() // ou Environment::production()
);
$cielo = new Cielo($store);
use CieloSdk\Address;
use CieloSdk\CreditCard\CreditCard;
use CieloSdk\CreditCard\CreditCardRequest;
use CieloSdk\Customer;
$sale = $cielo->createCreditCardPayment(new CreditCardRequest(
merchantOrderId: '2017051001',
amount: 15700,
customer: new Customer(
name: 'Aline de Souza',
email: '[email protected]',
identity: '12345678909',
address: new Address(
street: 'Alameda Xingu',
number: '512',
zipCode: '12345987',
city: 'São Paulo',
state: 'SP'
)
),
creditCard: new CreditCard(
holder: 'Aline de Souza',
expirationDate: '12/2035',
brand: 'Visa',
number: '4091688625337641',
securityCode: '333'
),
installments: 1,
capture: true,
softDescriptor: 'LojaTeste'
));
// $sale->paymentId, $sale->tid, $sale->status, $sale->proofOfSale, $sale->authorizationCode