automatically create buy now button paypal?

前端 未结 4 1762
走了就别回头了
走了就别回头了 2020-12-09 12:26

I want to automatically create a paypal buy now button.

What is the easiest way to do it?

相关标签:
4条回答
  • 2020-12-09 12:36

    The HTML Code to add a simple paypal buy now button is this:

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <!-- Identify your business so that you can collect the payments. -->
        <input type="hidden" name="business" value="email@domain.com">
        <!-- Specify a Buy Now button. -->
        <input type="hidden" name="cmd" value="_xclick">
        <!-- Specify details about the item that buyers will purchase. -->
        <input type="hidden" name="item_name" value="Demo Ebook">
        <input type="hidden" name="amount" value="5">
        <input type="hidden" name="currency_code" value="USD">
        <!-- Display the payment button. -->
        <input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
        <img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
    </form>
    

    If you want to change the items dynamically just change the item_name value.

    More information with demo and download link can be found here

    0 讨论(0)
  • 2020-12-09 12:38

    I know it's been a while but this was the best help:

    https://www.paypal.com/cgi-bin/webscr?cmd=_singleitem-intro-outside

    Just fill in the form and PayPal will generate the HTML form for you. Under the Buttons navigation on the left you can also generate the code for "Buy Now", "Add to Cart", "Donate", "Buy Gift Certificate" and "Subscribe".

    0 讨论(0)
  • 2020-12-09 12:46

    The following page lists the minimum-required information for a Buy Now button. I've included the most simple example:

    https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_techview_outside

    <?php
    echo '<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="me@mybusiness.com">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="item_name" value="Teddy Bear">
    <input type="hidden" name="amount" value="12.99">
    <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">
    </form>';
    

    Don't forget to escape any " ' " characters (single quotes).

    0 讨论(0)
  • 2020-12-09 12:47

    I also found out that you can pass the info in a url like this:

    https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=herschelgomez@xyzzyu.com&item_name=Hot Sauce-12+oz.+Bottle&item_number=12345&amount=5%2e95&currency_code=USD
    

    and you could do something like this:

    <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=herschelgomez@xyzzyu.com&item_name=Hot Sauce-12+oz.+Bottle&item_number=12345&amount=5%2e95&currency_code=USD">
    <img src="/buynow.png" />
    </a>
    
    0 讨论(0)
提交回复
热议问题