Example #1
0
<?php

require_once __DIR__ . '/demo.inc.php';
$service = new PayService();
$factory = $service->getFactory();
$isOK = true;
$message = '';
if ($id = getIdInPost()) {
    $charge = $factory->retrieve($id);
    if ($refund = getAmountInPost('refund')) {
        $charge->refund($refund);
        $message = 'refunded';
    } else {
        $charge->cancel();
        $message = 'canceled';
    }
} else {
    $isOK = false;
    $message = 'not id or refund amount found.';
}
?>
<h1><a href="index.php" >top</a> &gt; Refund</h1>
<?php 
echo showMessage($message, $isOK);
?>
<a href="list-pay.php">back to list</a>
Example #2
0
<?php

require_once __DIR__ . '/demo.inc.php';
$service = new PayService();
if ($service_name = getIdInPost('service')) {
    $key = getIdInPost('key');
    $pub = getIdInPost('pub');
    $service->setupService($service_name, $key, $pub);
}
?>
<h1>Credit Cards</h1>

<h3>Current Service</h3>

<?php 
if ($service->isLoaded()) {
    ?>

    <?php 
    echo $service->getInfo();
    ?>
    <a href="new-pay.php">new payment</a><br/>
    <a href="list-pay.php">list payments</a>
    
<?php 
} else {
    ?>
    
    <p>service not set. </p>

<?php