47 lines
1.9 KiB
PHP
47 lines
1.9 KiB
PHP
<?php
|
|
// Setup PayPal parameters
|
|
$paypalAddress = 'paypal@hotlunches.net';
|
|
$paypalAddress = 'mark@hotlunches.net';
|
|
$paypalCurrency = 'CAD';
|
|
if ($school_record['country'] == 'USA') $paypalCurrency = 'USD';
|
|
$paypalRecordNum = $school_num;
|
|
$school_name = $school_record['school_name'];
|
|
|
|
$returnURL = $school_record['url'] . "/";
|
|
$cancelURL = $school_record['url'] . "/";
|
|
$postbackURL = $school_record['url'] . "/ppPaymentHotLunch.php";
|
|
|
|
if (!isset($invoice_num)) {
|
|
$open_invoices = db_query("SELECT record_num FROM invoice_header WHERE school_num = $school_num AND status = 'Open' ORDER BY record_num");
|
|
$row = db_fetch_assoc($open_invoices);
|
|
$invoice_num = sprintf("%06d",$row['record_num'] + 500);
|
|
}
|
|
|
|
$item_title = "Subscription Payment - $school_name ($invoice_num)";
|
|
|
|
$useSandbox = false;
|
|
if ($school_record['paypal_mode'] == 'Test') $useSandbox = true;
|
|
?>
|
|
<table>
|
|
<tr>
|
|
<td align='center'>
|
|
<form method='post' action='https://www.<?php echo $useSandbox?"sandbox.":"" ?>paypal.com/cgi-bin/webscr'>
|
|
<input type=hidden name="cmd" value="_xclick">
|
|
<input type=hidden name="business" value="<?php echo($paypalAddress) ?>">
|
|
<input type=hidden name="upload" value="1">
|
|
<input type=hidden name="bn" value="HotLunchesOnLine">
|
|
<input type=hidden name="currency_code" value="<?php echo($paypalCurrency) ?>">
|
|
<input type=hidden name="no_shipping" value="1">
|
|
<input type=hidden name="custom" value="<?php echo($paypalRecordNum) ?>">
|
|
<input type=hidden name="return" value="http://<?php echo($returnURL) ?>">
|
|
<input type=hidden name="cancel_return" value="http://<?php echo($cancelURL) ?>">
|
|
<input type=hidden name="notify_url" value="http://<?php echo($postbackURL) ?>">
|
|
|
|
<input type=hidden name="item_name" value="<?php echo($item_title) ?>">
|
|
<input type=hidden name="amount" value="<?php echo($current_balance_owing) ?>">
|
|
<input type='submit' value='Pay Online' class='btn btn--primary'>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
</table>
|