PHP code example of escapework / tray-php
1. Go to this page and download the library: Download escapework/tray-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/ */
escapework / tray-php example snippets
use EscapeWork\Tray\Transaction;
$transaction = new Transaction();
$transaction->setOrderNumber('seu-id-do-pedido');
$transaction->setPriceDiscount(0);
$transaction->setUrlSeller('http://seu-site.com/url-de-retorno');
$transaction->setUrlNotification('http://seu-site.com/url-de-notificacao');
$transaction->setPostalCodeSeller('91780010');
$transaction->setShippingType('Grátis');
$transaction->setShippingPrice(0);
# produtos
$transaction->addProduct(array(
'code' => 'your-product-code',
'description' => 'your-product-description',
'quantity' => 1,
'price_unit' => 'your-product-price',
));
$transaction->create();
$redirectUrl = $transaction->getUrl() . $transaction->getTokenTransaction();
$transaction = new Transaction();
$transaction->setTokenTransaction('token-da-notificacao');
$transaction->notification();
# depois disso, você pode consultar tudo isto:
$transaction->getOrderNumber();
$transaction->getFree();
$transaction->getTransactionId();
$transaction->getStatusId();
$transaction->getStatusName();
$transaction->getTokenTransaction();
# payment
$transaction->payment->getPricePayment();
$transaction->payment->getPaymentResponse();
$transaction->payment->getUrlPayment();
$transaction->payment->getTid();
$transaction->payment->getSplit();
$transaction->payment->getPaymentMethodId();
$transaction->payment->getPaymentMethodName();
$transaction->payment->getLinhaDigitavel();
javascript
"ework/tray-php": "0.1.*"
}