0

首先,我的英语不好,很抱歉,
我正在尝试付款按钮,但我不明白该怎么做
我试过:

索引.php

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="myemail@email.com">
<input type="hidden" name="lc" value="IL">
<input type="hidden" name="item_name" value="song1">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="currency_code" value="ILS">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://www.site.com/paypal.php">
<input type="hidden" name="cancel_return" value="http://www.site.com/index.php">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="hidden" name="cbt" value="CLICK HERE TO DOWNLOAD YOUR SONG">
<input type="hidden" name="invoice" value="13579">
<input type="hidden" name="custom" value="<?php echo $_SERVER["REMOTE_ADDR"]; ?>">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

贝宝.php

<?php

// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];

echo $payment_status." - ".$txn_id.$item_name;

?>

我不知道怎么做,请我需要你的帮助
谢谢大家

4

0 回答 0