PayPal 捐赠您喜欢的内容下载

发布于 2025-01-06 19:41:39 字数 1588 浏览 0 评论 0原文

我正在寻找创建一个捐赠和下载脚本,允许您输入自己的金额,然后它会自动下载并将您带到贝宝。 0 也需要是一个选项金额。这是一个示例: http://www.losttype.com/font/?name=liberator< /a>

我已经创建了一个 PayPal 捐赠脚本并进行了编辑以添加输入金额,但是任何人都可以建议一种自动开始下载并允许 0 作为金额的方法吗?


也许我应该重新开始,我有以下代码,允许用户通过贝宝捐赠。它有一个输入金额,并将用户重定向到新窗口中的贝宝。 提交开始下载的最佳方式是什么?即使该人投入零,但他们可以在另一个窗口捐赠。 代码:

<div class="donate">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="myemail">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="info">
<table> <tr><td>Enter your Amount:</td></tr><tr><td><input type="text" name="amount"     value=""></td></tr> </table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>

I am looking to create a donate and Dowload script that allows you to put in your own money amount and then it automatically downloads and takes you to paypal. 0 needs to be an option amount also. Here is an example: http://www.losttype.com/font/?name=liberator

I have created a PayPal donate script and edited to add an input amount, but can anyone suggest a way to automatically start the download and allow 0 as an amount?


Maybe I should start again, I have the following code that allows the user to donate with paypal. This has an input amount, and redirects the user to paypal in a new window.
What would be the best way to on submit to start the download? even if the person puts in zero, and while they can donate in another window.
Code:

<div class="donate">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="myemail">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="info">
<table> <tr><td>Enter your Amount:</td></tr><tr><td><input type="text" name="amount"     value=""></td></tr> </table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

往日 2025-01-13 19:41:39

真的很容易。检测是否已选择金额,如果已选择,则重定向至 PayPal。
如果没有,则直接重定向到该文件。

下面是一个非常基本的、未经检查的示例:

    <?php

    echo "<p>Donate fixed amount to CharityName</p>
    <form method='POST' action=''>
    <select name='currency_code'>
    <option value='EUR'>EUR</option>
    <option value='GBP'>GBP</option>
    <option value='USD'>USD</option>
    <input type='text' name='donate_amount' value='0'>
    <input type='submit' name='submit' value='Donate'></form>";

    if(!empty($_POST['submit'])) {
    // Form has been submitted
      if($_POST['donate_amount'] > 0) {
    // Redirect to PayPal
    header('Location: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&item_name=Donation for XXX&amount='.$_POST['donate_amount'].'¤cy_code='.$_POST['currency_code'].'&[email protected]&cbt=Download the file&return=http://link-to-the-file&cancel_return=http://back-to-my-website');
    }
    else {
    // No donation amount entered - proceed to file directly
    header('Location: http://link-to-the-file/');
    }
}

    ?>

Easy enough really. Detect whether an amount has been chosen, and if it has, redirect to PayPal.
If it hasn't, redirect directly to the file.

Below is a very basic, unchecked example:

    <?php

    echo "<p>Donate fixed amount to CharityName</p>
    <form method='POST' action=''>
    <select name='currency_code'>
    <option value='EUR'>EUR</option>
    <option value='GBP'>GBP</option>
    <option value='USD'>USD</option>
    <input type='text' name='donate_amount' value='0'>
    <input type='submit' name='submit' value='Donate'></form>";

    if(!empty($_POST['submit'])) {
    // Form has been submitted
      if($_POST['donate_amount'] > 0) {
    // Redirect to PayPal
    header('Location: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&item_name=Donation for XXX&amount='.$_POST['donate_amount'].'¤cy_code='.$_POST['currency_code'].'&[email protected]&cbt=Download the file&return=http://link-to-the-file&cancel_return=http://back-to-my-website');
    }
    else {
    // No donation amount entered - proceed to file directly
    header('Location: http://link-to-the-file/');
    }
}

    ?>
江心雾 2025-01-13 19:41:39

这似乎通过客户端 JavaScript 代码更容易完成。点击捐赠后,下载按钮,JS判断输入的数量。如果为 0,则打开一个指向下载的新页面并返回 false(停止处理到 paypal);如果大于 0,则打开下载页面并返回 true(将付款移交给 paypal)。

This seems to be easier done from client side javascript code. Unpon clicking the donate & download button, JS determines the amount entered. If it is 0, it opens a new page that points to the downloads and return false (to stop processing to paypal) and if it's more than 0, then it opens the download page and returns true (to handoff the payment to paypal).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文