* Setting a discount as a flat value:
 *
 * $order->setDiscount(15, Payment_PagamentoCerto_Order::DISCOUNT_TYPE_VALUE);
 */
/**
 * Defining the payment method
 *
 * Both are valid:
 * $order->setPaymentMethodAsInvoice();
 * $order->setPaymentMethodAsCreditCardVisa();
 */
$order->setPaymentMethodAsInvoice();
/**
 * This is where the user will be redirected to by the payment gateway.
 * In this page, the user should be able to see the transaction result.
 * An example of how this can be done can be found in the file:
 * examples/getTransactionInfo.php
 */
$postbackUrl = 'http://www.example.com/transactionResult.php';
$sellerApiKey = '3821023c-1602-499b-a220-258aeb83c13b';
$process = new Payment_PagamentoCerto($sellerApiKey, $postbackUrl);
try {
    $transactionId = $process->startTransaction($order);
    /**
     * Now the user is redirected to the payment gateway to proceed
     * with the payment
     */
    $process->redirectToPaymentGateway($transactionId);
} catch (Payment_PagamentoCerto_Exception $e) {
    echo $e->getMessage();
}
 * from the payment gateway.
 *
 * Your store postback URL should be a script that looks like this, so
 * the user can view all the information of the transaction.
 *
 * PHP version 5
 *
 * @category Payment
 * @package  PagamentoCerto
 * @author   Pedro Padron <*****@*****.**>
 * @license  LGPL http://www.gnu.org/licenses/lgpl.html
 * @link     http://pear.php.net/packages/Payment/PagamentoCerto
 */
require_once 'Payment/PagamentoCerto.php';
$sellerApiKey = '3821023c-1602-499b-a220-258aeb83c13b';
$obj = new Payment_PagamentoCerto($sellerApiKey);
if (!isset($_GET["tid"])) {
    // if the transaction id wasn't specified, you should do something more
    // user-friendly than throwing an exception
    throw new Payment_PagamentoCerto_Exception('Transaction ID was not specified');
}
// The payment gateway must send the transaction ID via GET
$transactionId = $_GET["tid"];
try {
    // Fetching the transaction information
    $transaction = $obj->getTransactionInfo($transactionId);
    echo "<pre>";
    print_r($transaction);
    echo "</pre>";
} catch (Payment_PagamentoCerto_Exception $e) {
    echo $e->getMessage();