abelaguiar / cielo-api
Cielo API 的 PHP-SDK
1.1.4
2018-08-18 13:33 UTC
Requires
- php: >=5.6.4
- guzzlehttp/guzzle: ~6.0
- ramsey/uuid: ^3.5
Requires (Dev)
- phpunit/phpunit: ^5.5
README
我在进行中,目前请勿认真对待我的更改。Cielo 文档: https://developercielo.github.io/manual/cielo-ecommerce#sandbox-e-ferramentas
通过 Composer 安装
您可以通过终端执行以下命令进行安装
composer require abelaguiar/cielo-api
或者您可以在您的 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');